@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,311 @@
1
+ ---
2
+ name: 'step-05-finalize'
3
+ description: 'Validate all artifacts, run completion checklist, and generate the final report for business-architect review'
4
+ nextStepFile: null
5
+ ---
6
+
7
+ # Step 5 of 5: Finalize PRD-to-Stories Pipeline
8
+
9
+ **Goal:** Validate all output artifacts, run the completion checklist, and generate the unified report that business architects will use to evaluate the quality of the generated user stories.
10
+
11
+ **Role:** Pipeline Orchestrator
12
+
13
+ ---
14
+
15
+ ## EXECUTION SEQUENCE
16
+
17
+ ### 1. Validate All Artifacts
18
+
19
+ Check that ALL expected output files exist:
20
+
21
+ **Phase 1 — Epics Artifact:**
22
+
23
+ 1. `{planning_artifacts}/epics.md` — Required
24
+
25
+ **Phase 2 — Sprint Planning Artifact:**
26
+
27
+ 2. `{implementation_artifacts}/sprint-status.yaml` — Required
28
+
29
+ **Phase 3 — Story File Artifacts:**
30
+
31
+ 3. For each story key in sprint-status.yaml (excluding those in `{failed_story_keys}`), a corresponding file at `{implementation_artifacts}/{story_key}.md` — Required
32
+
33
+ For each missing artifact:
34
+
35
+ - If epics.md or sprint-status.yaml is missing: log CRITICAL FAILURE
36
+ - If a per-story file is missing but its key is NOT in `{failed_story_keys}`: log CRITICAL FAILURE (the Agent claimed success without writing the file)
37
+ - If a per-story file is missing AND its key IS in `{failed_story_keys}`: expected (documented failure), no action
38
+
39
+ ### 2. Read Final Sprint Status
40
+
41
+ Fresh-read `{implementation_artifacts}/sprint-status.yaml` and parse:
42
+
43
+ - `{final_epic_count}` — Number of `epic-N` entries
44
+ - `{final_story_count}` — Total story keys matching `<digit>-<digit>-*`
45
+ - `{final_ready_count}` — Stories with status `ready-for-dev`
46
+ - `{final_backlog_count}` — Stories still at `backlog` (should equal `{stories_failed}` if pipeline ran fully)
47
+
48
+ **Sanity check:** `{final_ready_count}` should equal `{stories_created}` + (any pre-existing ready-for-dev stories from re-runs).
49
+
50
+ ### 3. Run Completion Checklist
51
+
52
+ If `{installed_path}/checklist.md` is readable, load it and evaluate each item against the artifacts on disk. For each failed item, append a line to the final report's "Checklist Findings" section.
53
+
54
+ If checklist.md is missing, skip this section silently.
55
+
56
+ ### 4. Validate Story File Structure (Full Scan + Deep Subsection Check)
57
+
58
+ For **EVERY** successfully created story file (NOT sampled — scan all of them):
59
+
60
+ 1. Read the file fully
61
+ 2. **Top-level required sections** (case-insensitive heading search):
62
+ - `Status` (and value contains `ready-for-dev`)
63
+ - `Story` (with "As a / I want / so that" pattern)
64
+ - `Acceptance Criteria`
65
+ - `Tasks` (or `Tasks / Subtasks`)
66
+ - `Dev Notes`
67
+ 3. **Dev Notes mandatory subsections** (the three from the step-04 Detailed Design Output Contract):
68
+ - `### Functional Requirements Addressed` (or case-insensitive variant matching `Functional Requirements`)
69
+ - `### Data Model & Database Design` (or case-insensitive variant matching any of: `Data Model`, `Database Design`, `Database Schema`, `数据模型`, `数据库设计`)
70
+ - `### Implementation Logic` (or case-insensitive variant matching any of: `Implementation Logic`, `Implementation Detail`, `Pseudocode`, `接口设计`, `实现逻辑`)
71
+ 4. **Subsection content quality (lightweight heuristic):**
72
+ - Data Model subsection: content non-empty AND (contains a table/field-list line OR contains the literal "TBD by architect")
73
+ - Implementation Logic subsection: content non-empty AND (contains code-fence / function signature / numbered steps OR contains the literal "TBD by architect")
74
+ - A subsection that contains only a heading with no body fails this check.
75
+
76
+ For each story file, classify:
77
+
78
+ - **Tier A — Fully Compliant:** all top-level sections present, all three Dev Notes subsections present and content-positive (no `TBD by architect`)
79
+ - **Tier B — TBD-flagged:** all sections present, but one or more subsections contain `TBD by architect` (this is acceptable — it surfaces unknowns honestly for the architect)
80
+ - **Tier C — Structurally Incomplete:** one or more required top-level sections missing, OR a required Dev Notes subsection missing, OR a subsection has only a heading with no body
81
+
82
+ Compute the coverage tallies for the final report:
83
+
84
+ - `{dev_notes_db_coverage}` = count of story files with a non-empty `Data Model & Database Design` subsection / `{stories_created}`
85
+ - `{dev_notes_impl_coverage}` = count of story files with a non-empty `Implementation Logic` subsection / `{stories_created}`
86
+ - `{tier_a_count}`, `{tier_b_count}`, `{tier_c_count}` for the per-tier breakdown
87
+
88
+ For every Tier C file, add a line to "Structural Warnings" listing the file path and exactly which sections/subsections failed.
89
+
90
+ Also cross-check `story_results` from step-04: if any story has `db_design_status: missing` or `impl_logic_status: missing` reported by the Agent, list it in Structural Warnings even if heading-based detection passed (the Agent self-reported missing content).
91
+
92
+ ### 4b. FR Reverse-Traceability Check
93
+
94
+ This implements Must Fix #4: ensure every functional requirement in `prd.md` is referenced by at least one story file.
95
+
96
+ 1. **Parse PRD functional requirements:**
97
+ - Read `{planning_artifacts}/prd.md` fully
98
+ - Extract FR identifiers using these patterns (in priority order, stop after the first that yields ≥1 match):
99
+ a. Lines matching `^FR-?\d+\b` or `^\*\*FR-?\d+\*\*` (canonical FR-N format)
100
+ b. Lines under a section titled `## Functional Requirements` or `## 功能需求`, where each bullet/numbered item is treated as one FR (assign synthetic ids `FR-1`, `FR-2`, ...)
101
+ c. Numbered headings under `## Features` or `## 功能点` (assign synthetic ids `FEAT-1`, `FEAT-2`, ...)
102
+ - If no patterns match (PRD has no structured FR list): skip the rest of this section and log INFO — "PRD has no structured FR list; reverse traceability skipped. Architects should manually verify coverage from epics.md and story files."
103
+ - Otherwise, set `{prd_fr_inventory}` = the list of extracted FR identifiers + their short title
104
+
105
+ 2. **For each FR in `{prd_fr_inventory}`:**
106
+ - Search ALL story files (`{implementation_artifacts}/<digit>-<digit>-*.md`) for ANY of:
107
+ - The exact FR identifier (e.g., `FR-3`)
108
+ - The FR's short title text (substring match, case-insensitive, length ≥ 8 chars to avoid false positives)
109
+ - A `[Source: prd.md#<section>]` citation whose `<section>` matches the FR's parent section
110
+ - If at least one story file references the FR: mark `covered`
111
+ - If no story file references the FR: mark `uncovered`
112
+
113
+ 3. **Compute coverage:**
114
+ - `{fr_coverage_numerator}` = count of FRs marked `covered`
115
+ - `{fr_coverage_denominator}` = `len(prd_fr_inventory)`
116
+ - `{uncovered_frs}` = list of FR identifiers marked `uncovered`
117
+
118
+ 4. **For each uncovered FR:**
119
+ - Add a HIGH-PRIORITY line to "Structural Warnings": `Uncovered FR: {fr_id} — "{fr_title}" — NO story file references this requirement. The pipeline may have dropped this feature.`
120
+
121
+ 5. **Cross-check epics.md FR Coverage Map** (if `{epics_fr_count}` was set in step-02):
122
+ - If `{fr_coverage_denominator}` significantly differs from `{epics_fr_count}` (delta > 20%): add WARNING to Structural Warnings — "FR-Coverage-Map count ({epics_fr_count}) vs PRD-extracted FR count ({fr_coverage_denominator}) differ by >20%. epics.md may have an incomplete FR Coverage Map."
123
+
124
+ ### 5. Generate Final Report
125
+
126
+ Set `{prd_to_stories_status}` = "complete" and `{steps_completed}` = 5 BEFORE printing.
127
+
128
+ **Output:**
129
+
130
+ ```
131
+ ═══════════════════════════════════════════════════════════════
132
+ Auto PRD-to-Stories Pipeline — COMPLETE
133
+ ═══════════════════════════════════════════════════════════════
134
+
135
+ Project: {project_name}
136
+ Date: {date}
137
+ Master Steps Completed: {steps_completed}/5
138
+
139
+ Input:
140
+ 📋 PRD: {planning_artifacts}/prd.md
141
+
142
+ Outputs:
143
+ 📄 Epics: {planning_artifacts}/epics.md [{phase_1_status}]
144
+ 📊 Sprint Status: {implementation_artifacts}/sprint-status.yaml [{phase_2_status}]
145
+ 📁 Story Files: {implementation_artifacts}/<story_key>.md × {stories_created} [{phase_3_status}]
146
+
147
+ Phase Breakdown:
148
+ Phase 1 — Create Epics [{phase_1_status}]
149
+ └─ Total Epics: {final_epic_count}
150
+ └─ Total Stories (in epics.md): {final_story_count}
151
+ └─ FRs in Coverage Map: {epics_fr_count}
152
+
153
+ Phase 2 — Sprint Planning Bridge [{phase_2_status}]
154
+ └─ Stories tracked: {final_story_count}
155
+
156
+ Phase 3 — Batch Story File Creation [{phase_3_status}]
157
+ ├─ Stories Successfully Created: {stories_created}
158
+ ├─ Stories Failed: {stories_failed}
159
+ └─ Failed Keys: {failed_story_keys joined, or "none"}
160
+
161
+ 🔎 Quality Coverage (for architect review):
162
+ ├─ FR Coverage: {fr_coverage_numerator}/{fr_coverage_denominator}
163
+ ├─ Data Model subsection: {dev_notes_db_coverage}/{stories_created} (present)
164
+ ├─ Implementation Logic subsec: {dev_notes_impl_coverage}/{stories_created} (present)
165
+ ├─ Tier A (fully compliant): {tier_a_count}
166
+ ├─ Tier B (TBD-flagged honest): {tier_b_count}
167
+ └─ Tier C (structurally incomplete): {tier_c_count} ⚠ if > 0, see Structural Warnings below
168
+
169
+ Pipeline Status: {prd_to_stories_status}
170
+ ═══════════════════════════════════════════════════════════════
171
+
172
+ 📋 Story Files Generated (for business-architect review):
173
+ {for each entry in story_results where final_status == "created":
174
+ ✅ {story_key}.md — {summary}
175
+ }
176
+
177
+ ❌ Story Files Failed:
178
+ {for each entry in story_results where final_status == "failed":
179
+ ⚠️ {story_key} — {error}
180
+ }
181
+
182
+ {IF "Structural Warnings" non-empty:}
183
+ ⚠️ Structural Warnings (high → low priority):
184
+
185
+ -- FR Coverage Gaps (HIGHEST priority — these features may have been dropped) --
186
+ {for each uncovered_fr: "Uncovered FR: {fr_id} — \"{fr_title}\" — NO story file references this. The pipeline may have dropped this feature."}
187
+
188
+ -- Structural Incompleteness (Tier C files) --
189
+ {for each Tier C entry: story_key — missing sections/subsections list}
190
+
191
+ -- Self-Reported Missing Content (from Agent STORY_RESULT) --
192
+ {for each story with db_design_status == "missing" or impl_logic_status == "missing": story_key — which subsection Agent reported missing}
193
+
194
+ -- FR Coverage Map Discrepancy (if any) --
195
+ {if FR-coverage-map count delta > 20%: warning text}
196
+
197
+ {IF "Checklist Findings" non-empty:}
198
+ 📋 Checklist Findings:
199
+ {for each failed item: item description}
200
+ ```
201
+
202
+ ### 6. Architect Review Guidance
203
+
204
+ ```
205
+ ───────────────────────────────────────────────────────────────
206
+ 🎯 Next: Business-Architect Quality Review
207
+ ───────────────────────────────────────────────────────────────
208
+
209
+ The pipeline stops HERE intentionally. The generated artifacts are
210
+ the input to a manual quality review:
211
+
212
+ 1. **Start with the Quality Coverage block above.**
213
+ - If FR Coverage < 100%: find the listed uncovered FRs FIRST — these
214
+ are features from prd.md that no story addresses. Run create-epics-
215
+ and-stories again or manually add the missing stories.
216
+ - If Tier C count > 0: open those files first — they have structural
217
+ holes that block downstream development.
218
+
219
+ 2. Review epics.md for completeness vs. the input prd.md
220
+ (Are all PRD features represented? Right epic granularity?
221
+ Cross-check the FR Coverage Map section.)
222
+
223
+ 3. Review each {story_key}.md for:
224
+ - Story statement clarity (As a / I want / so that)
225
+ - Acceptance Criteria testability (BDD Given/When/Then quality)
226
+ - Task decomposition concreteness
227
+ - **Data Model & Database Design subsection** — Are the tables/fields/
228
+ indexes/constraints concrete? If "TBD by architect", is the missing
229
+ piece something prd.md should have specified, or is it genuinely a
230
+ design decision for the architect to make now?
231
+ - **Implementation Logic subsection** — Are interface signatures,
232
+ algorithms, and error-handling concrete? Or hand-wavy?
233
+ - **Functional Requirements Addressed subsection** — Does it cite
234
+ specific FRs/sections from prd.md or epics.md?
235
+
236
+ 4. Capture feedback on which dimensions are weak — feed back
237
+ into the create-epics-and-stories / create-story prompts
238
+ to improve generation quality.
239
+
240
+ 5. When ready to enter development, run:
241
+ /xiaoma → load sm → ASB
242
+ (auto-story-pipeline-batch will pick up from ready-for-dev.)
243
+
244
+ ───────────────────────────────────────────────────────────────
245
+ ```
246
+
247
+ ### 7. Generate Machine-Readable Status File
248
+
249
+ Write to: `{implementation_artifacts}/prd-to-stories-status.json`
250
+
251
+ ```json
252
+ {
253
+ "pipeline": "auto-prd-to-stories",
254
+ "date": "{date}",
255
+ "project": "{project_name}",
256
+ "status": "{prd_to_stories_status}",
257
+ "master_steps_completed": 5,
258
+ "input": {
259
+ "prd": "{planning_artifacts}/prd.md"
260
+ },
261
+ "phases": {
262
+ "epics": {
263
+ "status": "{phase_1_status}",
264
+ "artifact": "{planning_artifacts}/epics.md",
265
+ "epic_count": "{final_epic_count}",
266
+ "story_count": "{final_story_count}"
267
+ },
268
+ "sprint_planning": {
269
+ "status": "{phase_2_status}",
270
+ "artifact": "{implementation_artifacts}/sprint-status.yaml"
271
+ },
272
+ "story_creation": {
273
+ "status": "{phase_3_status}",
274
+ "stories_created": "{stories_created}",
275
+ "stories_failed": "{stories_failed}",
276
+ "failed_story_keys": "{failed_story_keys}",
277
+ "quality_coverage": {
278
+ "fr_coverage": {
279
+ "covered": "{fr_coverage_numerator}",
280
+ "total": "{fr_coverage_denominator}",
281
+ "uncovered_frs": "{uncovered_frs}"
282
+ },
283
+ "data_model_present": "{dev_notes_db_coverage}",
284
+ "implementation_logic_present": "{dev_notes_impl_coverage}",
285
+ "tier_a_count": "{tier_a_count}",
286
+ "tier_b_count": "{tier_b_count}",
287
+ "tier_c_count": "{tier_c_count}"
288
+ }
289
+ }
290
+ }
291
+ }
292
+ ```
293
+
294
+ ### 8. Pipeline Complete
295
+
296
+ **Pipeline execution is COMPLETE. HALT.**
297
+
298
+ ---
299
+
300
+ ## SUCCESS METRICS
301
+
302
+ - All 3 phases reported with status
303
+ - All successfully created story files exist on disk and contain required sections
304
+ - Final report output with architect-review guidance
305
+ - Machine-readable status file written
306
+
307
+ ## FAILURE MODES
308
+
309
+ - Missing epics.md or sprint-status.yaml when at least one phase claimed success
310
+ - Story files claimed created but missing on disk
311
+ - Failure to write the final status JSON
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: auto-prd-to-stories
3
+ description: "Automated PRD-to-Stories pipeline (NO development): prd.md → epics breakdown → sprint planning bridge → per-story detailed file generation. Stops before dev/review/QA so business architects can evaluate user-story quality. Use when the user says 'PRD 转故事', 'auto prd to stories', or 'APS'"
4
+ ---
5
+
6
+ # Auto PRD-to-Stories Pipeline Workflow
7
+
8
+ **Goal:** Take an existing `prd.md` and produce all detailed user-story files (one `.md` per story) so business architects can review the quality of the generated stories. This pipeline STOPS BEFORE development, review, or testing — the output is the input to a manual quality-review activity.
9
+
10
+ **Your Role:** Pipeline Orchestrator. You coordinate two delegations and a batch loop, switching expert roles as each phase demands:
11
+
12
+ - **Phase 1 — Epics Creation** (PM xiaochan) — delegates to xiaoma-create-epics-and-stories
13
+ - **Phase 2 — Bridge** (SM xiaomin) — generates sprint-status.yaml via xiaoma-sprint-planning
14
+ - **Phase 3 — Batch Story Creation** (SM xiaomin scheduler) — per story: Agent subprocess runs xiaoma-create-story and exits BEFORE entering dev/review/test
15
+
16
+ - Communicate all responses in {communication_language} and generate all documents in {document_output_language}
17
+ - Execute ALL steps in exact order; do NOT skip steps
18
+ - Absolutely DO NOT stop because of "milestones", "significant progress", or "session boundaries". Continue in a single execution until the pipeline is COMPLETE or a HALT condition is triggered
19
+ - Each step file loads fresh to combat "lost in the middle" context degradation
20
+ - **Hard boundary:** This pipeline NEVER enters story development. Every Agent subprocess in Phase 3 stops immediately after step-02-create-story completes — do not progress to validate-story / develop-story / code-review / test-story / fix-and-retest / complete-story / finalize.
21
+
22
+ ## Context Management Strategy
23
+
24
+ This pipeline may execute 5 master steps where Phase 3 contains N sub-iterations (N = number of stories). To maintain coherence across long sessions:
25
+
26
+ 1. **Phase Boundary Summaries** — At the end of each Phase (Steps 02, 03, 04), output a concise state snapshot including all master pipeline variables, artifact paths produced, and story counts. This ensures critical state survives context compression.
27
+ 2. **Story Batch Checkpoints** — During Phase 3 (Step-04), the batch loop outputs a running tally after every story Agent returns: `"[Checkpoint] Stories created: X/Y, current story: {key}"`. This provides recovery anchors if context is compressed mid-batch.
28
+ 3. **Fresh File Reads Over Memory** — When resuming after context compression, always re-read `sprint-status.yaml` from disk rather than relying on in-memory state. The file on disk is the source of truth for story statuses.
29
+
30
+ ---
31
+
32
+ ## WORKFLOW ARCHITECTURE
33
+
34
+ This uses **step-file architecture** with delegation to existing sub-workflows:
35
+
36
+ - Step-01: Initialize and validate — verify prd.md exists, load config, confirm sub-workflow paths
37
+ - Step-02: Create Epics — delegates to xiaoma-create-epics-and-stories, produces epics.md
38
+ - Step-03: Bridge — delegates to xiaoma-sprint-planning, produces sprint-status.yaml
39
+ - Step-04: Batch Create Stories — for each backlog story, launch Agent subprocess running xiaoma-create-story; produces per-story `.md` files
40
+ - Step-05: Finalize — quality self-check, unified completion report listing all artifacts for architect review
41
+
42
+ ### State Variables
43
+
44
+ **Pipeline-Level:**
45
+
46
+ - `{prd_to_stories_status}` — Current master phase: "initializing" → "epics-phase" → "bridge-phase" → "stories-phase" → "complete"
47
+ - `{steps_completed}` — Count of master pipeline steps executed (1–5)
48
+ - `{phase_1_status}` — Result of epics creation: "success" | "failed"
49
+ - `{phase_2_status}` — Result of sprint-planning bridge: "success" | "failed"
50
+ - `{phase_3_status}` — Result of batch story creation: "success" | "partial" | "failed"
51
+
52
+ **Phase 3 batch tracking (from ASB pattern):**
53
+
54
+ - `{stories_created}` — Count of stories successfully created (final_status: created)
55
+ - `{stories_failed}` — Count of stories that failed creation
56
+ - `{failed_story_keys}` — List of story keys whose Agent failed; skipped in subsequent loop iterations to avoid infinite loops
57
+ - `{story_results}` — Accumulating list of per-story result summaries for the final report
58
+
59
+ ### Output Artifacts
60
+
61
+ - `{planning_artifacts}/epics.md` — Epic breakdown with BDD-formatted stories (high-level view for horizontal review)
62
+ - `{implementation_artifacts}/sprint-status.yaml` — Story tracking index
63
+ - `{implementation_artifacts}/{story_key}.md` — One detailed story file per story (vertical depth for architect review). All stories end at status `ready-for-dev`.
64
+
65
+ ### Pipeline Flow
66
+
67
+ ```
68
+ Step-01 (Init) → Step-02 (Create Epics) → Step-03 (Sprint Planning Bridge) → Step-04 (Batch Create Stories) → Step-05 (Finalize)
69
+ └─ delegates to └─ delegates to └─ N Agent subprocesses,
70
+ xiaoma-create- xiaoma-sprint-planning each running only
71
+ epics-and-stories xiaoma-create-story
72
+ Produces: epics.md Produces: sprint-status.yaml Produces: {story_key}.md × N
73
+ ```
74
+
75
+ ---
76
+
77
+ ## INITIALIZATION
78
+
79
+ ### Configuration Loading
80
+
81
+ Load config from `{project-root}/_xiaoma/xmc/config.yaml` and resolve:
82
+
83
+ - `project_name`, `user_name`
84
+ - `communication_language`, `document_output_language`
85
+ - `user_skill_level`
86
+ - `planning_artifacts`, `implementation_artifacts`
87
+ - `date` as system-generated current datetime
88
+
89
+ ### Paths
90
+
91
+ - `installed_path` = `{project-root}/_xiaoma/xmc/workflows/5-full-pipeline/auto-prd-to-stories`
92
+ - `create_epics_workflow` = `{project-root}/_xiaoma/xmc/workflows/3-solutioning/xiaoma-create-epics-and-stories/workflow.md`
93
+ - `sprint_planning_workflow` = `{project-root}/_xiaoma/xmc/workflows/4-implementation/xiaoma-sprint-planning/workflow.md`
94
+ - `create_story_workflow` = `{project-root}/_xiaoma/xmc/workflows/4-implementation/xiaoma-create-story/workflow.md`
95
+ - `validation` = `{installed_path}/checklist.md`
96
+
97
+ ### Context
98
+
99
+ - `project_context` = `**/project-context.md` (load if exists)
100
+
101
+ ---
102
+
103
+ ## EXECUTION
104
+
105
+ Read fully and follow: `{project-root}/_xiaoma/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-01-init-and-validate.md` to begin the pipeline.
@@ -0,0 +1,3 @@
1
+ canonicalId: xiaoma-auto-prd-to-stories
2
+ type: workflow
3
+ description: "Automated PRD-to-Stories pipeline (NO development): prd.md → epics → sprint-status → per-story detailed files. Stops before dev so architects can evaluate user-story quality. Triggers: 'APS', 'auto prd to stories', 'PRD 转故事'"