@zeyue0329/xiaoma-cli 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/.playwright-cli/console-2026-05-13T06-36-26-793Z.log +2 -0
  2. package/.playwright-cli/page-2026-05-13T06-36-27-725Z.yml +1 -0
  3. package/CLAUDE.md +25 -7
  4. package/XiaoMa-CLI-2026H2-/350/277/255/344/273/243/350/247/204/345/210/222.pptx +0 -0
  5. package/demo/xiaoma-bug-circle-resolve/SKILL.md +6 -0
  6. package/demo/xiaoma-bug-circle-resolve/workflow.md +254 -0
  7. package/demo/xiaoma-bug-resolve/SKILL.md +6 -0
  8. package/demo/xiaoma-bug-resolve/workflow.md +269 -0
  9. package/demo/xiaoma-prd-saas-zh/README.md +57 -0
  10. package/demo/xiaoma-prd-saas-zh/domain-research.md +128 -0
  11. package/demo/xiaoma-prd-saas-zh/epics.md +303 -0
  12. package/demo/xiaoma-prd-saas-zh/market-research-2026-q1.md +183 -0
  13. package/demo/xiaoma-prd-saas-zh/prd-bad-examples.md +268 -0
  14. package/demo/xiaoma-prd-saas-zh/prd.md +409 -0
  15. package/demo/xiaoma-prd-saas-zh/product-brief.md +97 -0
  16. package/demo/xiaoma-prd-saas-zh/validation-report.md +279 -0
  17. package/docs/roadshow/01-/351/241/271/347/233/256/346/246/202/350/247/210/344/270/216/346/236/266/346/236/204.md +189 -0
  18. package/docs/roadshow/02-/346/231/272/350/203/275/344/275/223/347/263/273/347/273/237/350/257/246/350/247/243.md +464 -0
  19. package/docs/roadshow/03-/346/231/272/350/203/275/344/275/223/344/272/244/344/272/222/346/265/201/347/250/213/345/233/276.md +334 -0
  20. package/docs/roadshow/04-/345/267/245/344/275/234/346/265/201/346/211/247/350/241/214/350/257/246/350/247/243.md +1038 -0
  21. package/docs/roadshow/05-/346/212/200/346/234/257/345/256/236/347/216/260/344/270/216/345/210/233/346/226/260/344/272/256/347/202/271.md +205 -0
  22. package/docs/roadshow/06-/350/267/257/346/274/224/346/200/273/347/273/223/344/270/216/346/274/224/347/244/272/345/273/272/350/256/256.md +167 -0
  23. package/media/doc1_fig1.png +0 -0
  24. package/media/doc1_fig2.png +0 -0
  25. package/media/doc1_fig3.png +0 -0
  26. package/media/doc1_fig4.png +0 -0
  27. package/media/doc2_fig1.png +0 -0
  28. package/media/doc2_fig2.png +0 -0
  29. package/media/doc2_fig3.png +0 -0
  30. package/media/doc2_fig4.png +0 -0
  31. package/media/doc3_fig1.png +0 -0
  32. package/media/doc3_fig2.png +0 -0
  33. package/media/doc3_fig3.png +0 -0
  34. package/media/doc3_fig4.png +0 -0
  35. package/media/doc4_fig1.png +0 -0
  36. package/media/doc4_fig2.png +0 -0
  37. package/media/doc4_fig3.png +0 -0
  38. package/media/doc5_fig1.png +0 -0
  39. package/media/doc5_fig2.png +0 -0
  40. package/media/doc5_fig3.png +0 -0
  41. package/package.json +1 -1
  42. package/patent-disclosure-optimized/SKILL.md +416 -0
  43. package/patent-disclosure-optimized/references/disclosure-template.md +84 -0
  44. package/patent-disclosure-optimized/references/docx-format-spec.md +183 -0
  45. package/patent-disclosure-optimized/references/mining-principles.md +168 -0
  46. package/patent-disclosure-optimized/scripts/md2docx.js +777 -0
  47. package/src/core/tasks/xiaoma-create-prd/data/prd-purpose.md +157 -0
  48. package/src/core/tasks/xiaoma-create-prd/data/upstream-input-contract.md +168 -0
  49. package/src/core/tasks/xiaoma-create-prd/templates/prd-skeleton-reference.md +428 -0
  50. package/src/core/tasks/xiaoma-create-prd/templates/prd-template.md +101 -3
  51. package/src/xmc/agents/sm.agent.yaml +9 -1
  52. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/data/prd-quality-rubric.csv +14 -0
  53. package/src/xmc/workflows/4-implementation/auto-story-pipeline/SKILL.md +1 -1
  54. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-01-init-and-validate.md +10 -13
  55. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-02-create-story.md +0 -1
  56. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-08-complete-story.md +3 -4
  57. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-09-finalize.md +69 -0
  58. package/src/xmc/workflows/4-implementation/auto-story-pipeline/workflow.md +9 -14
  59. package/src/xmc/workflows/4-implementation/auto-story-pipeline/xiaoma-skill-manifest.yaml +1 -1
  60. package/src/xmc/workflows/4-implementation/auto-story-pipeline-batch/SKILL.md +6 -0
  61. package/src/xmc/workflows/4-implementation/auto-story-pipeline-batch/workflow.md +333 -0
  62. package/src/xmc/workflows/4-implementation/auto-story-pipeline-batch/xiaoma-skill-manifest.yaml +3 -0
  63. package/src/xmc/workflows/5-full-pipeline/auto-full-pipeline/steps/step-01-init-and-validate.md +2 -2
  64. package/src/xmc/workflows/5-full-pipeline/auto-full-pipeline/steps/step-04-run-story-pipeline.md +30 -41
  65. package/src/xmc/workflows/5-full-pipeline/auto-full-pipeline/steps/step-05-finalize.md +2 -2
  66. package/src/xmc/workflows/5-full-pipeline/auto-full-pipeline/workflow.md +7 -9
  67. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/SKILL.md +6 -0
  68. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/checklist.md +43 -0
  69. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-01-init-and-validate.md +155 -0
  70. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-02-create-epics.md +156 -0
  71. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-03-bridge-sprint-planning.md +143 -0
  72. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-04-batch-create-stories.md +309 -0
  73. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-05-finalize.md +311 -0
  74. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/workflow.md +105 -0
  75. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/xiaoma-skill-manifest.yaml +3 -0
  76. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_1_/351/235/242/345/220/221AI/346/231/272/350/203/275/344/275/223/347/232/204/345/244/232/351/200/232/351/201/223/344/276/235/350/265/226_20260318.md +483 -0
  77. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_2_/345/237/272/344/272/216/351/205/215/347/275/256/351/251/261/345/212/250/347/232/204/350/267/250/345/271/263/345/217/260IDE/346/231/272/350/203/275_20260318.md +592 -0
  78. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_3_AI/346/231/272/350/203/275/344/275/223/345/243/260/346/230/216/345/274/217/345/256/232/344/271/211/347/232/204/347/274/226/350/257/221/346/265/201/346/260/264_20260318.md +624 -0
  79. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_4_/345/237/272/344/272/216/345/223/210/345/270/214/346/214/207/347/272/271/347/232/204/346/231/272/350/203/275/344/275/223/351/231/204/345/261/236/350/265/204/346/272/220/351/200/211_20260318.md +628 -0
  80. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_5_AI/346/231/272/350/203/275/344/275/223/350/247/246/345/217/221/346/214/207/344/273/244/347/232/204/345/244/215/345/220/210/346/240/274/345/274/217/346/240/241_20260318.md +652 -0
  81. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-09-cycle-check.md +0 -147
@@ -0,0 +1,2 @@
1
+ [ 1116ms] [LOG] %c %s color: yellow; background-color: black; [instance: default] appid: 20006317, userInfo:{"user_unique_id":"7639261564058707976","web_id":"7639261564058707976"} @ https://lf3-data.volccdn.com/obj/data-static/log-sdk/collect/5.0/collect-rangers-v5.2.11.js:0
2
+ [ 1116ms] [LOG] %c %s color: yellow; background-color: black; [instance: default] appid: 20006317, sdk is ready, version is 5.2.11_tob, you can report now !!! @ https://lf3-data.volccdn.com/obj/data-static/log-sdk/collect/5.0/collect-rangers-v5.2.11.js:0
@@ -0,0 +1 @@
1
+ - img [ref=e7] [cursor=pointer]
package/CLAUDE.md CHANGED
@@ -9,7 +9,7 @@ XiaoMa-CLI (`@zeyue0329/xiaoma-cli`) is an AI-driven agile development framework
9
9
  ## Common Commands
10
10
 
11
11
  ```bash
12
- # Quality gate (run before commits)
12
+ # Quality gate (run before commits — preferred over npm test)
13
13
  npm run quality
14
14
 
15
15
  # Individual checks
@@ -29,9 +29,15 @@ npm run test:coverage # c8 coverage report for schema tests
29
29
  # Run the CLI locally
30
30
  npm run install:xiaoma # Run install command
31
31
  npm run xiaoma:uninstall # Run uninstall command
32
+
33
+ # Run a single test file directly
34
+ node test/test-agent-schema.js
35
+ node test/test-file-refs-csv.js
36
+ node test/test-installation-components.js
32
37
  ```
33
38
 
34
- The full `npm test` runs: test:schemastest:refstest:install → validate:schemas → lintlint:mdformat:check.
39
+ `npm run quality` order: format:checklintlint:md → validate:schemas → test:schemastest:installvalidate:refs.
40
+ `npm test` order: test:schemas → test:refs → test:install → validate:schemas → lint → lint:md → format:check.
35
41
 
36
42
  ## Architecture
37
43
 
@@ -42,9 +48,10 @@ The full `npm test` runs: test:schemas → test:refs → test:install → valida
42
48
 
43
49
  ### Module System
44
50
 
45
- Modules are defined by `module.yaml` files with configuration variables, prompts, and directory declarations:
51
+ Modules are defined by `module.yaml` files with configuration variables, prompts, and directory declarations. Variables use `{variable_name}` interpolation syntax and can reference each other (e.g., `{output_folder}` in path defaults). Core module variables (`user_name`, `communication_language`, etc.) are inherited by other modules:
46
52
  - **`src/core/`** — Shared skills and tasks (module code: `core`)
47
53
  - **`src/xmc/`** — XiaoMa Method module, the primary agile framework (module code: `xmc`)
54
+ - **`src/utility/`** — Shared agent-components imported by other modules
48
55
 
49
56
  ### Agent System (`src/xmc/agents/`)
50
57
 
@@ -62,13 +69,23 @@ Organized by development phase:
62
69
  - `3-solutioning/` — Architecture, epics/stories, implementation readiness
63
70
  - `4-implementation/` — Sprint planning, story execution, code review, retros
64
71
 
72
+ Additional workflow categories:
73
+ - `5-full-pipeline/` — End-to-end automated pipelines from requirements to delivery
74
+ - `xiaoma-quick-flow/` — Lightweight flows for smaller projects (quick-dev, quick-spec)
75
+ - `xiaoma-document-project/`, `xiaoma-generate-project-context/`, `xiaoma-qa-generate-e2e-tests/` — Utility workflows
76
+
65
77
  Each workflow has: `workflow.md` (entry point with metadata), `steps/` or `steps-{variant}/` directories, and optional `templates/` and `data/` directories.
66
78
 
67
79
  ### CLI (`tools/cli/`)
68
80
 
69
- - **Entry**: `xiaoma-cli.js` (Commander.js) → wrapped by `xiaoma-npx-wrapper.js`
70
- - **Commands**: `install`, `status`, `uninstall`
71
- - **Installer** (`tools/cli/installers/`): Core orchestration class (~8K LOC), module manager, IDE config manager, manifest generator
81
+ - **Entry**: `xiaoma-cli.js` (Commander.js) → wrapped by `tools/xiaoma-npx-wrapper.js`
82
+ - **Commands**: `tools/cli/commands/` — `install.js`, `status.js`, `uninstall.js`
83
+ - **Shared lib**: `tools/cli/lib/` config loading, file ops, UI helpers, YAML/XML utilities, agent analysis
84
+ - **Installer** (`tools/cli/installers/lib/`): Layered architecture:
85
+ - `core/` — `installer.js` (main orchestrator), `manifest-generator.js`, `dependency-resolver.js`, `ide-config-manager.js`, `detector.js`
86
+ - `ide/` — IDE-specific adapters with `_base-ide.js` base class and `_config-driven.js` mixin; `manager.js` selects the right adapter
87
+ - `modules/` — `manager.js` and `external-manager.js` handle module discovery and external module loading
88
+ - `custom/` — `handler.js` for user-defined custom modules
72
89
  - **UI**: `@clack/prompts` for interactive terminal prompts
73
90
 
74
91
  ### Skills (`src/core/skills/`)
@@ -81,8 +98,9 @@ Reusable capabilities: `xiaoma-help`, `xiaoma-brainstorming`, `xiaoma-distillato
81
98
  - **YAML**: `.yaml` extension enforced by ESLint (not `.yml`); double quotes preferred
82
99
  - **Formatting**: Prettier with 140 char print width, 2-space indent, double quotes in YAML, single quotes in JS
83
100
  - **Linting**: ESLint flat config with unicorn, node, yml plugins; `--max-warnings=0`
84
- - **Schema validation**: Zod for agent YAML validation at `tools/schema/`
101
+ - **Schema validation**: Zod for agent YAML validation at `tools/schema/agent.js`
85
102
  - **Git hooks**: Husky + lint-staged (runs lint:fix and format:fix on staged files)
103
+ - **Agent triggers**: Must match compound format `"<SHORTCUT> or fuzzy match on <kebab-case>"` where shortcut is auto-derived from the kebab trigger
86
104
 
87
105
  ## Testing
88
106
 
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: xiaoma-bug-circle-resolve
3
+ description: '循环处理所有AI测试平台推送的新增状态Bug,每次处理前清空上下文避免噪声干扰,逐个调用xiaoma-bug-resolve技能修复,直到所有新增Bug处理完毕。Use when the user says "循环处理bug", "批量修复bug", "resolve all bugs", or "circle resolve bugs".'
4
+ ---
5
+
6
+ Follow the instructions in [workflow.md](workflow.md).
@@ -0,0 +1,254 @@
1
+ # Bug Circle Resolve Workflow
2
+
3
+ **Goal:** 全自动循环处理**指定项目**下所有AI测试平台推送的新增状态(defect_status=0)Bug,无需任何人工介入,直到队列清空。
4
+
5
+ **Your Role:** 你是Bug处理调度器。你的职责是:校验 jiraId 参数 → 查询当前项目的 Bug 队列 → 为每个Bug启动独立Agent子进程处理 → 确认处理结果 → 继续下一个 → 输出最终报告。全程无需用户参与。
6
+
7
+ **所有输出使用简体中文。**
8
+
9
+ ---
10
+
11
+ ## 参数说明
12
+
13
+ 本 skill 支持以下参数:
14
+
15
+ | 参数 | 是否必填 | 传参形式 | 说明 | 示例 |
16
+ |------|---------|---------|------|------|
17
+ | `jiraId` | **必填** | **位置参数(唯一 token)** | JIRA 项目 ID,多项目共库场景下的硬隔离边界。**所有 `t_defect_info` 的 SELECT/UPDATE/COUNT 都必须带 `AND jira_id = '{{jiraId}}'`**,子 Agent 也必须继承此参数。 | `GYLPJ-1153` |
18
+
19
+ ### args 解析规则(Claude 必须严格遵守)
20
+
21
+ 把 skill 传入的 `args` 按空格切分成 token 列表后:
22
+ 1. 取**第一个 token**:
23
+ - 若**不含 `=`**,视为 `jiraId` 的值(位置参数语法,**推荐形式**)。
24
+ - 若形如 `jiraId=xxx`,解析为 `jiraId`(兼容旧语法)。
25
+ - 若形如 `otherKey=xxx`(任何其它键值对),说明位置参数缺失,视为**未提供 jiraId**。
26
+ 2. 本 skill 只接受 `jiraId` 一个参数。若 args 中出现任何第二个 token(无论形式),视为非法输入,立刻中断并提示用户只需传一个 jiraId。
27
+ 3. 若最终 `jiraId` 仍为空或空字符串,**立刻拒绝执行**,禁止开始循环(否则会把其他项目的 Bug 一并拉下来误改代码、误改状态)。
28
+
29
+ ### 调用示例
30
+
31
+ ```
32
+ # 推荐:位置参数(最简洁)
33
+ /xiaoma-bug-circle-resolve GYLPJ-1153
34
+
35
+ # 兼容旧语法(仍可用)
36
+ /xiaoma-bug-circle-resolve jiraId=GYLPJ-1153
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 核心架构:Agent 隔离处理
42
+
43
+ **为什么不需要 `/clear`:** 每个Bug的分析和修复都委托给**独立的 Agent 子进程**。Agent 天然拥有隔离的上下文空间,处理完即释放,不会污染主对话。主对话只负责轻量的调度循环。
44
+
45
+ ```
46
+ 主对话(调度器,上下文极小)
47
+ ├── Agent #1 → 处理 Bug A(独立上下文,完成后释放)
48
+ ├── Agent #2 → 处理 Bug B(独立上下文,完成后释放)
49
+ ├── Agent #3 → 处理 Bug C(独立上下文,完成后释放)
50
+ └── ...直到队列清空
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 核心规则(严格遵守)
56
+
57
+ 1. **每个Bug由独立Agent处理** — 使用 Agent 工具启动 general-purpose 子进程,将Bug的完整信息和处理指令传给Agent,Agent独立完成分析、修复、验证、状态更新
58
+ 2. **主循环保持轻量** — 主对话只做:查询队列 → 启动Agent → 读取Agent结果 → 查询剩余 → 继续或结束
59
+ 3. **串行处理** — 一次处理一个Bug,等Agent完成后再处理下一个,避免并发修改冲突
60
+ 4. **全自动无人工介入** — 从开始到结束,用户无需执行任何命令
61
+
62
+ ---
63
+
64
+ ## 数据库信息
65
+
66
+ - **MySQL缺陷库**: `mcp__xiaoma-dev-mysql__mysql_query` — 查询/更新Bug状态
67
+ - **Oracle业务库**: `mcp__oracle_zqyl_pj_incentive_test4__execute_query` — 验证业务数据
68
+ - **缺陷表**: `t_defect_info`
69
+ - **待处理条件**: `defect_status = 0 AND is_del = 0 AND jira_id = '{{jiraId}}'`(**jira_id 强制过滤**)
70
+ - **状态枚举**: 0=新增, 1=已验证, 2=已修复, 3=非缺陷(测试误报)
71
+ - **项目隔离字段**: `jira_id`(varchar(64),JIRA 项目 ID),多项目共库时用于区分
72
+
73
+ ---
74
+
75
+ ## WORKFLOW
76
+
77
+ <workflow>
78
+
79
+ <step n="1" goal="校验 jiraId 并检查当前项目下待处理Bug队列">
80
+
81
+ <action>**前置校验**:按本文件顶部的「args 解析规则」从 args 中解析出 `jiraId`。若未解析到(args 为空),立刻中断并输出:
82
+ `批量循环处理必须将 jiraId 作为第一个参数传入,例如:/xiaoma-bug-circle-resolve GYLPJ-1153`
83
+ 禁止在没有 jiraId 的情况下继续执行任何 t_defect_info 查询或循环。
84
+ </action>
85
+
86
+ <action>查询当前项目(jiraId={{jiraId}})缺陷统计:
87
+ ```sql
88
+ SELECT
89
+ SUM(CASE WHEN defect_status = 0 THEN 1 ELSE 0 END) as pending,
90
+ SUM(CASE WHEN defect_status = 2 THEN 1 ELSE 0 END) as fixed,
91
+ SUM(CASE WHEN defect_status = 3 THEN 1 ELSE 0 END) as false_positive,
92
+ COUNT(*) as total
93
+ FROM t_defect_info WHERE is_del = 0 AND jira_id = '{{jiraId}}';
94
+ ```
95
+ </action>
96
+
97
+ <check if="pending == 0">
98
+ <action>当前项目无待处理缺陷,直接进入 Step 3 输出最终报告</action>
99
+ </check>
100
+
101
+ <check if="pending > 0">
102
+ <action>查询当前项目下待处理缺陷列表:
103
+ ```sql
104
+ SELECT defect_id, title, severity, module_path
105
+ FROM t_defect_info
106
+ WHERE is_del = 0 AND defect_status = 0 AND jira_id = '{{jiraId}}'
107
+ ORDER BY create_time ASC;
108
+ ```
109
+ </action>
110
+
111
+ <action>向用户展示概况(必须包含"当前项目 jiraId:{{jiraId}}"一行)并告知即将开始全自动处理</action>
112
+ <action>进入 Step 2 开始循环</action>
113
+ </check>
114
+
115
+ </step>
116
+
117
+ <step n="2" goal="循环处理每个Bug(全自动)">
118
+
119
+ <!-- 循环开始:查询当前项目下最早的待处理Bug完整信息 -->
120
+ <action>查询当前项目(jiraId={{jiraId}})下最早的一条待处理Bug的完整详情:
121
+ ```sql
122
+ SELECT * FROM t_defect_info
123
+ WHERE is_del = 0 AND defect_status = 0 AND jira_id = '{{jiraId}}'
124
+ ORDER BY create_time ASC LIMIT 1;
125
+ ```
126
+ </action>
127
+
128
+ <check if="无结果">
129
+ <action>队列已空,进入 Step 3</action>
130
+ </check>
131
+
132
+ <!-- 输出当前处理进度 -->
133
+ <action>输出:正在处理 {{defect_id}} — {{title}}</action>
134
+
135
+ <!-- 启动独立 Agent 处理这个Bug -->
136
+ <critical>
137
+ 使用 Agent 工具启动一个 general-purpose 子进程来处理这个Bug。
138
+ Agent 的 prompt 必须包含以下完整信息,使其能独立工作:
139
+
140
+ 1. **Bug完整信息 + 项目上下文**:将查询到的 defect_id, title, steps, module_path, url, error_front, error_apis, defect_type, severity **以及当前处理的 jiraId={{jiraId}}** 全部传给Agent。Agent 必须把 jiraId 视为硬约束,所有 SQL 都要带 `AND jira_id = '{{jiraId}}'`。
141
+ 2. **处理指令**:按以下步骤执行——
142
+ a. 根据 module_path 和 url 定位代码(前端在 zqyl-manager/src/main/views/pjs/incentive/,后端在 zqyl-pj-incentive/src/main/)
143
+ b. 使用 Explore Agent 探索相关前端页面组件、后端Controller/Service/Mapper代码
144
+ c. 使用 Oracle MCP Server (mcp__oracle_zqyl_pj_incentive_test4__execute_query) 验证数据库数据
145
+ d. 分析根因,判定:真实缺陷 or 测试误报
146
+ e. 如为真实缺陷:使用 Edit 工具修复代码,修复范围限定在缺陷涉及的代码
147
+ f. 验证修复逻辑正确性
148
+ g. 使用 MySQL MCP Server (mcp__xiaoma-dev-mysql__mysql_query) 更新Bug状态(**UPDATE 必须带 jira_id 过滤**):
149
+ - 真实缺陷已修复:
150
+ `UPDATE t_defect_info SET defect_status = 2 WHERE defect_id = '{{defect_id}}' AND jira_id = '{{jiraId}}' AND is_del = 0;`
151
+ - 测试误报:
152
+ `UPDATE t_defect_info SET defect_status = 3 WHERE defect_id = '{{defect_id}}' AND jira_id = '{{jiraId}}' AND is_del = 0;`
153
+ h. 返回处理结果摘要:defect_id、jiraId、判定结果、修改的文件列表、验证结果
154
+ 3. **项目规范**:遵循 CLAUDE.md 编码规范,禁止Lombok、禁止MyBatis-Plus、返回ResultData等
155
+ 4. **常见缺陷模式参考**:
156
+ - 模糊查询不符合预期 → SQL用 = 而非 LIKE,改为 LIKE '%' || #{param} || '%'
157
+ - 字段未显示/缺少列 → 前端 header 配置缺少字段
158
+ - 字段值展示错误 → prop映射错误或SQL字段别名错误
159
+ - 查询不出数据 → SQL条件逻辑错误、MQ消费时字段未映射
160
+ - 表头名称错误 → header label 配置错误
161
+ - 点击按钮报错 → 接口调用参数或后端异常
162
+ 5. **代码结构映射**:
163
+ - 签发业务归属表 → 前端 issueAttribution/,后端 IssueAttributionController, IssueAttributionMapper.xml
164
+ - 背书业务归属表 → 前端 endorseAttribution/,后端 EndorseAttributionController
165
+ - 融资台账 → 前端 financeLedger/,后端 FinanceLedgerController
166
+ </critical>
167
+
168
+ <!-- Agent 完成后 -->
169
+ <action>读取 Agent 返回的处理结果摘要</action>
170
+ <action>输出该Bug的处理结果(简要一行)</action>
171
+
172
+ <!-- 检查是否还有剩余 -->
173
+ <action>查询当前项目下剩余待处理数量:
174
+ ```sql
175
+ SELECT COUNT(*) as remaining FROM t_defect_info
176
+ WHERE is_del = 0 AND defect_status = 0 AND jira_id = '{{jiraId}}';
177
+ ```
178
+ </action>
179
+
180
+ <check if="remaining > 0">
181
+ <action>继续循环 — 回到 Step 2 顶部处理下一个Bug</action>
182
+ </check>
183
+
184
+ <check if="remaining == 0">
185
+ <action>队列已空,进入 Step 3</action>
186
+ </check>
187
+
188
+ </step>
189
+
190
+ <step n="3" goal="输出最终处理报告">
191
+
192
+ <action>查询当前项目(jiraId={{jiraId}})下所有缺陷的最终状态:
193
+ ```sql
194
+ SELECT defect_id, title,
195
+ CASE defect_status
196
+ WHEN 0 THEN '待处理'
197
+ WHEN 2 THEN '已修复'
198
+ WHEN 3 THEN '非缺陷(测试误报)'
199
+ ELSE '其他'
200
+ END as status_text,
201
+ update_time
202
+ FROM t_defect_info
203
+ WHERE is_del = 0 AND jira_id = '{{jiraId}}'
204
+ ORDER BY defect_status ASC, update_time DESC;
205
+ ```
206
+ </action>
207
+
208
+ <action>查询当前项目统计汇总:
209
+ ```sql
210
+ SELECT
211
+ SUM(CASE WHEN defect_status = 0 THEN 1 ELSE 0 END) as pending,
212
+ SUM(CASE WHEN defect_status = 2 THEN 1 ELSE 0 END) as fixed,
213
+ SUM(CASE WHEN defect_status = 3 THEN 1 ELSE 0 END) as false_positive
214
+ FROM t_defect_info WHERE is_del = 0 AND jira_id = '{{jiraId}}';
215
+ ```
216
+ </action>
217
+
218
+ <action>输出最终报告:
219
+
220
+ ```
221
+ ========================================
222
+ 全部Bug处理完毕
223
+ ========================================
224
+
225
+ 项目ID(jiraId):{{jiraId}}
226
+
227
+ 已修复: {{fixed}} 条
228
+ 测试误报: {{false_positive}} 条
229
+ 剩余待处理: {{pending}} 条
230
+
231
+ 处理明细:
232
+ | 缺陷ID | 标题 | 处理结果 | 更新时间 |
233
+ |--------|------|---------|---------|
234
+ | ... | ... | ... | ... |
235
+
236
+ 当前项目({{jiraId}})下新增状态的测试Bug已处理完毕,全程无需人工介入。
237
+ ```
238
+
239
+ </action>
240
+
241
+ </step>
242
+
243
+ </workflow>
244
+
245
+ ---
246
+
247
+ ## 注意事项
248
+
249
+ 1. **jiraId 是硬隔离边界** — 批量循环处理必须指定 jiraId,**所有 `t_defect_info` 的 SELECT/UPDATE/COUNT 都必须带 `AND jira_id = '{{jiraId}}'`**,子 Agent 的 prompt 和 UPDATE 语句也必须继承该值,否则会跨项目误改代码和状态
250
+ 2. **Agent 隔离是关键** — 每个Bug在独立Agent子进程中处理,自带隔离上下文,无需 `/clear`,不会相互干扰
251
+ 3. **全自动** — 用户只需调用一次 `/xiaoma-bug-circle-resolve GYLPJ-1153`(首个位置参数即 jiraId),之后全程自动直到当前项目队列清空
252
+ 4. **串行安全** — 一次只处理一个Bug,避免并发修改同一文件产生冲突
253
+ 5. **容错** — Agent处理失败时Bug状态仍为0,下次循环自动重试
254
+ 6. **Agent prompt 质量** — 传给Agent的prompt必须包含Bug完整信息 + jiraId + 项目上下文 + 处理指令,使其能完全独立工作
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: xiaoma-bug-resolve
3
+ description: 'Resolve AI test platform bugs: query MySQL for defects, analyze root cause, fix code, verify with Playwright, update bug status. Use when the user says "resolve bug", "fix test bug", or "处理测试bug".'
4
+ ---
5
+
6
+ Follow the instructions in [workflow.md](workflow.md).
@@ -0,0 +1,269 @@
1
+ # Bug Resolve Workflow
2
+
3
+ **Goal:** 从 AI 测试平台推送的缺陷中,按时间正序取出第一条待处理 Bug,分析是否为真实缺陷,修复并验证,最后更新缺陷状态。
4
+
5
+ **Your Role:** 你是一名全栈开发工程师,负责分析、修复和验证 AI 测试平台推送的缺陷。你需要精确定位问题根因,编写高质量修复代码,并通过测试验证修复效果。
6
+
7
+ **所有输出使用简体中文。**
8
+
9
+ ---
10
+
11
+ ## 参数说明
12
+
13
+ 本 skill 支持以下可选参数(通过调用时传入或交互式获取):
14
+
15
+ | 参数 | 说明 | 示例 |
16
+ |------|------|------|
17
+ | `testUrl` | Playwright 测试用的前端页面基础地址 | `http://localhost:8080/zqyl_manager` |
18
+ | `authToken` | 登录认证 token(Bearer token) | `eyJhbGciOiJI...` |
19
+ | `defectId` | 指定处理的缺陷ID(不传则自动取时间最早的待处理缺陷) | `DEF0158` |
20
+
21
+ 如果用户未提供 `testUrl` 和 `authToken`,在需要 Playwright 测试时主动向用户索要。
22
+
23
+ ---
24
+
25
+ ## 数据库信息
26
+
27
+ ### MySQL 缺陷库(xiaoma-dev-mysql)
28
+
29
+ **缺陷表:`t_defect_info`**
30
+
31
+ | 字段 | 类型 | 说明 |
32
+ |------|------|------|
33
+ | id | bigint | 主键 |
34
+ | defect_id | varchar(64) | 缺陷唯一标识 |
35
+ | run_id | varchar(64) | 关联运行ID |
36
+ | jira_id | varchar(64) | JIRA项目ID |
37
+ | title | varchar(512) | 缺陷描述 |
38
+ | module_path | varchar(256) | 所属模块 |
39
+ | severity | tinyint | 严重等级:1紧急, 2高, 3中, 4低 |
40
+ | defect_type | varchar(32) | 缺陷类型:前端, 后端 |
41
+ | steps | text | 重现步骤 |
42
+ | case_no | varchar(64) | 关联用例编号 |
43
+ | case_name | varchar(256) | 关联用例名称 |
44
+ | error_front | text | 前端错误日志 |
45
+ | url | varchar(1024) | 页面URL |
46
+ | error_apis | text | 接口报错信息 |
47
+ | discover_time | datetime | 缺陷发现时间 |
48
+ | defect_status | tinyint | **状态:0新增, 1已验证, 2已修复, 3非缺陷(测试误报)** |
49
+ | is_del | tinyint | 删除标记:0未删除, 1已删除 |
50
+
51
+ ---
52
+
53
+ ## WORKFLOW
54
+
55
+ <workflow>
56
+
57
+ <step n="1" goal="查询待处理缺陷并获取第一条Bug详情">
58
+
59
+ <action>使用 `mcp__xiaoma-dev-mysql__mysql_query` 工具查询所有待处理缺陷概要:
60
+ ```sql
61
+ SELECT id, defect_id, title, defect_status, severity, defect_type, module_path, discover_time, create_time
62
+ FROM t_defect_info
63
+ WHERE is_del = 0 AND defect_status = 0
64
+ ORDER BY create_time ASC;
65
+ ```
66
+ </action>
67
+
68
+ <check if="有指定 defectId 参数">
69
+ <action>按指定 defectId 查询缺陷详情</action>
70
+ </check>
71
+ <check if="未指定 defectId">
72
+ <action>取查询结果中时间最早(第一条)的缺陷</action>
73
+ </check>
74
+
75
+ <action>查询该缺陷的完整详情:
76
+ ```sql
77
+ SELECT * FROM t_defect_info WHERE defect_id = '{{target_defect_id}}' AND is_del = 0;
78
+ ```
79
+ </action>
80
+
81
+ <action>输出缺陷摘要信息:
82
+ - 缺陷ID、标题、严重度、类型
83
+ - 模块路径、页面URL
84
+ - 重现步骤(steps字段完整展示)
85
+ - 前端错误日志(error_front,如有)
86
+ - 接口报错信息(error_apis,如有)
87
+ </action>
88
+
89
+ <check if="没有待处理缺陷">
90
+ <action>告知用户当前没有待处理的缺陷,流程结束</action>
91
+ </check>
92
+
93
+ </step>
94
+
95
+ <step n="2" goal="分析缺陷根因">
96
+
97
+ <action>根据缺陷信息确定需要探索的代码区域:
98
+ - 根据 `module_path` 确定业务模块
99
+ - 根据 `url` 确定前端页面路径
100
+ - 根据 `defect_type` 确定前端/后端
101
+ - 根据 `error_apis` 确定相关API接口
102
+ </action>
103
+
104
+ <action>使用 Explore Agent 并行探索相关代码:
105
+ 1. **前端代码**:找到页面组件、搜索表单配置、API调用方式
106
+ 2. **后端代码**:找到 Controller → Application Service → Mapper,定位SQL/业务逻辑
107
+ 3. **数据库**:通过 Oracle MCP Server 验证数据和SQL逻辑
108
+ </action>
109
+
110
+ <action>综合分析后得出结论,分为三种情况:
111
+ - **真实缺陷**:代码确实存在问题,需要修复
112
+ - **测试误报(非缺陷)**:代码逻辑正确,测试用例本身有误或测试数据问题
113
+ - **需要更多信息**:无法确定,需要向用户确认
114
+ </action>
115
+
116
+ <action>向用户展示分析结论,包括:
117
+ - 根因说明(哪个文件、哪一行、什么问题)
118
+ - 判定结果(真实缺陷 / 测试误报)
119
+ - 如为真实缺陷,展示修复方案
120
+ </action>
121
+
122
+ </step>
123
+
124
+ <step n="3" goal="修复缺陷(仅真实缺陷执行此步骤)">
125
+
126
+ <check if="判定为测试误报">
127
+ <action>跳过此步骤,直接进入 Step 5 更新状态</action>
128
+ </check>
129
+
130
+ <action>按照分析结果执行代码修复:
131
+ - 使用 Edit 工具修改相关文件
132
+ - 修复范围严格限定在缺陷涉及的代码,不做额外重构
133
+ - 遵循项目 CLAUDE.md 中的编码规范
134
+ </action>
135
+
136
+ <action>列出所有修改的文件和修改内容摘要</action>
137
+
138
+ </step>
139
+
140
+ <step n="4" goal="验证修复结果">
141
+
142
+ <action>根据缺陷类型选择验证方式:</action>
143
+
144
+ <!-- 数据库层验证(优先执行) -->
145
+ <action>如涉及SQL/查询逻辑变更:
146
+ - 通过 Oracle MCP Server 直接执行修复后的SQL逻辑
147
+ - 验证查询结果是否符合预期
148
+ - 记录验证结果
149
+ </action>
150
+
151
+ <!-- Playwright 页面验证(如需) -->
152
+ <check if="缺陷涉及页面交互且用户提供了 testUrl">
153
+ <action>使用 Playwright 工具进行端到端验证:
154
+ 1. 导航到目标页面(使用 testUrl)
155
+ 2. 如需登录,使用 authToken 注入认证信息
156
+ 3. 按照缺陷的重现步骤操作
157
+ 4. 验证结果是否符合预期
158
+ </action>
159
+ </check>
160
+
161
+ <check if="缺陷涉及页面交互但未提供 testUrl 或 authToken">
162
+ <action>向用户索要 Playwright 测试所需信息:
163
+ - 测试环境前端地址(testUrl)
164
+ - 登录认证 token(authToken)
165
+ 提示用户:请提供测试地址和登录token,格式如:
166
+ `testUrl=http://localhost:8080/zqyl_manager authToken=eyJhbGci...`
167
+ </action>
168
+ </check>
169
+
170
+ <check if="本地无法构建/部署后端">
171
+ <action>说明已通过数据库SQL直接验证修复逻辑正确性,
172
+ 端到端验证需等后端部署到测试环境后执行</action>
173
+ </check>
174
+
175
+ <action>输出验证结果摘要</action>
176
+
177
+ </step>
178
+
179
+ <step n="5" goal="更新缺陷状态">
180
+
181
+ <check if="真实缺陷且已修复验证通过">
182
+ <action>更新缺陷状态为已修复(defect_status = 2):
183
+ ```sql
184
+ UPDATE t_defect_info SET defect_status = 2 WHERE defect_id = '{{target_defect_id}}' AND is_del = 0;
185
+ ```
186
+ </action>
187
+ </check>
188
+
189
+ <check if="判定为测试误报">
190
+ <action>更新缺陷状态为非缺陷(defect_status = 3):
191
+ ```sql
192
+ UPDATE t_defect_info SET defect_status = 3 WHERE defect_id = '{{target_defect_id}}' AND is_del = 0;
193
+ ```
194
+ </action>
195
+ </check>
196
+
197
+ <action>验证状态更新成功:
198
+ ```sql
199
+ SELECT defect_id, title, defect_status FROM t_defect_info WHERE defect_id = '{{target_defect_id}}';
200
+ ```
201
+ </action>
202
+
203
+ <action>输出最终处理结果:
204
+
205
+ **处理完成**
206
+
207
+ | 项目 | 内容 |
208
+ |------|------|
209
+ | 缺陷ID | {{defect_id}} |
210
+ | 缺陷标题 | {{title}} |
211
+ | 判定结果 | 真实缺陷 / 测试误报 |
212
+ | 处理方式 | 已修复代码 / 标记为非缺陷 |
213
+ | 状态更新 | defect_status → 2(已修复) / 3(非缺陷) |
214
+ | 修改文件 | {{modified_files_list}} |
215
+ | 验证结果 | 通过 / 待部署后验证 |
216
+
217
+ </action>
218
+
219
+ <!-- 检查是否还有更多待处理缺陷 -->
220
+ <action>查询剩余待处理缺陷数量:
221
+ ```sql
222
+ SELECT COUNT(*) as remaining FROM t_defect_info WHERE is_del = 0 AND defect_status = 0;
223
+ ```
224
+ 告知用户剩余待处理缺陷数量,询问是否继续处理下一条。
225
+ </action>
226
+
227
+ </step>
228
+
229
+ </workflow>
230
+
231
+ ---
232
+
233
+ ## 项目特定信息
234
+
235
+ ### 代码结构映射
236
+
237
+ 根据缺陷的 `module_path` 和 `url` 定位代码位置:
238
+
239
+ | 模块关键字 | 前端页面路径 | 后端Controller | Mapper XML |
240
+ |-----------|-------------|---------------|------------|
241
+ | 签发业务归属表 | `views/pjs/incentive/issueAttribution/` | `IssueAttributionController` | `IssueAttributionMapper.xml` |
242
+ | 背书业务归属表 | `views/pjs/incentive/endorseAttribution/` | `EndorseAttributionController` | `EndorseAttributionMapper.xml` |
243
+ | 融资台账 | `views/pjs/incentive/financeLedger/` | `FinanceLedgerController` | `FinanceLedgerMapper.xml` |
244
+ | 费用方案 | `views/pjs/incentive/feePlan/` | `FeePlanController` | `FeePlanMapper.xml` |
245
+
246
+ ### 常见缺陷模式
247
+
248
+ | 缺陷描述关键字 | 可能根因 | 修复方向 |
249
+ |--------------|---------|---------|
250
+ | 模糊查询不符合预期 | SQL使用 `=` 而非 `LIKE` | 改为 `LIKE '%' \|\| #{param} \|\| '%'` |
251
+ | 字段未显示/缺少列 | 前端表头配置缺少字段 | 在 ylTableData.header 中添加列定义 |
252
+ | 字段值展示错误 | 前端取值prop映射错误或后端SQL字段别名错误 | 修正prop或SQL alias |
253
+ | 查询不出数据 | 查询条件逻辑错误(AND/OR)、字段映射错误 | 修正SQL条件逻辑 |
254
+ | 表头名称错误 | 前端 header label 配置错误 | 修改 header 中对应列的 label |
255
+ | 点击按钮报错 | 接口调用参数错误或后端接口异常 | 检查前端调用和后端接口 |
256
+
257
+ ### 数据库连接
258
+
259
+ - **MySQL(缺陷库)**:使用 `mcp__xiaoma-dev-mysql__mysql_query` 工具
260
+ - **Oracle(业务库)**:使用 `mcp__oracle_zqyl_pj_incentive_test4__execute_query` 工具
261
+
262
+ ### 状态码枚举
263
+
264
+ | defect_status | 含义 | 场景 |
265
+ |--------------|------|------|
266
+ | 0 | 新增 | AI测试平台推送的初始状态 |
267
+ | 1 | 已验证 | 人工确认为真实缺陷 |
268
+ | 2 | 已修复 | 代码已修复并验证通过 |
269
+ | 3 | 非缺陷 | 测试误报,非真实缺陷 |