Skip to main content
Glama

zentao-autofix

把禅道(ZenTao)上指派给自己的缺陷,交给 AI 智能体自动修掉。

它不替你改代码——它让任何智能体学会改。 一个零依赖的 MCP 服务 + 一份 skill: MCP 负责取缺陷、判断能不能修、给出仓库上下文、记账、汇总;智能体负责读代码、改代码。 分工明确,所以它在 Qoder CN、Claude Code、Cursor、DSH 里都能跑。

禅道缺陷  →  预筛(改数据的跳过)  →  产品映射到仓库  →  智能体改代码  →  自动汇总

解决什么问题

缺陷列表里混着两类东西:

类型

例子

能不能自动修

代码缺陷

「内部转让单中内部转让值默认不要填 0,应为空白必填校验就行」

✅ 能

代码缺陷

「报废申请显示的英文,应该是报废申请」

✅ 能(i18n 词条)

数据问题

「生产-补充缺失数据-不动产租赁数据」

❌ 跳过

数据问题

「生产环境固定资产台账初始化导入数据有些数据没有创建时间和创建人」

❌ 跳过

第二类碰了就是生产事故。这个插件在预筛阶段就把它们摘出去,不交给模型判断—— 因为让模型「自己决定要不要改数据库」是把风险交给了运气。

区别只有一条:改完之后是代码变了,还是数据库里的记录变了。 只有前者能做。

Related MCP server: Zentao MCP Server

特性

  • 产品 → 仓库字典:禅道的「所属产品」列映射到本地代码仓库,支持包含匹配(「资产管理系统」能匹配「北辰集团资产管理」)。没配仓库的产品会被标出来,工具绝不猜路径。

  • 两道跳闸:改数据的缺陷在预筛阶段摘除;同一方向连续失败 2 次自动停,不在错的路上硬撞。

  • 自动收尾:没有可修的、或达到本轮上限(默认 10 条),自动停止并给出汇总报告——修了什么、怎么修的、哪些跳过了、为什么。

  • 登录真验:同时探测 REST API v1(/api.php/v1/tokens,新版本)和网页 Cookie(/user-login.html,老版本兜底),两个通道哪个通用哪个。

  • 默认只读:不写回禅道。写回需要显式打开,且会在缺陷下留 【AI 自动修复】 评论。

  • 零依赖:纯 Node ESM,无 npm 依赖,内网断网可用。配置跟着机器走(~/.zentao-autofix),插件装在任意目录都行。

安装

需要 Node ≥ 18。

git clone https://github.com/Fzl-Code-Repository/zentao-autofix.git
cd zentao-autofix
node scripts/install.mjs          # 只检测本机装了哪些智能体
node scripts/install.mjs --apply  # 写入 MCP 配置 + skill

支持的落点,自动探测:

智能体

MCP 配置

Skill

Qoder CN

~/.qoder-cn/settings.json、shared_client/mcp.json

~/.qoder-cn/skills

Qoder

~/.qoder/mcp.json

~/.qoder/skills

Claude Code

~/.claude.json

~/.claude/skills

Cursor

~/.cursor/mcp.json

~/.cursor/skills

Windsurf

~/.codeium/windsurf/mcp_config.json

~/.codeium/windsurf/skills

Cline

VS Code globalStorage

—

DeepSeek Harness

profile 的 cordis.patch.yml

~/.dsh/skills

写入前自动备份成 *.bak-zentao-autofix,--remove 卸载,--targets qoder-cn,claude 只装指定的。

装完重启智能体。任何 MCP 客户端也可以手动配:

{
  "mcpServers": {
    "zentao-autofix": {
      "command": "node",
      "args": ["/absolute/path/to/zentao-autofix/bin/zentao-autofix.mjs"]
    }
  }
}

用绝对路径而不是 npx,是为了断网和内网也能起来。

用法

装好后不用记工具名,直接说人话:

把禅道指派给我的缺陷修一下

智能体会加载 skill,按流程走。也可以自己驱动:

zentao_config   {action:"set", baseUrl:"https://iip.sgai.com.cn/zentao", account:"me", password:"..."}
zentao_login                                            # 验证登录
zentao_config   {action:"add_repo", product:"资产管理系统", repoPath:"D:/work/asset-system", branch:"master"}
zentao_products                                         # 看哪些产品还没配仓库
zentao_next      →  改代码  →  zentao_report  →  zentao_next  →  ...

没有密码也用得上:粘一个浏览器会话

有些禅道没开 REST API,或者你不想把密码交给工具。浏览器里已经登录过的话, F12 → Application → Cookies → 复制 zentaosid 的值,顶掉密码那一格:

zentao_config {action:"set", baseUrl:"https://…/zentao", sessionCookie:"<zentaosid 的值>"}
zentao_login

粘整行 zentaosid=xxx; lang=zh-cn 也行,Path、HttpOnly 这类属性会被丢掉。 会话过期了就把浏览器里新的值再粘一次。这个值只写本机 config.json,不回显(action:"show" 里打码)。

zentao_next 返回 action:"fix" 就干活,返回 action:"stop" 就停——它附带的 summary 就是最终报告。

回填的样子:

{
  "bugId": 10200,
  "outcome": "fixed",
  "rootCause": "前端初始化把 value 默认成 0",
  "fix": "改为空字符串,提交时加必填校验",
  "files": ["src/views/transfer/InternalTransfer.vue"],
  "verify": "npm run test -- transfer 通过;手工验证默认空白、提交报必填"
}

九个工具

工具

作用

zentao_config

禅道地址/账号、产品→仓库字典、修复策略

zentao_login

验证登录(双通道探测)

zentao_products

产品列表 + 哪些还没配仓库

zentao_bugs

「指派给我」的缺陷,逐条预判能否自动修

zentao_bug

单条完整信息 + 仓库快照 + 相关文件线索

zentao_next

核心循环:取下一条该修的,或叫停

zentao_report

回填结果,拿下一步指示

zentao_run

轮次进度/汇总/历史/停止

zentao_doctor

环境自检:配置、凭证、仓库、git

配置

~/.zentao-autofix/config.json(可用 ZENTAO_AUTOFIX_HOME 改位置):

{
  "zentao": {
    "baseUrl": "https://iip.sgai.com.cn/zentao",
    "account": "me",
    "password": "***",
    "sessionCookie": "",
    "insecure": false,
    "readonly": true
  },
  "repos": {
    "资产管理系统": {
      "path": "D:/work/asset-system",
      "branch": "master",
      "testCommand": "npm test"
    }
  },
  "policy": {
    "skipDataChanges": true,
    "maxBugsPerRun": 10,
    "allowedSeverity": [1, 2, 3, 4],
    "stopAfterConsecutiveFailures": 2,
    "writeBack": false
  }
}

环境变量可覆盖连接信息:ZENTAO_BASE_URL、ZENTAO_ACCOUNT、ZENTAO_PASSWORD、ZENTAO_SESSION_COOKIE、ZENTAO_INSECURE。

密码/会话只留在本机文件里,不发给任何模型。insecure: true 给内网自签证书用。

禅道接口

优先走官方 REST API v1:POST /api.php/v1/tokens 换 token,之后带 Token: 头。 服务器没有 API v1 时退回网页通道:/user-login.html 拿 zentaosid cookie,读 /my-work-bug.json。 已经有会话 cookie(粘的或缓存的)时直接验一下就用,跳过后面的登录。

注意老版本禅道的 .json 端点会套一层壳:{"status":"success","data":"<真正的 JSON 字符串>"}, 本工具会自己扒开(最多剥 4 层),列表和详情都按这个处理。

登录凭证缓存 6 小时,过期自动重新登录。

自测

node scripts/selftest.mjs

内置一个假禅道服务器(真 HTTP,真 MCP JSON-RPC),覆盖 API 通道和网页通道两条路径。 测试数据里有真实的坑:改数据的缺陷必须被跳过、没配仓库的产品必须被标出、只读模式必须拒绝写回。

14/14 通过

边界

  • 不做代码修改:改代码是智能体的事。插件只保证「取对了、判对了、记全了」。

  • 不猜仓库路径:产品到仓库的映射必须用户提供。

  • 不替你点「已解决」:默认只读。生产环境通常需要人工复核。

  • 不处理改数据的缺陷:这类交给 DBA 或写数据订正脚本的人。

许可

MIT

Available Tools

9 tools
zentao_bugA

看一条缺陷的完整信息 + 预判结论 + 对应仓库快照(分支/脏文件/最近提交)+ 关键词相关文件线索。这是真正动手改代码前的上下文包。

Inputs: id (required), maxFiles.

zentao_bugsA

读取禅道「指派给我」的缺陷,并逐条给出预判:能否自动修(fixable)、阻塞原因、以及改数据/改代码分类。改数据的缺陷在这里就会被标成跳过(需求④),不会进入修复队列。

Inputs: limit, status, onlyFixable, includeSteps.

zentao_configA

读取/修改本机禅道自动修复配置:禅道地址与账号、产品→代码仓库字典、修复策略。action=show 看当前配置(密码打码);action=set 改禅道连接或策略;action=add_repo 加一条「所属产品→仓库」映射;action=remove_repo 删一条;action=init 生成默认配置文件。

Inputs: action (required), notes, branch, policy, +9 more.

zentao_doctorA

环境自检:配置是否齐、凭证是否有效、各仓库路径是否可用、git 是否就绪。出问题先跑这个。

Inputs: no named parameters.

zentao_loginA

验证禅道登录是否可用(需求①:地址要能登录验证)。自动探测 REST API v1 token 与网页 Cookie 两条通道,成功后缓存凭证;force=true 强制重新登录。

Inputs: force.

zentao_nextA

【核心循环】取「下一条该修的缺陷」,或告诉智能体停下来。会自动:拉取缺陷 → 跳过改数据的(需求④)→ 跳过没配仓库/超策略的 → 挑一条按优先级排序 → 返回完整上下文包。当没有可修的、或达到本轮上限、或连续失败过多时,返回 action="stop" 并附汇总(需求⑤)。

Inputs: runId, dryRun, restart.

zentao_productsA

列出禅道产品,并对照产品→仓库字典,标出哪些产品还没有配仓库(需求③的所有权归使用者,这里只做缺口提示,不猜路径)。

Inputs: no named parameters.

zentao_reportA

回填一条缺陷的修复结果,并告诉智能体下一步(继续下一条 / 停止并汇总)。outcome=fixed 时建议填 rootCause/fix/files/verify;outcome=failed 时填 reason。若配置里 writeBack=true 且非只读,会同时把结论评论回禅道并要求确认是否标记解决。

Inputs: bugId (required), outcome (required), fix, files, +8 more.

zentao_runA

查看/结束修复轮次。action=status 看当前进度;action=summary 出汇总报告(需求⑤);action=stop 手动停止并汇总;action=list 列历史轮次;action=resume 把已停止的轮次重新打开。

Inputs: action (required), runId, reason.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools have clearly distinct roles: environment check (doctor), auth (login), config, product gap listing, and the core next→report loop. The only genuinely confusable pair is zentao_bugs (list with predictions) vs zentao_bug (single bug context pack), distinguished only by singular/plural. zentao_next also re-does some of zentao_bugs' filtering, and zentao_run overlaps slightly with zentao_report on 'summary/stop', but descriptions make the boundaries workable.

    Naming Consistency4/5

    All tools share a consistent zentao_ snake_case prefix with single-word nouns, which is predictable. The deviation is that names are pure nouns plus an action parameter (zentao_run, zentao_config) rather than verb_noun, and the singular/plural pair zentao_bug/zentao_bugs is a real readability hazard. Still coherent overall, just not a strict verb_noun convention.

    Tool Count5/5

    Nine tools is well within the ideal 3-15 range and each one maps to a distinct stage of the autofix lifecycle (auth, doctor, config, products, list, detail, next, report, run). Nothing feels redundant enough to cut, and nothing essential is obviously missing at this granularity.

    Completeness4/5

    The surface covers setup (config/login/doctor), discovery (products/bugs/bug), the fix loop (next/report), and session lifecycle (run with status/summary/stop/list/resume) — a full workflow arc. Gaps: there is no explicit tool to mark a bug resolved/closed in Zentao (report only hints at confirmation) and no batch/report-all operation, but agents can work around both within the stated loop.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage Zentao bugs, requirements, and test cases through natural language interactions. It supports querying, creating, and updating various Zentao data entities including products, projects, and executions.
      12
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Exposes Zentao REST API as MCP tools for listing/searching bugs, reading details with screenshots, and resolving bugs after explicit confirmation. Includes a setup wizard to configure Codex, Claude, Cursor and other clients.
      5
      -
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI clients to work with ZenTao via its REST API, automatically exchanging account credentials for a Token and supporting project listing, bug querying and history, resolving/closing/verifying bugs, structured comments, and attachment upload/download with verification. Read-only mode and configurable endpoints, upload size, and timeouts let it fit self-hosted deployments.
      14
      233 npm
      MIT