@zeyue0329/xiaoma-cli 1.8.0 → 1.8.1

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 (32) hide show
  1. package/.idea/XiaoMa-Cli.iml +9 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  3. package/.idea/misc.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/prettier.xml +6 -0
  6. package/.idea/vcs.xml +6 -0
  7. package/CLAUDE.md +93 -0
  8. package/TECH-STACK.md +62 -0
  9. package/package.json +1 -1
  10. package/pipeline-optimization-report.md +400 -347
  11. package/run-5-analysis-report.md +436 -0
  12. package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/steps/step-05-validate-prd.md +54 -1
  13. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-01-init-and-validate.md +6 -1
  14. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-02-create-story.md +13 -2
  15. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-03-validate-story.md +3 -1
  16. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-04-develop-story.md +14 -7
  17. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-05-code-review.md +2 -2
  18. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-06-test-story.md +111 -2
  19. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-07-fix-and-retest.md +109 -0
  20. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-08-complete-story.md +2 -2
  21. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-09-cycle-check.md +3 -0
  22. package/src/xmc/workflows/4-implementation/auto-story-pipeline/workflow.md +3 -1
  23. package/tools/cli/installers/lib/ide/templates/combined/gemini-task.toml +2 -2
  24. package/tools/cli/installers/lib/ide/templates/combined/gemini-tool.toml +2 -2
  25. package/tools/cli/installers/lib/ide/templates/combined/gemini-workflow-yaml.toml +1 -1
  26. package/tools/cli/installers/lib/ide/templates/combined/gemini-workflow.toml +1 -1
  27. package/tools/cli/lib/cli-utils.js +7 -7
  28. 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/345/210/266/345/223/201/347/232/204/345/244/232/351/200/232/351/201/223/344/276/235/350/265/226_20260318.docx +0 -0
  29. 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.docx +0 -0
  30. 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.docx +0 -0
  31. 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.docx +0 -0
  32. 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.docx +0 -0
@@ -103,12 +103,13 @@ Create a test results summary:
103
103
 
104
104
  **IF all ACs pass AND no HIGH severity issues:**
105
105
  - Output: "QA testing PASSED. All {ac_count} acceptance criteria verified with real data. Proceeding to completion."
106
- - **NEXT:** Proceed to step-08 (complete story)
106
+ - **NEXT:** Proceed to step-08 (complete story) [frontmatter: nextStepFile]
107
107
 
108
108
  **IF any AC fails OR HIGH severity issues found:**
109
109
  - Output: "QA testing FAILED. {ac_fail_count} acceptance criteria not met. Issues: {issue_list}"
110
110
  - Record test failures in story file under QA Results section
111
- - **NEXT:** Proceed to step-07 (fix and retest)
111
+ - Set `{fix_source}` = "qa-testing" (this variable will be used in step-07 to route fixes directly to step-08 after correction, since QA issues often don't require code review re-entry)
112
+ - **NEXT:** Proceed to step-07 (fix and retest) [frontmatter: nextStepFile_fail]
112
113
 
113
114
  ### 7. Pipeline Status Update
114
115
 
@@ -142,3 +143,111 @@ Create a test results summary:
142
143
  - Skipping acceptance criteria during testing
143
144
  - Not verifying database state after write operations
144
145
  - Marking tests as PASS without evidence
146
+
147
+ ---
148
+
149
+ ## 测试失败处理流程 (Test Failure Handling)
150
+
151
+ **当任何acceptance criteria失败时:**
152
+
153
+ ### 1. 失败分类 (Categorize Failures)
154
+
155
+ 对每个失败进行分类:
156
+
157
+ - **Type A - AC Failure (接受标准失败)**: 核心功能没有达到预期
158
+ - 示例: 应该返回值X,实际返回值Y
159
+ - 路由: → step-07 (fix-and-retest)
160
+
161
+ - **Type B - Data Integrity Issue (数据完整性问题)**: 数据库状态不正确
162
+ - 示例: 记录未保存或数据损坏
163
+ - 路由: → step-07 (fix-and-retest) 并标记为HIGH优先级
164
+
165
+ - **Type C - Performance Issue (性能问题)**: 功能正常但超过性能阈值
166
+ - 示例: API响应时间 > 2秒
167
+ - 路由: → step-07 (fix-and-retest) 但标记为MEDIUM优先级
168
+
169
+ - **Type D - Environment/Test Setup Issue (环境问题)**: 测试环境配置问题
170
+ - 示例: 数据库连接失败、假数据缺失
171
+ - 路由: → 修复测试环境,然后重新运行tests
172
+
173
+ ### 2. 重试策略 (Retry Strategy)
174
+
175
+ **对于Type A和B失败:**
176
+ - 在step-07中作为HIGH优先级修复
177
+ - 每个Type A/B失败最多重试1次在step-06(re-run tests)
178
+
179
+ **对于Type C失败(仅性能):**
180
+ - 如果只有Type C失败,可以有条件地PASS
181
+ - 但必须在story文件中记录性能问题
182
+ - 标记为"KNOWN_PERFORMANCE_ISSUE"
183
+ - 移至backlog作为future optimization
184
+ - 仅在Type A/B都PASS时允许带Type C继续
185
+
186
+ **对于Type D失败:**
187
+ - 不计入fix iteration(fix-and-retest)
188
+ - 修复测试环境
189
+ - 立即重新运行测试
190
+
191
+ ### 3. 测试覆盖率阈值 (Coverage Thresholds)
192
+
193
+ **强制要求:**
194
+ - 单元测试覆盖率: >= 75%
195
+ - 集成测试覆盖率: >= 60%
196
+ - 接受标准覆盖率: 100% (所有AC必须有至少1个测试)
197
+
198
+ **如果未达到:**
199
+ - 不允许进入step-07
200
+ - 回到开发阶段添加缺失的tests
201
+ - Type: AC-Incomplete failure → 标记story为"NEEDS_MORE_TESTS"
202
+
203
+ ### 4. 记录失败详情 (Document Failures)
204
+
205
+ 在Story文件的"QA Results"部分记录:
206
+
207
+ ```markdown
208
+ ## QA Results
209
+
210
+ **Overall Status:** FAILED - 2/5 ACs passed
211
+
212
+ ### Failed Tests
213
+ - **AC#2 (Type A):** [Description]
214
+ - Expected: [X]
215
+ - Actual: [Y]
216
+ - Root Cause: [Analysis]
217
+ - Fix Priority: HIGH
218
+
219
+ - **AC#4 (Type C):** [Performance]
220
+ - Threshold: 1s
221
+ - Actual: 2.3s
222
+ - Fix Priority: MEDIUM (Known issue, defer if needed)
223
+
224
+ ### Coverage Summary
225
+ - Unit: 72% (Below 75% threshold)
226
+ - Integration: 65%
227
+ - AC Coverage: 100%
228
+
229
+ ### Recommended Next Step
230
+ - Re-run step-07 to fix AC#2 (HIGH)
231
+ - Consider Type C as known limitation unless time allows
232
+ ```
233
+
234
+ ### 5. 条件通过规则 (Conditional Pass)
235
+
236
+ 故事可以在以下条件下**有条件通过**到step-07:
237
+
238
+ ✅ **全部Type A/B失败已解决**
239
+ ✅ **至少80%的接受标准通过**
240
+ ✅ **无Critical数据完整性问题**
241
+ ❌ **Type C (性能)失败不阻止进度** (但需要记录)
242
+ ❌ **测试覆盖率 < 60% 则必须返回修复**
243
+
244
+ ### 6. 向step-07传递信息 (Hand-off to step-07)
245
+
246
+ 设置以下变量供step-07使用:
247
+
248
+ ```
249
+ {fix_source} = "qa-testing"
250
+ {failure_categories} = [Type A count, Type B count, Type C count]
251
+ {high_priority_issues} = [list]
252
+ {performance_known_issues} = [list] // For conditional pass scenarios
253
+ ```
@@ -126,3 +126,112 @@ After all fixes are applied:
126
126
  - Introducing new regressions while fixing existing issues
127
127
  - Exceeding `{max_fix_iterations}` fix iterations without resolution
128
128
  - Not running regression tests after each fix
129
+
130
+ ---
131
+
132
+ ## 当超过最大修复迭代次数 (Escalation Path: Beyond Max Fix Iterations)
133
+
134
+ **触发条件:** `{fix_iteration}` > `{max_fix_iterations}` (默认 > 5)
135
+
136
+ **Escalation Protocol:**
137
+
138
+ ### 1. 生成Escalation Report
139
+
140
+ 文档所有修复尝试和失败原因:
141
+
142
+ ```
143
+ ESCALATION REPORT: Story {current_story_key}
144
+ ==========================================
145
+ Status: FIX LIMIT EXCEEDED
146
+ Fix Iterations Attempted: {max_fix_iterations}
147
+ Unresolved Issues:
148
+ - [Issue 1]: [Root Cause Analysis]
149
+ - [Issue 2]: [Root Cause Analysis]
150
+
151
+ Pattern Analysis:
152
+ - Recurring issue? [Yes/No] — [Description]
153
+ - Root cause identified? [Yes/No]
154
+ - Architectural blocker? [Yes/No]
155
+
156
+ Timeline Impact: [number] days
157
+ Recommended Action: [A/B/C below]
158
+ ```
159
+
160
+ ### 2. 通知团队 (Owner Notification)
161
+
162
+ 发送通知至:
163
+ - **Primary:** Story Owner / Scrum Master (Mary)
164
+ - **Secondary:** Tech Lead / Architect (Winston)
165
+
166
+ **Notification Template:**
167
+
168
+ ```
169
+ URGENT: Story {current_story_key} - Fix Limit Reached
170
+
171
+ Summary: After {max_fix_iterations} fix iterations, the following issues remain unresolved:
172
+ - [Issue list]
173
+
174
+ Root Cause Analysis:
175
+ - [Analysis summary]
176
+
177
+ Recommended Actions:
178
+ A) Mark as "Blocked" - Investigate architectural changes needed
179
+ B) Reduce scope - Defer failing AC to next iteration
180
+ C) Re-assign to Tech Lead for deep investigation
181
+ D) Revert changes and restart implementation from scratch
182
+
183
+ Timeline: Requires decision within [4 hours / 1 day]
184
+ Severity: BLOCKING SPRINT PROGRESS
185
+ ```
186
+
187
+ ### 3. 处理选项 (Handling Options)
188
+
189
+ **选项 A - 标记为Blocked:**
190
+ - 更新story状态为 `BLOCKED_INVESTIGATION`
191
+ - 记录blocking factors
192
+ - Escalate to Architect (Winston) for architectural review
193
+ - 移出当前sprint backlog
194
+
195
+ **选项 B - 缩小范围 (Reduce Scope):**
196
+ - 识别哪些acceptance criteria无法在{max_fix_iterations}内完成
197
+ - 将这些AC移至"acceptance-criteria-deferred"部分
198
+ - 标记为"READY_FOR_TESTING"(简化的AC集合)
199
+ - 继续进入step-08
200
+
201
+ **选项 C - 重新分配 (Tech Lead Deep Dive):**
202
+ - 暂停当前story处理
203
+ - 分配给Tech Lead (Winston) 进行深度root cause分析
204
+ - 预计时间: 2-4小时的深度分析
205
+ - 结果: 要么找到fix,要么confirm需要选项A或B
206
+
207
+ **选项 D - 重新开始 (Fresh Start):**
208
+ - 回退所有代码更改到step-04开始前的状态
209
+ - 重新执行step-04到step-07
210
+ - 仅在其他选项都不可行时使用
211
+ - 添加至"lessons learned"文档
212
+
213
+ ### 4. Story状态管理
214
+
215
+ **设置Story Meta字段:**
216
+ ```
217
+ escalation_status: ESCALATED
218
+ escalation_date: {current_timestamp}
219
+ escalation_owner: {person_assigned}
220
+ recommended_action: [A/B/C/D]
221
+ estimated_resolution_time: [hours]
222
+ ```
223
+
224
+ ### 5. 防止进度堵塞 (Prevent Sprint Blocking)
225
+
226
+ - 不允许story卡在此步骤超过{max_fix_iterations} + 4小时
227
+ - 自动移至Scrum Master队列以处理escalation
228
+ - 在sprint status中标记为"NEEDS_DECISION"
229
+ - 不将此issue计入sprint velocity(因为未完成)
230
+
231
+ ### 6. 恢复进度 (Recovery Process)
232
+
233
+ 一旦Escalation决策完成:
234
+ - 如果选择 A: Story移至 `BLOCKED` 状态,等待Architect反馈
235
+ - 如果选择 B: 回到step-08 (complete story),使用简化的AC集合
236
+ - 如果选择 C: Architect执行分析,结果完成后回到step-07
237
+ - 如果选择 D: Story重置到step-04,重新开始整个cycle
@@ -17,8 +17,8 @@ nextStepFile: "./step-09-cycle-check.md"
17
17
  ### 1. Final Validation
18
18
 
19
19
  Before marking complete, verify all gates:
20
- 1. Read the COMPLETE story file at `{current_story_path}`
21
- 2. Verify ALL tasks and subtasks are marked [x]
20
+ 1. **Fresh Read:** Read the COMPLETE story file at `{current_story_path}` directly from disk (not from cache or prior state). This is critical because step-07 may have modified the file (e.g., updated task checkboxes, changed story status), and you MUST verify the current on-disk state, not a stale in-memory version.
21
+ 2. Verify ALL tasks and subtasks are marked [x], [X], or [✓] (case-insensitive, all formats accepted)
22
22
  3. Verify ALL acceptance criteria have been tested and passed
23
23
  4. Verify no unresolved HIGH or MEDIUM issues remain
24
24
  5. Verify the full test suite passes
@@ -32,10 +32,12 @@ nextStepFile: null
32
32
  - Key matches pattern: number-number-name (e.g., "1-2-user-auth")
33
33
  - NOT an epic key (epic-X) or retrospective (epic-X-retrospective)
34
34
  - Status value equals "backlog"
35
+ - If found: Set `{found_status}` = "backlog"
35
36
  5. If no "backlog" story is found, search again for the FIRST story where:
36
37
  - Key matches the same pattern (not epic, not retrospective)
37
38
  - Status value equals "ready-for-dev"
38
39
  - *(Mirrors step-01's initial story selection: "backlog, or ready-for-dev if no backlog")*
40
+ - If found: Set `{found_status}` = "ready-for-dev"
39
41
 
40
42
  ### 3. Evaluate Next Story
41
43
 
@@ -43,6 +45,7 @@ nextStepFile: null
43
45
  - Set `{current_story_key}` = found story key
44
46
  - Set `{current_story_path}` = "" (will be set during creation/validation)
45
47
  - Set `{fix_iteration}` = 0
48
+ - *(Note: `{found_status}` was already set in section 2 above — "backlog" or "ready-for-dev" — and is used in the progress checkpoint output below.)*
46
49
 
47
50
  **3.5. Batch Mode Progress Checkpoint**
48
51
 
@@ -34,9 +34,10 @@ This uses **step-file architecture** for focused execution across a long-running
34
34
 
35
35
  - `{pipeline_mode}` — "single" (one story) or "batch" (all backlog stories)
36
36
  - `{current_story_key}` — Key of story being processed (e.g., "1-2-user-auth")
37
- - `{current_story_path}` — Full path to current story file (derived in step-01 after resolving `{current_story_key}`; re-set in step-02 skip branch for batch cycles)
37
+ - `{current_story_path}` — Full path to current story file (derived in step-01 after resolving `{current_story_key}`; re-set in step-02 skip branch for batch cycles). **CRITICAL:** In batch mode, this variable is reset for each story iteration (step-09 → step-02 loop). Whenever re-reading the story file in subsequent steps (e.g., step-08 final validation, step-03 re-checks), always perform a FRESH read directly from disk using this path variable. Do NOT rely on cached/stale in-memory state from earlier steps in the same cycle, as intermediate steps (step-04, step-05, step-06, step-07) may have modified the file
38
38
  - `{fix_iteration}` — Bug fix loop counter (max controlled by `{max_fix_iterations}`, default 5; reset per story)
39
39
  - `{max_fix_iterations}` — Maximum fix-and-retest cycles per story (configurable via `max_fix_iterations` in config.yaml; default 5 if not set)
40
+ - `{fix_source}` — Origin of failures being fixed in step-07: "code-review" (step-05 routed here with unresolvable issues), "qa-testing" (step-06 routed here with test failures), or "mixed" (both code review and QA issues); set in step-07 section 2; determines post-fix routing (code-review/mixed → inline targeted re-check before step-08; qa-testing → step-08 directly)
40
41
  - `{stories_completed}` — Count of stories completed in this pipeline run
41
42
  - `{pipeline_status}` — Current pipeline phase for tracking
42
43
  - `{validation_attempt}` — Story validation attempt counter (used in step-03, max 3; re-initialized at start of step-03 for each story)
@@ -46,6 +47,7 @@ This uses **step-file architecture** for focused execution across a long-running
46
47
  - `{in_progress_count}` — Count of stories with status "in-progress" (initialized in step-01; refreshed in step-09)
47
48
  - `{review_count}` — Count of stories with status "review" (initialized in step-01; refreshed in step-09)
48
49
  - `{done_count}` — Count of stories with status "done" (initialized in step-01; refreshed in step-09)
50
+ - `{found_status}` — Status of the next processable story found during step-09 section 2 search: "backlog" or "ready-for-dev"; explicitly set alongside `{current_story_key}` when a story is selected; used in section 3.5 progress checkpoint output; local to step-09 and not persisted between stories
49
51
 
50
52
  ### Status Machine
51
53
 
@@ -1,6 +1,6 @@
1
- description = "Executes the {{name}} task from the BMAD Method."
1
+ description = "Executes the {{name}} task from the XiaoMa Method."
2
2
  prompt = """
3
- Execute the BMAD '{{name}}' task.
3
+ Execute the XiaoMa '{{name}}' task.
4
4
 
5
5
  TASK INSTRUCTIONS:
6
6
  1. LOAD the task file from {project-root}/{{bmadFolderName}}/{{path}}
@@ -1,6 +1,6 @@
1
- description = "Executes the {{name}} tool from the BMAD Method."
1
+ description = "Executes the {{name}} tool from the XiaoMa Method."
2
2
  prompt = """
3
- Execute the BMAD '{{name}}' tool.
3
+ Execute the XiaoMa '{{name}}' tool.
4
4
 
5
5
  TOOL INSTRUCTIONS:
6
6
  1. LOAD the tool file from {project-root}/{{bmadFolderName}}/{{path}}
@@ -1,6 +1,6 @@
1
1
  description = '{{description}}'
2
2
  prompt = """
3
- Execute the BMAD '{{name}}' workflow.
3
+ Execute the XiaoMa '{{name}}' workflow.
4
4
 
5
5
  CRITICAL: This is a structured YAML workflow. Follow these steps precisely:
6
6
 
@@ -1,6 +1,6 @@
1
1
  description = '{{description}}'
2
2
  prompt = """
3
- Execute the BMAD '{{name}}' workflow.
3
+ Execute the XiaoMa '{{name}}' workflow.
4
4
 
5
5
  CRITICAL: You must load and follow the workflow definition exactly.
6
6
 
@@ -25,17 +25,17 @@ const CLIUtils = {
25
25
 
26
26
  // ASCII art logo
27
27
  const logo = [
28
- ' ██████╗ ███╗ ███╗ █████╗ ██████╗ ™',
29
- ' ██╔══██╗████╗ ████║██╔══██╗██╔══██╗',
30
- ' ██████╔╝██╔████╔██║███████║██║ ██║',
31
- ' ██╔══██╗██║╚██╔╝██║██╔══██║██║ ██║',
32
- ' ██████╔╝██║ ╚═╝ ██║██║ ██║██████╔╝',
33
- ' ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝',
28
+ ' ██╗ ██╗██╗ █████╗ ██████╗ ███╗ ███╗ █████╗',
29
+ ' ╚██╗██╔╝██║██╔══██╗██╔═══██╗████╗ ████║██╔══██╗',
30
+ ' ╚███╔╝ ██║███████║██║ ██║██╔████╔██║███████║',
31
+ ' ██╔██╗ ██║██╔══██║██║ ██║██║╚██╔╝██║██╔══██║',
32
+ ' ██╔╝ ██╗██║██║ ██║╚██████╔╝██║ ╚═╝ ██║██║ ██║',
33
+ ' ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝',
34
34
  ]
35
35
  .map((line) => color.yellow(line))
36
36
  .join('\n');
37
37
 
38
- const tagline = ' Build More, Architect Dreams';
38
+ const tagline = ' AI-Driven Agile Development';
39
39
 
40
40
  await prompts.box(`${logo}\n${tagline}`, `v${version}`, {
41
41
  contentAlign: 'center',