@zeyue0329/xiaoma-cli 1.13.0 → 1.15.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 (712) hide show
  1. package/package.json +24 -14
  2. package/src/core-skills/module-help.csv +13 -0
  3. package/src/{core → core-skills}/module.yaml +8 -0
  4. package/src/{core/skills/xiaoma-advanced-elicitation/workflow.md → core-skills/xiaoma-advanced-elicitation/SKILL.md} +10 -3
  5. package/src/core-skills/xiaoma-advanced-elicitation/methods.csv +70 -0
  6. package/src/{core/skills → core-skills}/xiaoma-brainstorming/steps/step-03-technique-execution.md +6 -4
  7. package/src/{core/skills → core-skills}/xiaoma-brainstorming/workflow.md +1 -1
  8. package/src/core-skills/xiaoma-customize/SKILL.md +111 -0
  9. package/src/core-skills/xiaoma-customize/scripts/list_customizable_skills.js +172 -0
  10. package/src/{core/skills → core-skills}/xiaoma-distillator/resources/distillate-format-reference.md +1 -1
  11. package/src/{core/skills → core-skills}/xiaoma-distillator/scripts/analyze_sources.py +2 -2
  12. package/src/{core/skills/xiaoma-editorial-review-prose/workflow.md → core-skills/xiaoma-editorial-review-prose/SKILL.md} +5 -0
  13. package/src/{core/skills/xiaoma-editorial-review-structure/workflow.md → core-skills/xiaoma-editorial-review-structure/SKILL.md} +5 -0
  14. package/src/core-skills/xiaoma-help/SKILL.md +75 -0
  15. package/src/{core/skills/xiaoma-index-docs/workflow.md → core-skills/xiaoma-index-docs/SKILL.md} +5 -0
  16. package/src/core-skills/xiaoma-party-mode/SKILL.md +128 -0
  17. package/src/{core/skills/xiaoma-review-adversarial-general/workflow.md → core-skills/xiaoma-review-adversarial-general/SKILL.md} +5 -0
  18. package/src/{core/skills/xiaoma-review-edge-case-hunter/workflow.md → core-skills/xiaoma-review-edge-case-hunter/SKILL.md} +5 -0
  19. package/src/{core/skills/xiaoma-shard-doc/workflow.md → core-skills/xiaoma-shard-doc/SKILL.md} +5 -0
  20. package/src/core-skills/xiaoma-spec/SKILL.md +129 -0
  21. package/src/core-skills/xiaoma-spec/assets/headless-schemas.md +33 -0
  22. package/src/core-skills/xiaoma-spec/assets/spec-template.md +49 -0
  23. package/src/core-skills/xiaoma-spec/customize.toml +53 -0
  24. package/src/scripts/resolve_config.js +163 -0
  25. package/src/scripts/resolve_customization.js +188 -0
  26. package/src/scripts/toml.js +338 -0
  27. package/src/xmc-skills/1-analysis/research/xiaoma-domain-research/SKILL.md +96 -0
  28. package/src/xmc-skills/1-analysis/research/xiaoma-domain-research/customize.toml +41 -0
  29. package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-domain-research/domain-steps/step-06-research-synthesis.md +6 -0
  30. package/src/xmc-skills/1-analysis/research/xiaoma-market-research/SKILL.md +96 -0
  31. package/src/xmc-skills/1-analysis/research/xiaoma-market-research/customize.toml +41 -0
  32. package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-market-research/steps/step-06-research-completion.md +6 -0
  33. package/src/xmc-skills/1-analysis/research/xiaoma-technical-research/SKILL.md +96 -0
  34. package/src/xmc-skills/1-analysis/research/xiaoma-technical-research/customize.toml +41 -0
  35. package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-technical-research/technical-steps/step-06-research-synthesis.md +6 -0
  36. package/src/xmc-skills/1-analysis/xiaoma-agent-analyst/SKILL.md +76 -0
  37. package/src/xmc-skills/1-analysis/xiaoma-agent-analyst/customize.toml +90 -0
  38. package/src/xmc-skills/1-analysis/xiaoma-agent-tech-writer/SKILL.md +76 -0
  39. package/src/xmc-skills/1-analysis/xiaoma-agent-tech-writer/customize.toml +81 -0
  40. package/src/xmc-skills/1-analysis/xiaoma-agent-tech-writer/explain-concept.md +20 -0
  41. package/src/xmc-skills/1-analysis/xiaoma-agent-tech-writer/mermaid-gen.md +20 -0
  42. package/src/xmc-skills/1-analysis/xiaoma-agent-tech-writer/validate-doc.md +19 -0
  43. package/src/xmc-skills/1-analysis/xiaoma-agent-tech-writer/write-document.md +20 -0
  44. package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/checklist.md +5 -2
  45. package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/steps/step-01-init-and-validate.md +18 -1
  46. package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/steps/step-02-requirements-analysis.md +3 -1
  47. package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/steps/step-03-architecture-analysis.md +5 -3
  48. package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/steps/step-04-create-prd.md +12 -14
  49. package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/steps/step-05-validate-prd.md +18 -15
  50. package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/steps/step-06-create-epics.md +9 -5
  51. package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/steps/step-07-create-architecture.md +10 -7
  52. package/src/xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline/steps/step-08-finalize.md +184 -0
  53. package/src/xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline/workflow.md +140 -0
  54. package/src/xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline/xiaoma-skill-manifest.yaml +24 -0
  55. package/src/xmc-skills/1-analysis/xiaoma-document-project/SKILL.md +62 -0
  56. package/src/xmc-skills/1-analysis/xiaoma-document-project/customize.toml +41 -0
  57. package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/workflows/deep-dive-instructions.md +1 -0
  58. package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/workflows/full-scan-instructions.md +1 -0
  59. package/src/xmc-skills/1-analysis/xiaoma-prfaq/SKILL.md +135 -0
  60. package/src/xmc-skills/1-analysis/xiaoma-prfaq/agents/artifact-analyzer.md +60 -0
  61. package/src/xmc-skills/1-analysis/xiaoma-prfaq/agents/web-researcher.md +49 -0
  62. package/src/xmc-skills/1-analysis/xiaoma-prfaq/assets/prfaq-template.md +62 -0
  63. package/src/xmc-skills/1-analysis/xiaoma-prfaq/customize.toml +41 -0
  64. package/src/xmc-skills/1-analysis/xiaoma-prfaq/references/customer-faq.md +55 -0
  65. package/src/xmc-skills/1-analysis/xiaoma-prfaq/references/internal-faq.md +51 -0
  66. package/src/xmc-skills/1-analysis/xiaoma-prfaq/references/press-release.md +60 -0
  67. package/src/xmc-skills/1-analysis/xiaoma-prfaq/references/verdict.md +83 -0
  68. package/src/xmc-skills/1-analysis/xiaoma-prfaq/xiaoma-manifest.json +16 -0
  69. package/src/xmc-skills/1-analysis/xiaoma-product-brief/SKILL.md +91 -0
  70. package/src/xmc-skills/1-analysis/xiaoma-product-brief/assets/brief-template.md +41 -0
  71. package/src/xmc-skills/1-analysis/xiaoma-product-brief/customize.toml +99 -0
  72. package/src/xmc-skills/2-plan-workflows/xiaoma-agent-pm/SKILL.md +76 -0
  73. package/src/xmc-skills/2-plan-workflows/xiaoma-agent-pm/customize.toml +75 -0
  74. package/src/xmc-skills/2-plan-workflows/xiaoma-agent-ux-designer/SKILL.md +76 -0
  75. package/src/xmc-skills/2-plan-workflows/xiaoma-agent-ux-designer/customize.toml +60 -0
  76. package/src/xmc-skills/2-plan-workflows/xiaoma-create-prd/SKILL.md +30 -0
  77. package/src/xmc-skills/2-plan-workflows/xiaoma-create-prd/customize.toml +41 -0
  78. package/src/xmc-skills/2-plan-workflows/xiaoma-edit-prd/SKILL.md +30 -0
  79. package/src/xmc-skills/2-plan-workflows/xiaoma-edit-prd/customize.toml +42 -0
  80. package/src/xmc-skills/2-plan-workflows/xiaoma-prd/SKILL.md +92 -0
  81. package/src/xmc-skills/2-plan-workflows/xiaoma-prd/assets/headless-schemas.md +76 -0
  82. package/src/xmc-skills/2-plan-workflows/xiaoma-prd/assets/prd-template.md +165 -0
  83. package/src/xmc-skills/2-plan-workflows/xiaoma-prd/assets/prd-validation-checklist.md +217 -0
  84. package/src/xmc-skills/2-plan-workflows/xiaoma-prd/assets/validation-report-template.html +325 -0
  85. package/src/xmc-skills/2-plan-workflows/xiaoma-prd/customize.toml +147 -0
  86. package/src/xmc-skills/2-plan-workflows/xiaoma-prd/references/headless.md +39 -0
  87. package/src/xmc-skills/2-plan-workflows/xiaoma-prd/references/validate.md +97 -0
  88. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/SKILL.md +90 -0
  89. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/color-themes.md +9 -0
  90. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/design-directions.md +9 -0
  91. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/design-example-editorial.md +158 -0
  92. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/design-example-mobile.md +93 -0
  93. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/design-example-shadcn.md +109 -0
  94. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/excalidraw-wireframe.md +19 -0
  95. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/experience-example-mobile.md +112 -0
  96. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/experience-example-shadcn.md +133 -0
  97. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/headless-schemas.md +84 -0
  98. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/key-screens.md +29 -0
  99. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/assets/validation-report-template.html +319 -0
  100. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/customize.toml +100 -0
  101. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/references/creative-tools.md +19 -0
  102. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/references/design-md-spec.md +50 -0
  103. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/references/headless.md +37 -0
  104. package/src/xmc-skills/2-plan-workflows/xiaoma-ux/references/validate.md +115 -0
  105. package/src/xmc-skills/2-plan-workflows/xiaoma-validate-prd/SKILL.md +30 -0
  106. package/src/xmc-skills/2-plan-workflows/xiaoma-validate-prd/customize.toml +31 -0
  107. package/src/xmc-skills/3-solutioning/xiaoma-agent-architect/SKILL.md +76 -0
  108. package/src/xmc-skills/3-solutioning/xiaoma-agent-architect/customize.toml +65 -0
  109. package/src/xmc-skills/3-solutioning/xiaoma-check-implementation-readiness/SKILL.md +91 -0
  110. package/src/xmc-skills/3-solutioning/xiaoma-check-implementation-readiness/customize.toml +41 -0
  111. package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-check-implementation-readiness/steps/step-01-document-discovery.md +1 -1
  112. package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-check-implementation-readiness/steps/step-02-prd-analysis.md +1 -1
  113. package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-check-implementation-readiness/steps/step-03-epic-coverage-validation.md +1 -1
  114. package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-check-implementation-readiness/steps/step-06-final-assessment.md +6 -0
  115. package/src/xmc-skills/3-solutioning/xiaoma-create-architecture/SKILL.md +74 -0
  116. package/src/xmc-skills/3-solutioning/xiaoma-create-architecture/customize.toml +41 -0
  117. package/src/xmc-skills/3-solutioning/xiaoma-create-architecture/references/headless.md +37 -0
  118. package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-07-validation.md +23 -21
  119. package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-08-complete.md +6 -0
  120. package/src/xmc-skills/3-solutioning/xiaoma-create-epics-and-stories/SKILL.md +93 -0
  121. package/src/xmc-skills/3-solutioning/xiaoma-create-epics-and-stories/customize.toml +41 -0
  122. package/src/xmc-skills/3-solutioning/xiaoma-create-epics-and-stories/references/headless.md +35 -0
  123. package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-epics-and-stories/steps/step-02-design-epics.md +34 -4
  124. package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-epics-and-stories/steps/step-04-final-validation.md +12 -0
  125. package/src/xmc-skills/3-solutioning/xiaoma-generate-project-context/SKILL.md +81 -0
  126. package/src/xmc-skills/3-solutioning/xiaoma-generate-project-context/customize.toml +41 -0
  127. package/src/{xmc/workflows → xmc-skills/3-solutioning}/xiaoma-generate-project-context/steps/step-03-complete.md +6 -0
  128. package/src/xmc-skills/4-implementation/xiaoma-agent-dev/SKILL.md +76 -0
  129. package/src/xmc-skills/4-implementation/xiaoma-agent-dev/customize.toml +131 -0
  130. package/src/xmc-skills/4-implementation/xiaoma-auto-story-pipeline/checklist.md +29 -0
  131. package/src/{xmc/workflows/4-implementation/auto-story-pipeline → xmc-skills/4-implementation/xiaoma-auto-story-pipeline}/steps/step-01-init-and-validate.md +16 -8
  132. package/src/xmc-skills/4-implementation/xiaoma-auto-story-pipeline/steps/step-02-create-story.md +111 -0
  133. package/src/{xmc/workflows/4-implementation/auto-story-pipeline → xmc-skills/4-implementation/xiaoma-auto-story-pipeline}/steps/step-03-validate-story.md +4 -2
  134. package/src/{xmc/workflows/4-implementation/auto-story-pipeline → xmc-skills/4-implementation/xiaoma-auto-story-pipeline}/steps/step-04-develop-story.md +10 -6
  135. package/src/xmc-skills/4-implementation/xiaoma-auto-story-pipeline/steps/step-05-code-review.md +99 -0
  136. package/src/{xmc/workflows/4-implementation/auto-story-pipeline → xmc-skills/4-implementation/xiaoma-auto-story-pipeline}/steps/step-06-test-story.md +25 -12
  137. package/src/{xmc/workflows/4-implementation/auto-story-pipeline → xmc-skills/4-implementation/xiaoma-auto-story-pipeline}/steps/step-07-fix-and-retest.md +28 -13
  138. package/src/xmc-skills/4-implementation/xiaoma-auto-story-pipeline/steps/step-08-complete-story.md +174 -0
  139. package/src/xmc-skills/4-implementation/xiaoma-auto-story-pipeline/steps/step-09-finalize.md +145 -0
  140. package/src/xmc-skills/4-implementation/xiaoma-auto-story-pipeline/workflow.md +127 -0
  141. package/src/xmc-skills/4-implementation/xiaoma-auto-story-pipeline/xiaoma-skill-manifest.yaml +27 -0
  142. package/src/{xmc/workflows/4-implementation/auto-story-pipeline-batch → xmc-skills/4-implementation/xiaoma-auto-story-pipeline-batch}/SKILL.md +2 -2
  143. package/src/xmc-skills/4-implementation/xiaoma-auto-story-pipeline-batch/checklist.md +45 -0
  144. package/src/{xmc/workflows/4-implementation/auto-story-pipeline-batch → xmc-skills/4-implementation/xiaoma-auto-story-pipeline-batch}/workflow.md +150 -7
  145. package/src/{xmc/workflows/4-implementation/auto-story-pipeline-batch → xmc-skills/4-implementation/xiaoma-auto-story-pipeline-batch}/xiaoma-skill-manifest.yaml +2 -2
  146. package/src/xmc-skills/4-implementation/xiaoma-checkpoint-preview/SKILL.md +68 -0
  147. package/src/xmc-skills/4-implementation/xiaoma-checkpoint-preview/customize.toml +41 -0
  148. package/src/xmc-skills/4-implementation/xiaoma-checkpoint-preview/generate-trail.md +38 -0
  149. package/src/xmc-skills/4-implementation/xiaoma-checkpoint-preview/step-01-orientation.md +105 -0
  150. package/src/xmc-skills/4-implementation/xiaoma-checkpoint-preview/step-02-walkthrough.md +89 -0
  151. package/src/xmc-skills/4-implementation/xiaoma-checkpoint-preview/step-03-detail-pass.md +106 -0
  152. package/src/xmc-skills/4-implementation/xiaoma-checkpoint-preview/step-04-testing.md +74 -0
  153. package/src/xmc-skills/4-implementation/xiaoma-checkpoint-preview/step-05-wrapup.md +30 -0
  154. package/src/xmc-skills/4-implementation/xiaoma-code-review/SKILL.md +90 -0
  155. package/src/xmc-skills/4-implementation/xiaoma-code-review/customize.toml +41 -0
  156. package/src/xmc-skills/4-implementation/xiaoma-code-review/steps/step-01-gather-context.md +85 -0
  157. package/src/xmc-skills/4-implementation/xiaoma-code-review/steps/step-02-review.md +35 -0
  158. package/src/{xmc/workflows → xmc-skills}/4-implementation/xiaoma-code-review/steps/step-03-triage.md +7 -8
  159. package/src/xmc-skills/4-implementation/xiaoma-code-review/steps/step-04-present.md +132 -0
  160. package/src/{xmc/workflows/4-implementation/xiaoma-correct-course/workflow.md → xmc-skills/4-implementation/xiaoma-correct-course/SKILL.md} +65 -31
  161. package/src/{xmc/workflows → xmc-skills}/4-implementation/xiaoma-correct-course/checklist.md +2 -2
  162. package/src/xmc-skills/4-implementation/xiaoma-correct-course/customize.toml +41 -0
  163. package/src/{xmc/workflows/4-implementation/xiaoma-create-story/workflow.md → xmc-skills/4-implementation/xiaoma-create-story/SKILL.md} +60 -11
  164. package/src/xmc-skills/4-implementation/xiaoma-create-story/customize.toml +41 -0
  165. package/src/xmc-skills/4-implementation/xiaoma-create-story/references/headless.md +32 -0
  166. package/src/{xmc/workflows/4-implementation/xiaoma-dev-story/workflow.md → xmc-skills/4-implementation/xiaoma-dev-story/SKILL.md} +70 -20
  167. package/src/xmc-skills/4-implementation/xiaoma-dev-story/customize.toml +41 -0
  168. package/src/xmc-skills/4-implementation/xiaoma-investigate/SKILL.md +196 -0
  169. package/src/xmc-skills/4-implementation/xiaoma-investigate/customize.toml +62 -0
  170. package/src/xmc-skills/4-implementation/xiaoma-investigate/references/case-file-template.md +127 -0
  171. package/src/{xmc/workflows/xiaoma-qa-generate-e2e-tests/workflow.md → xmc-skills/4-implementation/xiaoma-qa-generate-e2e-tests/SKILL.md} +51 -23
  172. package/src/{xmc/workflows → xmc-skills/4-implementation}/xiaoma-qa-generate-e2e-tests/checklist.md +1 -5
  173. package/src/xmc-skills/4-implementation/xiaoma-qa-generate-e2e-tests/customize.toml +41 -0
  174. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/SKILL.md +111 -0
  175. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/compile-epic-context.md +62 -0
  176. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/customize.toml +41 -0
  177. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/spec-template.md +88 -0
  178. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/step-01-clarify-and-route.md +100 -0
  179. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/step-02-plan.md +47 -0
  180. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/step-03-implement.md +41 -0
  181. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/step-04-review.md +50 -0
  182. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/step-05-present.md +78 -0
  183. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/step-oneshot.md +71 -0
  184. package/src/xmc-skills/4-implementation/xiaoma-quick-dev/sync-sprint-status.md +19 -0
  185. package/src/{xmc/workflows/4-implementation/xiaoma-retrospective/workflow.md → xmc-skills/4-implementation/xiaoma-retrospective/SKILL.md} +185 -152
  186. package/src/xmc-skills/4-implementation/xiaoma-retrospective/customize.toml +41 -0
  187. package/src/{xmc/workflows/4-implementation/xiaoma-sprint-planning/workflow.md → xmc-skills/4-implementation/xiaoma-sprint-planning/SKILL.md} +59 -15
  188. package/src/xmc-skills/4-implementation/xiaoma-sprint-planning/customize.toml +41 -0
  189. package/src/xmc-skills/4-implementation/xiaoma-sprint-planning/references/headless.md +28 -0
  190. package/src/{xmc/workflows → xmc-skills}/4-implementation/xiaoma-sprint-planning/sprint-status-template.yaml +3 -3
  191. package/src/{xmc/workflows/4-implementation/xiaoma-sprint-status/workflow.md → xmc-skills/4-implementation/xiaoma-sprint-status/SKILL.md} +57 -20
  192. package/src/xmc-skills/4-implementation/xiaoma-sprint-status/customize.toml +41 -0
  193. package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/checklist.md +6 -0
  194. package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/steps/step-01-init-and-validate.md +28 -4
  195. package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/steps/step-02-run-requirements-pipeline.md +2 -1
  196. package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/steps/step-03-bridge-sprint-planning.md +63 -9
  197. package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/steps/step-04-run-story-pipeline.md +2 -1
  198. package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/steps/step-05-finalize.md +30 -3
  199. package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/workflow.md +7 -8
  200. package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/checklist.md +4 -0
  201. package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/steps/step-01-init-and-validate.md +8 -7
  202. package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/steps/step-02-create-epics.md +3 -2
  203. package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/steps/step-03-bridge-sprint-planning.md +68 -14
  204. package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/steps/step-04-batch-create-stories.md +6 -5
  205. package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/steps/step-05-finalize.md +48 -8
  206. package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/workflow.md +7 -8
  207. package/src/xmc-skills/module-help.csv +32 -0
  208. package/src/xmc-skills/module.yaml +95 -0
  209. package/src/xpm-skills/module-help.csv +3 -0
  210. package/src/xpm-skills/module.yaml +36 -0
  211. package/src/xpm-skills/xiaoma-agent-patent-advisor/SKILL.md +75 -0
  212. package/src/xpm-skills/xiaoma-agent-patent-advisor/customize.toml +46 -0
  213. package/src/xpm-skills/xiaoma-patent-mining/SKILL.md +6 -0
  214. package/src/xpm-skills/xiaoma-patent-mining/steps/step-01-project-analysis.md +65 -0
  215. package/src/xpm-skills/xiaoma-patent-mining/steps/step-02-patent-mining.md +87 -0
  216. package/src/xpm-skills/xiaoma-patent-mining/steps/step-03-disclosure-writing.md +110 -0
  217. package/src/xpm-skills/xiaoma-patent-mining/steps/step-04-ai-taste-removal.md +85 -0
  218. package/src/xpm-skills/xiaoma-patent-mining/steps/step-05-docx-generation.md +111 -0
  219. package/src/xpm-skills/xiaoma-patent-mining/workflow.md +94 -0
  220. package/tools/format-workflow-md.js +263 -0
  221. package/tools/{cli → installer}/README.md +2 -2
  222. package/tools/installer/cli-utils.js +57 -0
  223. package/tools/installer/commands/install.js +146 -0
  224. package/tools/{cli → installer}/commands/status.js +15 -7
  225. package/tools/{cli → installer}/commands/uninstall.js +7 -7
  226. package/tools/installer/core/config.js +73 -0
  227. package/tools/installer/core/existing-install.js +121 -0
  228. package/tools/installer/core/install-paths.js +132 -0
  229. package/tools/installer/core/installer.js +1624 -0
  230. package/tools/installer/core/legacy-warnings.js +156 -0
  231. package/tools/installer/core/manifest-generator.js +859 -0
  232. package/tools/installer/core/manifest.js +434 -0
  233. package/tools/{cli/lib → installer}/file-ops.js +1 -1
  234. package/tools/installer/fs-native.js +116 -0
  235. package/tools/installer/ide/_config-driven.js +972 -0
  236. package/tools/{cli/installers/lib → installer}/ide/manager.js +82 -62
  237. package/tools/installer/ide/platform-codes.js +80 -0
  238. package/tools/installer/ide/platform-codes.yaml +322 -0
  239. package/tools/installer/ide/shared/installed-skills.js +50 -0
  240. package/tools/{cli/installers/lib → installer}/ide/shared/path-utils.js +0 -145
  241. package/tools/{cli/installers/lib → installer}/ide/shared/skill-manifest.js +3 -36
  242. package/tools/installer/list-options.js +210 -0
  243. package/tools/{cli/installers/lib → installer}/message-loader.js +3 -3
  244. package/tools/installer/modules/channel-plan.js +203 -0
  245. package/tools/installer/modules/channel-resolver.js +241 -0
  246. package/tools/installer/modules/custom-module-manager.js +912 -0
  247. package/tools/installer/modules/external-manager.js +533 -0
  248. package/tools/installer/modules/module-help-schema.js +13 -0
  249. package/tools/{cli/installers/lib/core/config-collector.js → installer/modules/official-modules.js} +1052 -110
  250. package/tools/installer/modules/plugin-resolver.js +398 -0
  251. package/tools/installer/modules/version-resolver.js +336 -0
  252. package/tools/installer/project-root.js +230 -0
  253. package/tools/{cli/lib → installer}/prompts.js +143 -100
  254. package/tools/installer/set-overrides.js +330 -0
  255. package/tools/installer/ui.js +2078 -0
  256. package/tools/{cli → installer}/xiaoma-cli.js +9 -10
  257. package/tools/{cli/lib → installer}/yaml-format.js +1 -1
  258. package/tools/migrate-custom-module-paths.js +124 -0
  259. package/tools/schema/step.js +855 -0
  260. package/tools/skill-validator.md +323 -0
  261. package/tools/validate-file-refs.js +566 -0
  262. package/tools/validate-frontmatter-prose-routing.js +334 -0
  263. package/tools/validate-skills.js +702 -0
  264. package/tools/validate-step-schemas.js +401 -0
  265. package/tools/validate-svg-changes.sh +1 -1
  266. package/tools/validate-trigger-column-vs-emits.js +375 -0
  267. package/tools/validate-warnings-samples.js +261 -0
  268. package/tools/xiaoma/rebrand.mjs +0 -0
  269. package/tools/xiaoma-npx-wrapper.js +2 -2
  270. package/.playwright-cli/console-2026-05-13T06-36-26-793Z.log +0 -2
  271. package/.playwright-cli/page-2026-05-13T06-36-27-725Z.yml +0 -1
  272. package/CLAUDE.md +0 -111
  273. package/README.md +0 -128
  274. package/XiaoMa-CLI-2026H2-/350/277/255/344/273/243/350/247/204/345/210/222.pptx +0 -0
  275. package/demo/xiaoma-bug-circle-resolve/SKILL.md +0 -6
  276. package/demo/xiaoma-bug-circle-resolve/workflow.md +0 -254
  277. package/demo/xiaoma-bug-resolve/SKILL.md +0 -6
  278. package/demo/xiaoma-bug-resolve/workflow.md +0 -269
  279. package/demo/xiaoma-prd-saas-zh/README.md +0 -57
  280. package/demo/xiaoma-prd-saas-zh/domain-research.md +0 -128
  281. package/demo/xiaoma-prd-saas-zh/epics.md +0 -303
  282. package/demo/xiaoma-prd-saas-zh/market-research-2026-q1.md +0 -183
  283. package/demo/xiaoma-prd-saas-zh/prd-bad-examples.md +0 -268
  284. package/demo/xiaoma-prd-saas-zh/prd.md +0 -409
  285. package/demo/xiaoma-prd-saas-zh/product-brief.md +0 -97
  286. package/demo/xiaoma-prd-saas-zh/validation-report.md +0 -279
  287. 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 +0 -189
  288. 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 +0 -464
  289. 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 +0 -334
  290. 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 +0 -1038
  291. 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 +0 -205
  292. 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 +0 -167
  293. package/media/doc1_fig1.png +0 -0
  294. package/media/doc1_fig2.png +0 -0
  295. package/media/doc1_fig3.png +0 -0
  296. package/media/doc1_fig4.png +0 -0
  297. package/media/doc2_fig1.png +0 -0
  298. package/media/doc2_fig2.png +0 -0
  299. package/media/doc2_fig3.png +0 -0
  300. package/media/doc2_fig4.png +0 -0
  301. package/media/doc3_fig1.png +0 -0
  302. package/media/doc3_fig2.png +0 -0
  303. package/media/doc3_fig3.png +0 -0
  304. package/media/doc3_fig4.png +0 -0
  305. package/media/doc4_fig1.png +0 -0
  306. package/media/doc4_fig2.png +0 -0
  307. package/media/doc4_fig3.png +0 -0
  308. package/media/doc5_fig1.png +0 -0
  309. package/media/doc5_fig2.png +0 -0
  310. package/media/doc5_fig3.png +0 -0
  311. package/patent-disclosure-optimized/SKILL.md +0 -416
  312. package/src/core/module-help.csv +0 -11
  313. package/src/core/skills/xiaoma-advanced-elicitation/SKILL.md +0 -6
  314. package/src/core/skills/xiaoma-advanced-elicitation/methods.csv +0 -51
  315. package/src/core/skills/xiaoma-editorial-review-prose/SKILL.md +0 -6
  316. package/src/core/skills/xiaoma-editorial-review-structure/SKILL.md +0 -6
  317. package/src/core/skills/xiaoma-help/SKILL.md +0 -6
  318. package/src/core/skills/xiaoma-help/workflow.md +0 -88
  319. package/src/core/skills/xiaoma-help/xiaoma-skill-manifest.yaml +0 -1
  320. package/src/core/skills/xiaoma-index-docs/SKILL.md +0 -6
  321. package/src/core/skills/xiaoma-index-docs/xiaoma-skill-manifest.yaml +0 -1
  322. package/src/core/skills/xiaoma-party-mode/SKILL.md +0 -6
  323. package/src/core/skills/xiaoma-party-mode/steps/step-01-agent-loading.md +0 -138
  324. package/src/core/skills/xiaoma-party-mode/steps/step-02-discussion-orchestration.md +0 -187
  325. package/src/core/skills/xiaoma-party-mode/steps/step-03-graceful-exit.md +0 -167
  326. package/src/core/skills/xiaoma-party-mode/workflow.md +0 -190
  327. package/src/core/skills/xiaoma-party-mode/xiaoma-skill-manifest.yaml +0 -1
  328. package/src/core/skills/xiaoma-review-adversarial-general/SKILL.md +0 -6
  329. package/src/core/skills/xiaoma-review-adversarial-general/xiaoma-skill-manifest.yaml +0 -1
  330. package/src/core/skills/xiaoma-review-edge-case-hunter/SKILL.md +0 -6
  331. package/src/core/skills/xiaoma-review-edge-case-hunter/xiaoma-skill-manifest.yaml +0 -1
  332. package/src/core/skills/xiaoma-shard-doc/SKILL.md +0 -6
  333. package/src/core/skills/xiaoma-shard-doc/xiaoma-skill-manifest.yaml +0 -1
  334. package/src/core/tasks/xiaoma-create-prd/SKILL.md +0 -6
  335. package/src/core/tasks/xiaoma-create-prd/data/prd-purpose.md +0 -354
  336. package/src/core/tasks/xiaoma-create-prd/data/upstream-input-contract.md +0 -168
  337. package/src/core/tasks/xiaoma-create-prd/steps-c/step-01-init.md +0 -178
  338. package/src/core/tasks/xiaoma-create-prd/steps-c/step-01b-continue.md +0 -161
  339. package/src/core/tasks/xiaoma-create-prd/steps-c/step-02-discovery.md +0 -208
  340. package/src/core/tasks/xiaoma-create-prd/steps-c/step-02b-vision.md +0 -142
  341. package/src/core/tasks/xiaoma-create-prd/steps-c/step-02c-executive-summary.md +0 -158
  342. package/src/core/tasks/xiaoma-create-prd/steps-c/step-03-success.md +0 -214
  343. package/src/core/tasks/xiaoma-create-prd/steps-c/step-04-journeys.md +0 -201
  344. package/src/core/tasks/xiaoma-create-prd/steps-c/step-05-domain.md +0 -194
  345. package/src/core/tasks/xiaoma-create-prd/steps-c/step-06-innovation.md +0 -211
  346. package/src/core/tasks/xiaoma-create-prd/steps-c/step-07-project-type.md +0 -222
  347. package/src/core/tasks/xiaoma-create-prd/steps-c/step-08-scoping.md +0 -216
  348. package/src/core/tasks/xiaoma-create-prd/steps-c/step-09-functional.md +0 -219
  349. package/src/core/tasks/xiaoma-create-prd/steps-c/step-10-nonfunctional.md +0 -230
  350. package/src/core/tasks/xiaoma-create-prd/steps-c/step-11-polish.md +0 -221
  351. package/src/core/tasks/xiaoma-create-prd/steps-c/step-12-complete.md +0 -115
  352. package/src/core/tasks/xiaoma-create-prd/templates/prd-skeleton-reference.md +0 -428
  353. package/src/core/tasks/xiaoma-create-prd/templates/prd-template.md +0 -108
  354. package/src/core/tasks/xiaoma-create-prd/workflow.md +0 -62
  355. package/src/core/tasks/xiaoma-create-prd/xiaoma-skill-manifest.yaml +0 -1
  356. package/src/utility/agent-components/activation-rules.txt +0 -6
  357. package/src/utility/agent-components/activation-steps.txt +0 -14
  358. package/src/utility/agent-components/agent-command-header.md +0 -1
  359. package/src/utility/agent-components/agent.customize.template.yaml +0 -41
  360. package/src/utility/agent-components/handler-action.txt +0 -4
  361. package/src/utility/agent-components/handler-data.txt +0 -5
  362. package/src/utility/agent-components/handler-exec.txt +0 -6
  363. package/src/utility/agent-components/handler-multi.txt +0 -13
  364. package/src/utility/agent-components/handler-tmpl.txt +0 -5
  365. package/src/utility/agent-components/menu-handlers.txt +0 -6
  366. package/src/xmc/agents/analyst.agent.yaml +0 -47
  367. package/src/xmc/agents/architect.agent.yaml +0 -29
  368. package/src/xmc/agents/dev.agent.yaml +0 -38
  369. package/src/xmc/agents/pm.agent.yaml +0 -44
  370. package/src/xmc/agents/qa.agent.yaml +0 -58
  371. package/src/xmc/agents/quick-flow-solo-dev.agent.yaml +0 -36
  372. package/src/xmc/agents/sm.agent.yaml +0 -53
  373. package/src/xmc/agents/tech-writer/tech-writer-sidecar/documentation-standards.md +0 -224
  374. package/src/xmc/agents/tech-writer/tech-writer.agent.yaml +0 -46
  375. package/src/xmc/agents/tech-writer/xiaoma-skill-manifest.yaml +0 -3
  376. package/src/xmc/agents/ux-designer.agent.yaml +0 -27
  377. package/src/xmc/agents/xiaoma-skill-manifest.yaml +0 -39
  378. package/src/xmc/data/project-context-template.md +0 -26
  379. package/src/xmc/module-help.csv +0 -32
  380. package/src/xmc/module.yaml +0 -50
  381. package/src/xmc/teams/default-party.csv +0 -20
  382. package/src/xmc/teams/team-fullstack.yaml +0 -12
  383. package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/steps/step-08-finalize.md +0 -124
  384. package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/workflow.md +0 -107
  385. package/src/xmc/workflows/1-analysis/auto-requirements-pipeline/xiaoma-skill-manifest.yaml +0 -3
  386. package/src/xmc/workflows/1-analysis/research/market-steps/step-01-init.md +0 -182
  387. package/src/xmc/workflows/1-analysis/research/market-steps/step-02-customer-behavior.md +0 -237
  388. package/src/xmc/workflows/1-analysis/research/market-steps/step-03-customer-pain-points.md +0 -249
  389. package/src/xmc/workflows/1-analysis/research/market-steps/step-04-customer-decisions.md +0 -259
  390. package/src/xmc/workflows/1-analysis/research/market-steps/step-05-competitive-analysis.md +0 -177
  391. package/src/xmc/workflows/1-analysis/research/market-steps/step-06-research-completion.md +0 -476
  392. package/src/xmc/workflows/1-analysis/research/xiaoma-domain-research/SKILL.md +0 -6
  393. package/src/xmc/workflows/1-analysis/research/xiaoma-domain-research/workflow.md +0 -49
  394. package/src/xmc/workflows/1-analysis/research/xiaoma-domain-research/xiaoma-skill-manifest.yaml +0 -1
  395. package/src/xmc/workflows/1-analysis/research/xiaoma-market-research/SKILL.md +0 -6
  396. package/src/xmc/workflows/1-analysis/research/xiaoma-market-research/workflow.md +0 -49
  397. package/src/xmc/workflows/1-analysis/research/xiaoma-market-research/xiaoma-skill-manifest.yaml +0 -1
  398. package/src/xmc/workflows/1-analysis/research/xiaoma-technical-research/SKILL.md +0 -6
  399. package/src/xmc/workflows/1-analysis/research/xiaoma-technical-research/research.template.md +0 -29
  400. package/src/xmc/workflows/1-analysis/research/xiaoma-technical-research/workflow.md +0 -50
  401. package/src/xmc/workflows/1-analysis/research/xiaoma-technical-research/xiaoma-skill-manifest.yaml +0 -1
  402. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/SKILL.md +0 -6
  403. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/product-brief.template.md +0 -10
  404. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-01-init.md +0 -170
  405. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-01b-continue.md +0 -158
  406. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-02-vision.md +0 -193
  407. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-03-users.md +0 -196
  408. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-04-metrics.md +0 -199
  409. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-05-scope.md +0 -213
  410. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/steps/step-06-complete.md +0 -159
  411. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/workflow.md +0 -55
  412. package/src/xmc/workflows/1-analysis/xiaoma-create-product-brief/xiaoma-skill-manifest.yaml +0 -1
  413. package/src/xmc/workflows/1-analysis/xiaoma-product-brief-preview/xiaoma-skill-manifest.yaml +0 -1
  414. package/src/xmc/workflows/2-plan-workflows/create-prd/data/domain-complexity.csv +0 -15
  415. package/src/xmc/workflows/2-plan-workflows/create-prd/data/prd-purpose.md +0 -197
  416. package/src/xmc/workflows/2-plan-workflows/create-prd/data/project-types.csv +0 -11
  417. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-01-discovery.md +0 -224
  418. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-02-format-detection.md +0 -191
  419. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-02b-parity-check.md +0 -209
  420. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-03-density-validation.md +0 -174
  421. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-04-brief-coverage-validation.md +0 -214
  422. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-05-measurability-validation.md +0 -228
  423. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-06-traceability-validation.md +0 -217
  424. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-07-implementation-leakage-validation.md +0 -205
  425. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-08-domain-compliance-validation.md +0 -243
  426. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-09-project-type-validation.md +0 -263
  427. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-10-smart-validation.md +0 -209
  428. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-11-holistic-quality-validation.md +0 -264
  429. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-12-completeness-validation.md +0 -242
  430. package/src/xmc/workflows/2-plan-workflows/create-prd/steps-v/step-v-13-report-complete.md +0 -232
  431. package/src/xmc/workflows/2-plan-workflows/create-prd/workflow-validate-prd.md +0 -65
  432. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/SKILL.md +0 -6
  433. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-01-init.md +0 -135
  434. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-01b-continue.md +0 -127
  435. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-02-discovery.md +0 -190
  436. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-03-core-experience.md +0 -217
  437. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-04-emotional-response.md +0 -220
  438. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-05-inspiration.md +0 -235
  439. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-06-design-system.md +0 -253
  440. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-07-defining-experience.md +0 -255
  441. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-08-visual-foundation.md +0 -225
  442. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-09-design-directions.md +0 -225
  443. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-10-user-journeys.md +0 -242
  444. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-11-component-strategy.md +0 -249
  445. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-12-ux-patterns.md +0 -238
  446. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-13-responsive-accessibility.md +0 -265
  447. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/steps/step-14-complete.md +0 -171
  448. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/ux-design-template.md +0 -13
  449. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/workflow.md +0 -36
  450. package/src/xmc/workflows/2-plan-workflows/xiaoma-create-ux-design/xiaoma-skill-manifest.yaml +0 -1
  451. package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/SKILL.md +0 -6
  452. package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-01-discovery.md +0 -242
  453. package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-01b-legacy-conversion.md +0 -204
  454. package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-02-review.md +0 -245
  455. package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-03-edit.md +0 -250
  456. package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/steps-e/step-e-04-complete.md +0 -165
  457. package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/workflow.md +0 -63
  458. package/src/xmc/workflows/2-plan-workflows/xiaoma-edit-prd/xiaoma-skill-manifest.yaml +0 -1
  459. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/SKILL.md +0 -6
  460. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/data/domain-complexity.csv +0 -15
  461. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/data/prd-purpose.md +0 -197
  462. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/data/prd-quality-rubric.csv +0 -14
  463. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/data/project-types.csv +0 -11
  464. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-01-discovery.md +0 -221
  465. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-02-format-detection.md +0 -188
  466. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-02b-parity-check.md +0 -206
  467. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-03-density-validation.md +0 -171
  468. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-04-brief-coverage-validation.md +0 -211
  469. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-05-measurability-validation.md +0 -225
  470. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-06-traceability-validation.md +0 -214
  471. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-07-implementation-leakage-validation.md +0 -202
  472. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-08-domain-compliance-validation.md +0 -240
  473. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-09-project-type-validation.md +0 -260
  474. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-10-smart-validation.md +0 -206
  475. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-11-holistic-quality-validation.md +0 -261
  476. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-12-completeness-validation.md +0 -239
  477. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/steps-v/step-v-13-report-complete.md +0 -229
  478. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/workflow.md +0 -62
  479. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/xiaoma-skill-manifest.yaml +0 -1
  480. package/src/xmc/workflows/3-solutioning/xiaoma-check-implementation-readiness/SKILL.md +0 -6
  481. package/src/xmc/workflows/3-solutioning/xiaoma-check-implementation-readiness/workflow.md +0 -49
  482. package/src/xmc/workflows/3-solutioning/xiaoma-check-implementation-readiness/xiaoma-skill-manifest.yaml +0 -1
  483. package/src/xmc/workflows/3-solutioning/xiaoma-create-architecture/SKILL.md +0 -6
  484. package/src/xmc/workflows/3-solutioning/xiaoma-create-architecture/workflow.md +0 -38
  485. package/src/xmc/workflows/3-solutioning/xiaoma-create-architecture/xiaoma-skill-manifest.yaml +0 -1
  486. package/src/xmc/workflows/3-solutioning/xiaoma-create-epics-and-stories/SKILL.md +0 -6
  487. package/src/xmc/workflows/3-solutioning/xiaoma-create-epics-and-stories/workflow.md +0 -53
  488. package/src/xmc/workflows/3-solutioning/xiaoma-create-epics-and-stories/xiaoma-skill-manifest.yaml +0 -1
  489. package/src/xmc/workflows/4-implementation/auto-story-pipeline/checklist.md +0 -22
  490. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-02-create-story.md +0 -102
  491. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-05-code-review.md +0 -95
  492. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-08-complete-story.md +0 -114
  493. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-09-finalize.md +0 -69
  494. package/src/xmc/workflows/4-implementation/auto-story-pipeline/workflow.md +0 -89
  495. package/src/xmc/workflows/4-implementation/auto-story-pipeline/xiaoma-skill-manifest.yaml +0 -3
  496. package/src/xmc/workflows/4-implementation/xiaoma-code-review/SKILL.md +0 -6
  497. package/src/xmc/workflows/4-implementation/xiaoma-code-review/checklist.md +0 -23
  498. package/src/xmc/workflows/4-implementation/xiaoma-code-review/steps/step-01-gather-context.md +0 -61
  499. package/src/xmc/workflows/4-implementation/xiaoma-code-review/steps/step-02-review.md +0 -41
  500. package/src/xmc/workflows/4-implementation/xiaoma-code-review/steps/step-04-present.md +0 -38
  501. package/src/xmc/workflows/4-implementation/xiaoma-code-review/workflow.md +0 -54
  502. package/src/xmc/workflows/4-implementation/xiaoma-code-review/xiaoma-skill-manifest.yaml +0 -1
  503. package/src/xmc/workflows/4-implementation/xiaoma-correct-course/SKILL.md +0 -6
  504. package/src/xmc/workflows/4-implementation/xiaoma-correct-course/xiaoma-skill-manifest.yaml +0 -1
  505. package/src/xmc/workflows/4-implementation/xiaoma-create-story/SKILL.md +0 -6
  506. package/src/xmc/workflows/4-implementation/xiaoma-create-story/discover-inputs.md +0 -88
  507. package/src/xmc/workflows/4-implementation/xiaoma-create-story/xiaoma-skill-manifest.yaml +0 -1
  508. package/src/xmc/workflows/4-implementation/xiaoma-dev-story/SKILL.md +0 -6
  509. package/src/xmc/workflows/4-implementation/xiaoma-dev-story/xiaoma-skill-manifest.yaml +0 -1
  510. package/src/xmc/workflows/4-implementation/xiaoma-retrospective/SKILL.md +0 -6
  511. package/src/xmc/workflows/4-implementation/xiaoma-retrospective/xiaoma-skill-manifest.yaml +0 -1
  512. package/src/xmc/workflows/4-implementation/xiaoma-sprint-planning/SKILL.md +0 -6
  513. package/src/xmc/workflows/4-implementation/xiaoma-sprint-planning/xiaoma-skill-manifest.yaml +0 -1
  514. package/src/xmc/workflows/4-implementation/xiaoma-sprint-status/SKILL.md +0 -6
  515. package/src/xmc/workflows/4-implementation/xiaoma-sprint-status/xiaoma-skill-manifest.yaml +0 -1
  516. package/src/xmc/workflows/xiaoma-document-project/SKILL.md +0 -6
  517. package/src/xmc/workflows/xiaoma-document-project/workflow.md +0 -27
  518. package/src/xmc/workflows/xiaoma-document-project/xiaoma-skill-manifest.yaml +0 -1
  519. package/src/xmc/workflows/xiaoma-generate-project-context/SKILL.md +0 -6
  520. package/src/xmc/workflows/xiaoma-generate-project-context/workflow.md +0 -43
  521. package/src/xmc/workflows/xiaoma-generate-project-context/xiaoma-skill-manifest.yaml +0 -1
  522. package/src/xmc/workflows/xiaoma-qa-generate-e2e-tests/SKILL.md +0 -6
  523. package/src/xmc/workflows/xiaoma-qa-generate-e2e-tests/xiaoma-skill-manifest.yaml +0 -1
  524. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/SKILL.md +0 -6
  525. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/steps/step-01-mode-detection.md +0 -169
  526. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/steps/step-02-context-gathering.md +0 -114
  527. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/steps/step-03-execute.md +0 -107
  528. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/steps/step-04-self-check.md +0 -107
  529. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/steps/step-05-adversarial-review.md +0 -94
  530. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/steps/step-06-resolve-findings.md +0 -144
  531. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/workflow.md +0 -38
  532. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev/xiaoma-skill-manifest.yaml +0 -1
  533. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-dev-new-preview/xiaoma-skill-manifest.yaml +0 -1
  534. package/src/xmc/workflows/xiaoma-quick-flow/xiaoma-quick-spec/xiaoma-skill-manifest.yaml +0 -1
  535. package/tools/cli/commands/install.js +0 -87
  536. package/tools/cli/external-official-modules.yaml +0 -4
  537. package/tools/cli/installers/lib/core/custom-module-cache.js +0 -260
  538. package/tools/cli/installers/lib/core/dependency-resolver.js +0 -743
  539. package/tools/cli/installers/lib/core/detector.js +0 -223
  540. package/tools/cli/installers/lib/core/ide-config-manager.js +0 -157
  541. package/tools/cli/installers/lib/core/installer.js +0 -3212
  542. package/tools/cli/installers/lib/core/manifest-generator.js +0 -1374
  543. package/tools/cli/installers/lib/core/manifest.js +0 -1040
  544. package/tools/cli/installers/lib/custom/handler.js +0 -358
  545. package/tools/cli/installers/lib/ide/_base-ide.js +0 -673
  546. package/tools/cli/installers/lib/ide/_config-driven.js +0 -1058
  547. package/tools/cli/installers/lib/ide/platform-codes.js +0 -100
  548. package/tools/cli/installers/lib/ide/platform-codes.yaml +0 -321
  549. package/tools/cli/installers/lib/ide/shared/agent-command-generator.js +0 -181
  550. package/tools/cli/installers/lib/ide/shared/module-injections.js +0 -136
  551. package/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js +0 -368
  552. package/tools/cli/installers/lib/ide/shared/workflow-command-generator.js +0 -179
  553. package/tools/cli/installers/lib/ide/shared/xiaoma-artifacts.js +0 -181
  554. package/tools/cli/installers/lib/ide/templates/agent-command-template.md +0 -14
  555. package/tools/cli/installers/lib/ide/templates/combined/antigravity.md +0 -8
  556. package/tools/cli/installers/lib/ide/templates/combined/default-agent.md +0 -15
  557. package/tools/cli/installers/lib/ide/templates/combined/default-task.md +0 -10
  558. package/tools/cli/installers/lib/ide/templates/combined/default-tool.md +0 -10
  559. package/tools/cli/installers/lib/ide/templates/combined/default-workflow.md +0 -6
  560. package/tools/cli/installers/lib/ide/templates/combined/gemini-agent.toml +0 -14
  561. package/tools/cli/installers/lib/ide/templates/combined/gemini-task.toml +0 -11
  562. package/tools/cli/installers/lib/ide/templates/combined/gemini-tool.toml +0 -11
  563. package/tools/cli/installers/lib/ide/templates/combined/gemini-workflow-yaml.toml +0 -16
  564. package/tools/cli/installers/lib/ide/templates/combined/gemini-workflow.toml +0 -14
  565. package/tools/cli/installers/lib/ide/templates/combined/kiro-agent.md +0 -16
  566. package/tools/cli/installers/lib/ide/templates/combined/kiro-task.md +0 -9
  567. package/tools/cli/installers/lib/ide/templates/combined/kiro-tool.md +0 -9
  568. package/tools/cli/installers/lib/ide/templates/combined/kiro-workflow.md +0 -7
  569. package/tools/cli/installers/lib/ide/templates/combined/opencode-agent.md +0 -15
  570. package/tools/cli/installers/lib/ide/templates/combined/opencode-task.md +0 -13
  571. package/tools/cli/installers/lib/ide/templates/combined/opencode-tool.md +0 -13
  572. package/tools/cli/installers/lib/ide/templates/combined/opencode-workflow-yaml.md +0 -16
  573. package/tools/cli/installers/lib/ide/templates/combined/opencode-workflow.md +0 -16
  574. package/tools/cli/installers/lib/ide/templates/combined/rovodev.md +0 -9
  575. package/tools/cli/installers/lib/ide/templates/combined/trae.md +0 -9
  576. package/tools/cli/installers/lib/ide/templates/combined/windsurf-workflow.md +0 -10
  577. package/tools/cli/installers/lib/ide/templates/split/.gitkeep +0 -0
  578. package/tools/cli/installers/lib/modules/external-manager.js +0 -136
  579. package/tools/cli/installers/lib/modules/manager.js +0 -1382
  580. package/tools/cli/lib/activation-builder.js +0 -165
  581. package/tools/cli/lib/agent/compiler.js +0 -516
  582. package/tools/cli/lib/agent/installer.js +0 -680
  583. package/tools/cli/lib/agent/template-engine.js +0 -152
  584. package/tools/cli/lib/agent-analyzer.js +0 -97
  585. package/tools/cli/lib/agent-party-generator.js +0 -194
  586. package/tools/cli/lib/cli-utils.js +0 -182
  587. package/tools/cli/lib/config.js +0 -213
  588. package/tools/cli/lib/platform-codes.js +0 -116
  589. package/tools/cli/lib/project-root.js +0 -77
  590. package/tools/cli/lib/ui.js +0 -1960
  591. package/tools/cli/lib/xml-handler.js +0 -177
  592. package/tools/cli/lib/xml-to-markdown.js +0 -82
  593. package/tools/cli/lib/yaml-xml-builder.js +0 -570
  594. package/tools/platform-codes.yaml +0 -157
  595. package/tools/schema/agent.js +0 -489
  596. 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 +0 -483
  597. 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 +0 -592
  598. 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 +0 -624
  599. 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 +0 -628
  600. 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 +0 -652
  601. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/SKILL.md +0 -0
  602. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/brain-methods.csv +0 -0
  603. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/steps/step-01-session-setup.md +0 -0
  604. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/steps/step-01b-continue.md +0 -0
  605. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/steps/step-02a-user-selected.md +0 -0
  606. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/steps/step-02b-ai-recommended.md +0 -0
  607. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/steps/step-02c-random-selection.md +0 -0
  608. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/steps/step-02d-progressive-flow.md +0 -0
  609. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/steps/step-04-idea-organization.md +0 -0
  610. /package/src/{core/skills → core-skills}/xiaoma-brainstorming/template.md +0 -0
  611. /package/src/{core/skills → core-skills}/xiaoma-distillator/SKILL.md +0 -0
  612. /package/src/{core/skills → core-skills}/xiaoma-distillator/agents/distillate-compressor.md +0 -0
  613. /package/src/{core/skills → core-skills}/xiaoma-distillator/agents/round-trip-reconstructor.md +0 -0
  614. /package/src/{core/skills → core-skills}/xiaoma-distillator/resources/compression-rules.md +0 -0
  615. /package/src/{core/skills → core-skills}/xiaoma-distillator/resources/splitting-strategy.md +0 -0
  616. /package/src/{core/skills → core-skills}/xiaoma-distillator/scripts/tests/test_analyze_sources.py +0 -0
  617. /package/src/{core/skills → core-skills}/xiaoma-distillator/xiaoma-skill-manifest.yaml +0 -0
  618. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-domain-research/domain-steps/step-01-init.md +0 -0
  619. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-domain-research/domain-steps/step-02-domain-analysis.md +0 -0
  620. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-domain-research/domain-steps/step-03-competitive-landscape.md +0 -0
  621. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-domain-research/domain-steps/step-04-regulatory-focus.md +0 -0
  622. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-domain-research/domain-steps/step-05-technical-trends.md +0 -0
  623. /package/src/{xmc/workflows/1-analysis/research → xmc-skills/1-analysis/research/xiaoma-domain-research}/research.template.md +0 -0
  624. /package/src/{xmc/workflows/1-analysis/research/xiaoma-domain-research → xmc-skills/1-analysis/research/xiaoma-market-research}/research.template.md +0 -0
  625. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-market-research/steps/step-01-init.md +0 -0
  626. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-market-research/steps/step-02-customer-behavior.md +0 -0
  627. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-market-research/steps/step-03-customer-pain-points.md +0 -0
  628. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-market-research/steps/step-04-customer-decisions.md +0 -0
  629. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-market-research/steps/step-05-competitive-analysis.md +0 -0
  630. /package/src/{xmc/workflows/1-analysis/research/xiaoma-market-research → xmc-skills/1-analysis/research/xiaoma-technical-research}/research.template.md +0 -0
  631. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-technical-research/technical-steps/step-01-init.md +0 -0
  632. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-technical-research/technical-steps/step-02-technical-overview.md +0 -0
  633. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-technical-research/technical-steps/step-03-integration-patterns.md +0 -0
  634. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-technical-research/technical-steps/step-04-architectural-patterns.md +0 -0
  635. /package/src/{xmc/workflows → xmc-skills}/1-analysis/research/xiaoma-technical-research/technical-steps/step-05-implementation-research.md +0 -0
  636. /package/src/{xmc/workflows/1-analysis/auto-requirements-pipeline → xmc-skills/1-analysis/xiaoma-auto-requirements-pipeline}/SKILL.md +0 -0
  637. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/checklist.md +0 -0
  638. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/documentation-requirements.csv +0 -0
  639. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/instructions.md +0 -0
  640. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/templates/deep-dive-template.md +0 -0
  641. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/templates/index-template.md +0 -0
  642. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/templates/project-overview-template.md +0 -0
  643. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/templates/project-scan-report-schema.json +0 -0
  644. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/templates/source-tree-template.md +0 -0
  645. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/workflows/deep-dive-workflow.md +0 -0
  646. /package/src/{xmc/workflows → xmc-skills/1-analysis}/xiaoma-document-project/workflows/full-scan-workflow.md +0 -0
  647. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/SKILL.md +0 -0
  648. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/agents/artifact-analyzer.md +0 -0
  649. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/agents/opportunity-reviewer.md +0 -0
  650. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/agents/skeptic-reviewer.md +0 -0
  651. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/agents/web-researcher.md +0 -0
  652. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/prompts/contextual-discovery.md +0 -0
  653. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/prompts/draft-and-review.md +0 -0
  654. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/prompts/finalize.md +0 -0
  655. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/prompts/guided-elicitation.md +0 -0
  656. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/resources/brief-template.md +0 -0
  657. /package/src/{xmc/workflows → xmc-skills}/1-analysis/xiaoma-product-brief-preview/xiaoma-manifest.json +0 -0
  658. /package/src/{core/skills/xiaoma-advanced-elicitation → xmc-skills/1-analysis/xiaoma-product-brief-preview}/xiaoma-skill-manifest.yaml +0 -0
  659. /package/src/{core/tasks/xiaoma-create-prd/data → xmc-skills/2-plan-workflows/xiaoma-prd/assets}/domain-complexity.csv +0 -0
  660. /package/src/{core/tasks/xiaoma-create-prd/data → xmc-skills/2-plan-workflows/xiaoma-prd/assets}/project-types.csv +0 -0
  661. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-check-implementation-readiness/steps/step-04-ux-alignment.md +0 -0
  662. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-check-implementation-readiness/steps/step-05-epic-quality-review.md +0 -0
  663. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-check-implementation-readiness/templates/readiness-report-template.md +0 -0
  664. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/architecture-decision-template.md +0 -0
  665. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/data/domain-complexity.csv +0 -0
  666. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/data/project-types.csv +0 -0
  667. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-01-init.md +0 -0
  668. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-01b-continue.md +0 -0
  669. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-02-context.md +0 -0
  670. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-03-starter.md +0 -0
  671. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-04-decisions.md +0 -0
  672. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-05-patterns.md +0 -0
  673. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-architecture/steps/step-06-structure.md +0 -0
  674. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-epics-and-stories/steps/step-01-validate-prerequisites.md +0 -0
  675. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-epics-and-stories/steps/step-03-create-stories.md +0 -0
  676. /package/src/{xmc/workflows → xmc-skills}/3-solutioning/xiaoma-create-epics-and-stories/templates/epics-template.md +0 -0
  677. /package/src/{xmc/workflows → xmc-skills/3-solutioning}/xiaoma-generate-project-context/project-context-template.md +0 -0
  678. /package/src/{xmc/workflows → xmc-skills/3-solutioning}/xiaoma-generate-project-context/steps/step-01-discover.md +0 -0
  679. /package/src/{xmc/workflows → xmc-skills/3-solutioning}/xiaoma-generate-project-context/steps/step-02-generate.md +0 -0
  680. /package/src/{xmc/workflows/4-implementation/auto-story-pipeline → xmc-skills/4-implementation/xiaoma-auto-story-pipeline}/SKILL.md +0 -0
  681. /package/src/{xmc/workflows → xmc-skills}/4-implementation/xiaoma-create-story/checklist.md +0 -0
  682. /package/src/{xmc/workflows/4-implementation/xiaoma-code-review → xmc-skills/4-implementation/xiaoma-create-story}/discover-inputs.md +0 -0
  683. /package/src/{xmc/workflows → xmc-skills}/4-implementation/xiaoma-create-story/template.md +0 -0
  684. /package/src/{xmc/workflows → xmc-skills}/4-implementation/xiaoma-dev-story/checklist.md +0 -0
  685. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-dev-new-preview/SKILL.md +0 -0
  686. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-dev-new-preview/steps/step-01-clarify-and-route.md +0 -0
  687. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-dev-new-preview/steps/step-02-plan.md +0 -0
  688. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-dev-new-preview/steps/step-03-implement.md +0 -0
  689. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-dev-new-preview/steps/step-04-review.md +0 -0
  690. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-dev-new-preview/steps/step-05-present.md +0 -0
  691. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-dev-new-preview/tech-spec-template.md +0 -0
  692. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-dev-new-preview/workflow.md +0 -0
  693. /package/src/{core/skills/xiaoma-brainstorming → xmc-skills/4-implementation/xiaoma-quick-dev-new-preview}/xiaoma-skill-manifest.yaml +0 -0
  694. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-spec/SKILL.md +0 -0
  695. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-spec/steps/step-01-understand.md +0 -0
  696. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-spec/steps/step-02-investigate.md +0 -0
  697. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-spec/steps/step-03-generate.md +0 -0
  698. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-spec/steps/step-04-review.md +0 -0
  699. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-spec/tech-spec-template.md +0 -0
  700. /package/src/{xmc/workflows/xiaoma-quick-flow → xmc-skills/4-implementation}/xiaoma-quick-spec/workflow.md +0 -0
  701. /package/src/{core/skills/xiaoma-editorial-review-prose → xmc-skills/4-implementation/xiaoma-quick-spec}/xiaoma-skill-manifest.yaml +0 -0
  702. /package/src/{xmc/workflows → xmc-skills}/4-implementation/xiaoma-sprint-planning/checklist.md +0 -0
  703. /package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/SKILL.md +0 -0
  704. /package/src/{xmc/workflows/5-full-pipeline/auto-full-pipeline → xmc-skills/5-full-pipeline/xiaoma-auto-full-pipeline}/xiaoma-skill-manifest.yaml +0 -0
  705. /package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/SKILL.md +0 -0
  706. /package/src/{xmc/workflows/5-full-pipeline/auto-prd-to-stories → xmc-skills/5-full-pipeline/xiaoma-auto-prd-to-stories}/xiaoma-skill-manifest.yaml +0 -0
  707. /package/{patent-disclosure-optimized → src/xpm-skills/xiaoma-patent-mining}/references/disclosure-template.md +0 -0
  708. /package/{patent-disclosure-optimized → src/xpm-skills/xiaoma-patent-mining}/references/docx-format-spec.md +0 -0
  709. /package/{patent-disclosure-optimized → src/xpm-skills/xiaoma-patent-mining}/references/mining-principles.md +0 -0
  710. /package/{patent-disclosure-optimized → src/xpm-skills/xiaoma-patent-mining}/scripts/md2docx.js +0 -0
  711. /package/src/{core/skills/xiaoma-editorial-review-structure → xpm-skills/xiaoma-patent-mining}/xiaoma-skill-manifest.yaml +0 -0
  712. /package/tools/{cli/installers → installer}/install-messages.yaml +0 -0
@@ -0,0 +1,855 @@
1
+ // Zod schema definition for step file frontmatter inside auto-* pipelines.
2
+ //
3
+ // Scope: this schema validates the YAML frontmatter of step files under the five
4
+ // auto-* pipelines (auto-requirements-pipeline, auto-story-pipeline,
5
+ // auto-prd-to-stories, auto-full-pipeline; auto-story-pipeline-batch has no step
6
+ // files). E1 (run #3 in pipeline-optimization-report.md) cleaned these up so every
7
+ // such step file carries only `name`, `description`, `nextStepFile`, and the
8
+ // conditional `nextStepFile_*` / `altStepFile` variants. N1 ratifies that cleanup
9
+ // as a strict machine-checkable lint.
10
+ //
11
+ // Out of scope: step files under src/core/tasks/xiaoma-create-prd/ and under
12
+ // src/xmc/workflows/xiaoma-quick-flow/ carry many additional context-binding keys
13
+ // (prdFile, validationReportPath, outputFile, wipFile, …). Those pipelines are not
14
+ // of the auto-* family and intentionally use a richer (open) frontmatter shape.
15
+ // Run the validator only against PIPELINE_ROOTS in tools/validate-step-schemas.js.
16
+ //
17
+ // P1 (run #14) — optional `kind` field: lets each step file self-describe its
18
+ // role in the pipeline (`init` / `analysis` / `orchestrator` / `quality-gate` /
19
+ // `finalize` / `terminal`). Strictly optional; absence means "unclassified".
20
+ // Downstream consumers (future status-JSON aggregator, dashboards) can group
21
+ // or filter by kind without re-parsing the file body. Adding a new kind value
22
+ // requires editing both the KIND_VALUES list below and the matching
23
+ // test/test-step-schema.js positive case so coverage stays aligned.
24
+ //
25
+ // R1 (run #16) — extended the enum with two structural values that were
26
+ // previously rolled under `orchestrator`:
27
+ // * `loop` — self-referencing iteration step that calls itself via
28
+ // `nextStepFile_loop` (e.g. step-07-fix-and-retest in
29
+ // auto-story-pipeline). Distinct from generic `orchestrator`
30
+ // because dashboards visualizing pipeline shape care about
31
+ // "this step can re-enter itself".
32
+ // * `bridge` — cross-phase glue step that runs an out-of-band workflow
33
+ // (sprint-planning) to wire one pipeline's output into the
34
+ // next pipeline's input (e.g. step-03-bridge-sprint-planning
35
+ // in auto-full-pipeline and auto-prd-to-stories). Distinct
36
+ // from `orchestrator` because bridge failures need
37
+ // bridge-failure.json handling and resume semantics that pure
38
+ // orchestrator steps don't.
39
+ // Loop/bridge classification is purely opt-in; existing `orchestrator`
40
+ // callers remain valid. The unit test's `for (const kindValue of KIND_VALUES)`
41
+ // loop automatically gains positive coverage for the new values.
42
+ //
43
+ // S2 (run #17) — structural pipeline-shape invariant: a `bridge` step must
44
+ // never be the first or last step in its pipeline. Rationale: a bridge step
45
+ // by definition glues two phases together, so it must have at least one
46
+ // pipeline step on each side (a producer feeding it, and a consumer reading
47
+ // its output). The auto-full-pipeline and auto-prd-to-stories pipelines
48
+ // both already satisfy this naturally (their bridge sits at position 3 of
49
+ // 5). The invariant is enforced by `verifyPipelineKindInvariants` below
50
+ // and run from the CI walker per pipeline.
51
+ //
52
+ // T1 (run #18) — three more structural rules added to
53
+ // `verifyPipelineKindInvariants`, closing proposal S3 from run #17 §7:
54
+ //
55
+ // * `init-position` — a step whose `kind === 'init'` must be at
56
+ // index 0 of its pipeline. An init step is the
57
+ // entry point; placing it elsewhere is almost
58
+ // always a typo (e.g. wrong kind tag) and
59
+ // breaks the assumed pipeline shape.
60
+ // * `terminal-position` — a step whose `kind === 'terminal'` must be at
61
+ // the last index of its pipeline. Mirror of
62
+ // init-position for the exit side.
63
+ // * `init-uniqueness` — at most one step per pipeline may carry
64
+ // `kind: 'init'`. A second init is reported
65
+ // with its name + position so operators can
66
+ // relabel the duplicate.
67
+ // * `terminal-uniqueness` — at most one step per pipeline may carry
68
+ // `kind: 'terminal'`. Mirror of init-uniqueness.
69
+ //
70
+ // Like the S2 bridge-position rule, all four rules silently skip steps
71
+ // whose `kind` is absent (the unclassified bucket), so opt-out remains
72
+ // safe. All four live auto-* pipelines already satisfy every rule (init at
73
+ // index 0 / terminal at last index / exactly one of each), so adoption is
74
+ // a no-op + pure regression defence.
75
+ //
76
+ // U1 / U2 (run #19) — two more structural rules added to
77
+ // `verifyPipelineKindInvariants`, closing proposals T2 + T3 from run #18 §7:
78
+ //
79
+ // * `loop-self-reference` (U1) — a step whose `kind === 'loop'` must
80
+ // declare `nextStepFile_loop` pointing at
81
+ // itself (`./<name>.md`). A loop step's
82
+ // defining property is the ability to
83
+ // re-enter itself; if the self-reference
84
+ // is missing or routes elsewhere, the
85
+ // `loop` annotation is a lie. The only
86
+ // live `loop` step (auto-story-pipeline /
87
+ // step-07-fix-and-retest) already satisfies
88
+ // this naturally. To enforce this rule the
89
+ // pipeline-shape descriptor was widened
90
+ // from `{ name, kind }` to also carry
91
+ // `nextStepFile_loop` — descriptors
92
+ // remain backward-compatible when the
93
+ // field is absent.
94
+ // * `analysis-position` (U2) — every step whose `kind === 'analysis'`
95
+ // must appear at a strictly smaller index
96
+ // than every step whose `kind ===
97
+ // 'orchestrator'` in the same pipeline.
98
+ // Rationale: the analysis phase produces
99
+ // the inputs that orchestrator steps
100
+ // consume; placing analysis after
101
+ // orchestrator leaves the latter running
102
+ // against incomplete state. Currently
103
+ // only `auto-requirements-pipeline` has
104
+ // any `analysis` steps; the other three
105
+ // auto-* pipelines have none, so the rule
106
+ // is a no-op for them.
107
+ //
108
+ // Both rules silently skip unclassified steps (mirror of S2 / T1
109
+ // behaviour) so opt-out remains safe.
110
+ //
111
+ // V1 / V2 (run #20) — two more structural rules added to
112
+ // `verifyPipelineKindInvariants`, closing proposal U3 from run #19 §7 and
113
+ // adding the natural uniqueness companion for the `finalize` kind:
114
+ //
115
+ // * `quality-gate-predecessor` (V1) — a step whose `kind === 'quality-gate'`
116
+ // must have an immediate predecessor
117
+ // whose `kind` (if classified) is one
118
+ // of {analysis, orchestrator, loop,
119
+ // bridge, quality-gate}. Equivalently:
120
+ // a quality-gate cannot be the first
121
+ // step in its pipeline, and its
122
+ // predecessor cannot be `init`,
123
+ // `finalize`, or `terminal`. Chaining
124
+ // quality-gates is explicitly allowed
125
+ // (mirrors auto-story-pipeline's
126
+ // code-review → test-story shape where
127
+ // step-06 follows step-05, both gates).
128
+ // Unclassified predecessors are
129
+ // treated as "non-violating" (the rule
130
+ // only fires against known-bad kinds)
131
+ // so opt-out adoption stays safe.
132
+ // * `finalize-uniqueness` (V2) — at most one step per pipeline may
133
+ // carry `kind: 'finalize'`. Mirror of
134
+ // init-uniqueness / terminal-uniqueness
135
+ // from T1 (run #18). Only
136
+ // auto-story-pipeline has any
137
+ // `finalize` step today
138
+ // (step-08-complete-story); the rule
139
+ // is a no-op for the other three
140
+ // auto-* pipelines.
141
+ //
142
+ // Both rules silently skip unclassified steps to preserve P1's opt-in
143
+ // adoption contract. All four live auto-* pipelines satisfy both rules
144
+ // (every live quality-gate's predecessor is orchestrator or quality-gate;
145
+ // the single live finalize step is unique).
146
+
147
+ const fs = require('node:fs');
148
+ const path = require('node:path');
149
+ const { z } = require('zod');
150
+
151
+ // nextStepFile (and its conditional variants) must point to a sibling step file
152
+ // using a relative `./step-NN-<kebab>.md` form, or be `null` for the terminal
153
+ // step in the pipeline. The `null` form is reserved for nextStepFile itself —
154
+ // conditional variants either point to a sibling step or are absent.
155
+ const STEP_REF_PATTERN = /^\.\/step-\d{2}[a-z]?-[a-z0-9]+(?:-[a-z0-9]+)*\.md$/;
156
+ const NAME_PATTERN = /^step-\d{2}[a-z]?-[a-z0-9]+(?:-[a-z0-9]+)*$/;
157
+
158
+ // nextStepFile: required, string matching STEP_REF_PATTERN or explicit null for
159
+ // terminal steps. We accept null only for nextStepFile (not the variants).
160
+ const nextStepFileSchema = z.union([
161
+ z.string().regex(STEP_REF_PATTERN, 'must be "./step-NN-<kebab>.md" or null for terminal steps'),
162
+ z.null(),
163
+ ]);
164
+
165
+ // Conditional next-step variants — must be a string pointing to a sibling step
166
+ // when present; cannot be null (null implies "terminate the pipeline", and
167
+ // conditional branches that want to terminate should simply omit the key).
168
+ const conditionalStepFileSchema = z
169
+ .string()
170
+ .regex(STEP_REF_PATTERN, 'must be "./step-NN-<kebab>.md" (null not allowed on conditional variants)');
171
+
172
+ // P1 (run #14) / R1 (run #16) — enumerated values for the optional `kind`
173
+ // field. Order is rough lifecycle order (init → analysis → orchestrator →
174
+ // loop → bridge → quality-gate → finalize → terminal) but the schema only
175
+ // validates set membership, not ordering. Each value is described in the
176
+ // tools/schema/step.js header comment above.
177
+ const KIND_VALUES = ['init', 'analysis', 'orchestrator', 'loop', 'bridge', 'quality-gate', 'finalize', 'terminal'];
178
+
179
+ const stepFrontmatterSchema = z
180
+ .object({
181
+ name: z.string().regex(NAME_PATTERN, 'must be kebab-case "step-NN-<words>" (matching the file basename without .md)'),
182
+ description: z.string().min(1, 'description must be a non-empty string'),
183
+ nextStepFile: nextStepFileSchema,
184
+
185
+ // Conditional routing variants — all optional, all pointing at a sibling step.
186
+ // We enumerate the four currently-in-use variants and the generic altStepFile.
187
+ // New variants can be added here when introduced.
188
+ nextStepFile_loop: conditionalStepFileSchema.optional(),
189
+ nextStepFile_issues: conditionalStepFileSchema.optional(),
190
+ nextStepFile_fail: conditionalStepFileSchema.optional(),
191
+ nextStepFile_skip: conditionalStepFileSchema.optional(),
192
+ altStepFile: conditionalStepFileSchema.optional(),
193
+
194
+ // P1 (run #14) — optional step-role tag. Absence means "unclassified" and
195
+ // is backward-compatible with every existing step file (all 27 live files
196
+ // remain valid without modification). Adding a new permitted value here
197
+ // requires updating KIND_VALUES above and the matching unit-test case.
198
+ kind: z.enum(KIND_VALUES, { errorMap: () => ({ message: `kind must be one of: ${KIND_VALUES.join(', ')}` }) }).optional(),
199
+ })
200
+ .strict();
201
+
202
+ /**
203
+ * Validate the YAML frontmatter object of an auto-* pipeline step file.
204
+ *
205
+ * Performs structural Zod validation plus one cross-check: the `name` field
206
+ * must equal the file basename (without the .md extension). This catches the
207
+ * common drift where a step is renamed on disk but the frontmatter `name`
208
+ * value is left stale.
209
+ *
210
+ * @param {string} filePath Absolute or relative path to the step .md file.
211
+ * @param {unknown} frontmatter Parsed YAML frontmatter object.
212
+ * @returns {import('zod').SafeParseReturnType<unknown, unknown>} SafeParse result.
213
+ */
214
+ function validateStepFrontmatter(filePath, frontmatter) {
215
+ const baseName = path.basename(filePath, '.md');
216
+
217
+ // First pass: structural validation.
218
+ const structural = stepFrontmatterSchema.safeParse(frontmatter);
219
+ if (!structural.success) {
220
+ return structural;
221
+ }
222
+
223
+ // Second pass: name-vs-filename cross-check.
224
+ if (structural.data.name !== baseName) {
225
+ return {
226
+ success: false,
227
+ error: new z.ZodError([
228
+ {
229
+ code: 'custom',
230
+ path: ['name'],
231
+ message: `frontmatter name "${structural.data.name}" does not match file basename "${baseName}"`,
232
+ },
233
+ ]),
234
+ };
235
+ }
236
+
237
+ return structural;
238
+ }
239
+
240
+ /**
241
+ * Verify that every `nextStepFile*` / `altStepFile` reference in `frontmatter`
242
+ * points to a sibling step file that exists on disk.
243
+ *
244
+ * The Zod schema in this same module validates the *shape* of the reference
245
+ * (the STEP_REF_PATTERN regex); this routine validates that the target also
246
+ * exists on the filesystem. Splitting the two checks lets the schema stay a
247
+ * pure data validator while reference existence stays a filesystem concern
248
+ * shared by both the CI walker (tools/validate-step-schemas.js) and the unit
249
+ * tests (test/test-step-schema.js — O1).
250
+ *
251
+ * Keys checked: any key that starts with `nextStepFile` (covers `nextStepFile`
252
+ * itself plus `nextStepFile_loop` / `_issues` / `_fail` / `_skip` and any
253
+ * future variants without code changes), and `altStepFile`. Non-string values
254
+ * (e.g. `null` on the terminal step's `nextStepFile`) are skipped.
255
+ *
256
+ * @param {string} stepDirAbsolute Absolute path to the directory holding the
257
+ * step file. The function resolves each reference as `path.join(stepDirAbsolute, value)`.
258
+ * @param {object} frontmatter Parsed YAML frontmatter (typically already
259
+ * accepted by validateStepFrontmatter, but the function does not require it).
260
+ * @returns {{ key: string, value: string, targetAbsolute: string }[]} List of
261
+ * broken references; empty array when all references resolve. Each entry
262
+ * carries the original frontmatter key, the literal value, and the absolute
263
+ * path that was looked up — callers can render relative paths against any
264
+ * chosen project root.
265
+ */
266
+ function verifyStepReferences(stepDirAbsolute, frontmatter) {
267
+ const issues = [];
268
+
269
+ if (frontmatter === null || typeof frontmatter !== 'object') {
270
+ return issues;
271
+ }
272
+
273
+ for (const [key, value] of Object.entries(frontmatter)) {
274
+ if (!key.startsWith('nextStepFile') && key !== 'altStepFile') continue;
275
+ if (value === null || value === undefined) continue;
276
+ if (typeof value !== 'string') continue;
277
+ if (!value.startsWith('./')) continue;
278
+
279
+ const targetAbsolute = path.join(stepDirAbsolute, value);
280
+ if (!fs.existsSync(targetAbsolute)) {
281
+ issues.push({ key, value, targetAbsolute });
282
+ }
283
+ }
284
+
285
+ return issues;
286
+ }
287
+
288
+ /**
289
+ * Verify pipeline-shape invariants over an ordered list of step descriptors.
290
+ *
291
+ * Currently checks nine structural rules:
292
+ *
293
+ * * `bridge-position` (S2, run #17) — a step whose `kind === 'bridge'`
294
+ * must not be the first step (index 0) or the last step (index
295
+ * length-1) in its pipeline. A bridge by definition needs at least one
296
+ * producing step before it and at least one consuming step after it.
297
+ * * `init-position` (T1, run #18) — a step whose `kind === 'init'` must
298
+ * be at index 0. Init steps initialize state for the whole pipeline,
299
+ * so placing one in the middle leaves earlier steps running against
300
+ * uninitialized state.
301
+ * * `terminal-position` (T1, run #18) — a step whose `kind === 'terminal'`
302
+ * must be at the last index. Mirror of init-position for the exit side.
303
+ * * `init-uniqueness` (T1, run #18) — at most one step per pipeline may
304
+ * carry `kind: 'init'`. A duplicate is reported with its name + index
305
+ * so the operator knows which one to relabel.
306
+ * * `terminal-uniqueness` (T1, run #18) — at most one step per pipeline
307
+ * may carry `kind: 'terminal'`. Mirror of init-uniqueness.
308
+ * * `loop-self-reference` (U1, run #19) — a step whose `kind === 'loop'`
309
+ * must declare `nextStepFile_loop` pointing at itself (canonical form
310
+ * `./<name>.md`). A loop step's defining property is the ability to
311
+ * re-enter itself via the `_loop` conditional branch; a missing or
312
+ * foreign-target self-reference makes the `loop` annotation a lie.
313
+ * * `analysis-position` (U2, run #19) — every step whose
314
+ * `kind === 'analysis'` must appear at a strictly smaller index than
315
+ * every step whose `kind === 'orchestrator'` in the same pipeline.
316
+ * Equivalent statement: once a pipeline reaches its first orchestrator
317
+ * step, no later analysis step may appear. The rule is reported
318
+ * against the offending analysis step, with the position of the first
319
+ * orchestrator in the message for context.
320
+ * * `quality-gate-predecessor` (V1, run #20) — a step whose
321
+ * `kind === 'quality-gate'` must have an immediate predecessor whose
322
+ * `kind` (if classified) is one of {analysis, orchestrator, loop,
323
+ * bridge, quality-gate}. A quality-gate validates productive work; it
324
+ * makes no sense to gate the output of `init` (nothing produced yet),
325
+ * `finalize` (the pipeline is wrapping up), or `terminal` (the next
326
+ * index doesn't exist). Quality-gate at index 0 also fails (no
327
+ * predecessor exists). Chaining quality-gates is allowed (mirrors
328
+ * auto-story-pipeline's code-review → test-story shape). An
329
+ * unclassified predecessor is treated as non-violating to preserve
330
+ * opt-out adoption semantics.
331
+ * * `finalize-uniqueness` (V2, run #20) — at most one step per pipeline
332
+ * may carry `kind: 'finalize'`. Mirror of init-uniqueness /
333
+ * terminal-uniqueness. A second finalize step is reported with its
334
+ * name + index so the operator knows which one to relabel.
335
+ *
336
+ * The function is intentionally `kind`-aware but stays agnostic about which
337
+ * specific names (`step-NN-...`) carry which kinds — callers feed in an
338
+ * ordered list and the function reports issues by position + name. Steps
339
+ * without a `kind` field (the "unclassified" bucket in the walker histogram)
340
+ * are silently skipped, preserving backward compatibility with any future
341
+ * step file that opts out of the optional enum.
342
+ *
343
+ * Descriptor shape: each entry is `{ name, kind?, nextStepFile_loop? }`.
344
+ * The optional `nextStepFile_loop` is consulted only by the U1 rule; other
345
+ * rules ignore it. Walkers may pass the full frontmatter object — extra
346
+ * keys are simply ignored.
347
+ *
348
+ * Adding a new invariant: extend the issues array in this function and add
349
+ * a matching unit test in test/test-step-schema.js. Possible future
350
+ * candidates (not implemented):
351
+ * * `bridge` step should declare a recovery branch (e.g. `nextStepFile_fail`
352
+ * pointing at a finalize/error path). Deferred from U4 in run #19 §7
353
+ * because the current live bridges (auto-full-pipeline /
354
+ * auto-prd-to-stories step-03-bridge-sprint-planning) use a HALT +
355
+ * bridge-failure.json marker pattern for recovery rather than
356
+ * in-pipeline routing. Enforcing this rule would require a behavioural
357
+ * change to the bridges, not just a documentation lint.
358
+ * * `step_kind` field propagated into the per-pipeline status JSON so
359
+ * downstream dashboards can render pipeline shape without re-parsing
360
+ * step frontmatter. Deferred from U5 in run #19 §7 — needs producer +
361
+ * consumer changes on both sides.
362
+ *
363
+ * @param {{ name: string, kind?: string, nextStepFile_loop?: string }[]}
364
+ * pipelineSteps Ordered list of step descriptors (one pipeline at a time,
365
+ * in file-name order).
366
+ * @returns {{ rule: string, name: string, index: number, message: string }[]}
367
+ * List of invariant violations; empty array when the pipeline is clean.
368
+ */
369
+ function verifyPipelineKindInvariants(pipelineSteps) {
370
+ const issues = [];
371
+
372
+ if (!Array.isArray(pipelineSteps) || pipelineSteps.length === 0) {
373
+ return issues;
374
+ }
375
+
376
+ const lastIndex = pipelineSteps.length - 1;
377
+
378
+ // T1 (run #18) — track first sightings so duplicates can be reported
379
+ // against the original step (helps operators identify which one is the
380
+ // newcomer / typo). V2 (run #20) extends the pattern to `finalize`.
381
+ let firstInit = null;
382
+ let firstTerminal = null;
383
+ let firstFinalize = null;
384
+
385
+ // V1 (run #20) — predecessor-kind allow-list for quality-gate steps.
386
+ // A quality-gate validates productive work, so its immediate predecessor
387
+ // must itself be productive (analysis / orchestrator / loop / bridge) or
388
+ // another quality-gate (allows chaining gates such as code-review →
389
+ // test-story in auto-story-pipeline). Predecessors with no classified
390
+ // `kind` are treated as non-violating to preserve P1's opt-out adoption.
391
+ const QUALITY_GATE_ALLOWED_PREDECESSORS = new Set(['analysis', 'orchestrator', 'loop', 'bridge', 'quality-gate']);
392
+
393
+ // U2 (run #19) — pre-pass: find the index of the first orchestrator step
394
+ // (if any) so the analysis-position rule below can compare against it in
395
+ // O(n) overall. Steps with no `kind` field never count as orchestrators.
396
+ let firstOrchestratorIndex = -1;
397
+ for (const [index, step] of pipelineSteps.entries()) {
398
+ if (step && typeof step === 'object' && step.kind === 'orchestrator') {
399
+ firstOrchestratorIndex = index;
400
+ break;
401
+ }
402
+ }
403
+
404
+ for (const [index, step] of pipelineSteps.entries()) {
405
+ if (!step || typeof step !== 'object') continue;
406
+
407
+ // S2 — bridge-position rule.
408
+ if (step.kind === 'bridge') {
409
+ if (index === 0) {
410
+ issues.push({
411
+ rule: 'bridge-position',
412
+ name: step.name,
413
+ index,
414
+ message: `bridge step "${step.name}" is at index 0 (first position); a bridge needs at least one producing step before it`,
415
+ });
416
+ } else if (index === lastIndex) {
417
+ issues.push({
418
+ rule: 'bridge-position',
419
+ name: step.name,
420
+ index,
421
+ message: `bridge step "${step.name}" is at the last index (${lastIndex}); a bridge needs at least one consuming step after it`,
422
+ });
423
+ }
424
+ }
425
+
426
+ // T1 — init-position + init-uniqueness rules.
427
+ if (step.kind === 'init') {
428
+ if (index !== 0) {
429
+ issues.push({
430
+ rule: 'init-position',
431
+ name: step.name,
432
+ index,
433
+ message: `init step "${step.name}" is at index ${index}; init steps must be at index 0 (pipeline entry point)`,
434
+ });
435
+ }
436
+ if (firstInit === null) {
437
+ firstInit = { name: step.name, index };
438
+ } else {
439
+ issues.push({
440
+ rule: 'init-uniqueness',
441
+ name: step.name,
442
+ index,
443
+ message: `duplicate init step "${step.name}" at index ${index}; first init was "${firstInit.name}" at index ${firstInit.index}`,
444
+ });
445
+ }
446
+ }
447
+
448
+ // T1 — terminal-position + terminal-uniqueness rules.
449
+ if (step.kind === 'terminal') {
450
+ if (index !== lastIndex) {
451
+ issues.push({
452
+ rule: 'terminal-position',
453
+ name: step.name,
454
+ index,
455
+ message: `terminal step "${step.name}" is at index ${index}; terminal steps must be at the last index (${lastIndex})`,
456
+ });
457
+ }
458
+ if (firstTerminal === null) {
459
+ firstTerminal = { name: step.name, index };
460
+ } else {
461
+ issues.push({
462
+ rule: 'terminal-uniqueness',
463
+ name: step.name,
464
+ index,
465
+ message: `duplicate terminal step "${step.name}" at index ${index}; first terminal was "${firstTerminal.name}" at index ${firstTerminal.index}`,
466
+ });
467
+ }
468
+ }
469
+
470
+ // U1 (run #19) — loop-self-reference rule. A `loop` step must declare
471
+ // `nextStepFile_loop` pointing at itself in canonical `./<name>.md` form.
472
+ // Missing self-reference, foreign-target self-reference, or non-string
473
+ // value all surface as a single rule violation against this step.
474
+ if (step.kind === 'loop') {
475
+ const expected = `./${step.name}.md`;
476
+ const actual = step.nextStepFile_loop;
477
+ if (actual !== expected) {
478
+ const detail = actual === undefined ? 'missing' : `"${actual}"`;
479
+ issues.push({
480
+ rule: 'loop-self-reference',
481
+ name: step.name,
482
+ index,
483
+ message: `loop step "${step.name}" must declare nextStepFile_loop: "${expected}" (got ${detail}); a loop step's defining property is the ability to re-enter itself`,
484
+ });
485
+ }
486
+ }
487
+
488
+ // U2 (run #19) — analysis-position rule. An `analysis` step that
489
+ // appears at a strictly larger index than the first `orchestrator`
490
+ // step in the same pipeline violates the "analysis precedes
491
+ // orchestration" contract. Skips silently when the pipeline contains
492
+ // no orchestrator step (e.g. an analysis-only pipeline).
493
+ if (step.kind === 'analysis' && firstOrchestratorIndex !== -1 && index > firstOrchestratorIndex) {
494
+ issues.push({
495
+ rule: 'analysis-position',
496
+ name: step.name,
497
+ index,
498
+ message: `analysis step "${step.name}" is at index ${index}; must precede the first orchestrator step at index ${firstOrchestratorIndex}`,
499
+ });
500
+ }
501
+
502
+ // V1 (run #20) — quality-gate-predecessor rule. A `quality-gate` step
503
+ // gates productive work, so it cannot be the first step (no predecessor
504
+ // to gate) and its immediate predecessor's classified kind must be in
505
+ // QUALITY_GATE_ALLOWED_PREDECESSORS. An unclassified predecessor (no
506
+ // `kind` field) is treated as non-violating to preserve P1's opt-out
507
+ // adoption semantics — the rule fires only against *known-bad* kinds.
508
+ if (step.kind === 'quality-gate') {
509
+ if (index === 0) {
510
+ issues.push({
511
+ rule: 'quality-gate-predecessor',
512
+ name: step.name,
513
+ index,
514
+ message: `quality-gate step "${step.name}" is at index 0 (no predecessor to gate); a quality-gate must follow a productive step`,
515
+ });
516
+ } else {
517
+ const predecessor = pipelineSteps[index - 1];
518
+ const predecessorKind = predecessor && typeof predecessor === 'object' ? predecessor.kind : undefined;
519
+ if (predecessorKind !== undefined && !QUALITY_GATE_ALLOWED_PREDECESSORS.has(predecessorKind)) {
520
+ const allowed = [...QUALITY_GATE_ALLOWED_PREDECESSORS].join(', ');
521
+ issues.push({
522
+ rule: 'quality-gate-predecessor',
523
+ name: step.name,
524
+ index,
525
+ message: `quality-gate step "${step.name}" at index ${index} follows "${predecessor.name}" (kind=${predecessorKind}); predecessor kind must be one of: ${allowed}`,
526
+ });
527
+ }
528
+ }
529
+ }
530
+
531
+ // V2 (run #20) — finalize-uniqueness rule. Mirror of init-uniqueness /
532
+ // terminal-uniqueness from T1. The duplicate is reported against the
533
+ // second sighting so operators can identify the newcomer to relabel.
534
+ // Note: there is intentionally no `finalize-position` rule — a
535
+ // `finalize` step's position is governed by pipeline-specific design
536
+ // (auto-story-pipeline places it at lastIndex-1, immediately before
537
+ // its `terminal` step), and over-constraining it would block future
538
+ // pipelines that legitimately want finalize at a different position.
539
+ if (step.kind === 'finalize') {
540
+ if (firstFinalize === null) {
541
+ firstFinalize = { name: step.name, index };
542
+ } else {
543
+ issues.push({
544
+ rule: 'finalize-uniqueness',
545
+ name: step.name,
546
+ index,
547
+ message: `duplicate finalize step "${step.name}" at index ${index}; first finalize was "${firstFinalize.name}" at index ${firstFinalize.index}`,
548
+ });
549
+ }
550
+ }
551
+ }
552
+
553
+ return issues;
554
+ }
555
+
556
+ /**
557
+ * Format a markdown reference document for the auto-* pipeline step kinds.
558
+ *
559
+ * Y1 (run #23) — closes proposal (t) in pipeline-optimization-report.md
560
+ * (`docs/step-kinds.md` auto-generation). Takes the same per-pipeline ordered
561
+ * step descriptors that `verifyPipelineKindInvariants` consumes, plus the
562
+ * pipeline display label and the optional `description` field of each step,
563
+ * and returns a single markdown string suitable for writing to
564
+ * `docs/step-kinds.md`. The output is deterministic given the same input so
565
+ * drift detection is a simple byte-equal comparison.
566
+ *
567
+ * The output shape:
568
+ *
569
+ * # Auto Pipeline Step Kinds Reference
570
+ *
571
+ * > **AUTO-GENERATED** ... (header preamble)
572
+ *
573
+ * ## <pipeline-name>
574
+ *
575
+ * **Shape:** `init` → `analysis` → ... → `terminal`
576
+ *
577
+ * ```mermaid
578
+ * flowchart TD
579
+ * s1["step-NN-xxx<br/>kind-value"]
580
+ * ...
581
+ * s1 --> s2
582
+ * s7 -. loop .-> s7
583
+ * ```
584
+ *
585
+ * | # | Step | Kind | Description |
586
+ * |---|------|------|-------------|
587
+ * | 01 | step-NN-xxx | kind-value | first-sentence-of-description |
588
+ *
589
+ * ## Kind Distribution
590
+ *
591
+ * | Kind | Count |
592
+ * |------|-------|
593
+ * | init | 4 |
594
+ *
595
+ * Z1 (run #24) — adds a one-line "Shape signature" between each `## <pipeline>`
596
+ * H2 and the per-pipeline detail table. The shape is a left-to-right arrow-
597
+ * connected sequence of each step's `kind` (or `unclassified` when absent),
598
+ * letting reviewers eyeball the pipeline silhouette without scanning N table
599
+ * rows. This is the natural reader-facing complement to the schema-level
600
+ * structural invariants enforced by verifyPipelineKindInvariants: the
601
+ * invariants catch shape violations programmatically; the Shape line lets a
602
+ * human reviewer spot intentional differences (e.g. auto-story-pipeline's
603
+ * 3-gate streak vs. auto-requirements-pipeline's single mid-pipeline gate) at
604
+ * a glance.
605
+ *
606
+ * AB1 (run #26) — closes proposal (dd) in pipeline-optimization-report.md
607
+ * (`docs/step-kinds.md` mermaid flowchart enrichment). For each non-empty
608
+ * pipeline, a fenced mermaid `flowchart TD` block is inserted between the
609
+ * Shape signature line and the per-step table. Nodes are labeled `step-name`
610
+ * over `kind` and edges are drawn from each step's `nextStepFile*` references:
611
+ *
612
+ * * `nextStepFile` → solid arrow `s1 --> s2` (main flow). The
613
+ * terminal step's `null` nextStepFile produces no
614
+ * outbound main-flow edge.
615
+ * * `nextStepFile_loop` → labeled dotted arrow `s7 -. loop .-> s7` (the
616
+ * only live use is auto-story-pipeline step-07's
617
+ * self-reference).
618
+ * * `nextStepFile_issues` → labeled dotted arrow `s5 -. issues .-> s7`
619
+ * (e.g. auto-story-pipeline code-review fanning
620
+ * to fix-and-retest).
621
+ * * `nextStepFile_fail` → labeled dotted arrow `s6 -. fail .-> s7`
622
+ * (e.g. auto-story-pipeline test-story fanning
623
+ * to fix-and-retest).
624
+ * * `nextStepFile_skip` → labeled dotted arrow `sN -. skip .-> sM`.
625
+ * * `altStepFile` → labeled dotted arrow `sN -. alt .-> sM`.
626
+ *
627
+ * Edges with targets outside the pipeline are silently skipped (a validated
628
+ * tree never has these; the formatter stays safe for partial-pipeline test
629
+ * inputs). The diagram is the visual companion to the Shape signature: shape
630
+ * shows kind-sequence, the diagram shows reach-ability + conditional branches.
631
+ *
632
+ * Splitting this into a pure function keeps the markdown-formatting concern
633
+ * unit-testable independently of filesystem I/O — the CLI walker is the only
634
+ * caller that needs to read frontmatter and write to disk.
635
+ *
636
+ * @param {{ label: string, steps: { name: string, kind?: string, description?: string, nextStepFile?: string | null, nextStepFile_loop?: string, nextStepFile_issues?: string, nextStepFile_fail?: string, nextStepFile_skip?: string, altStepFile?: string }[] }[]} pipelines
637
+ * Ordered list of pipelines. Each entry carries the human-readable pipeline
638
+ * `label` (e.g. `auto-requirements-pipeline`) and the ordered step descriptors.
639
+ * AB1 (run #26) widens the step descriptor with the main and conditional
640
+ * `nextStepFile*` fields so the mermaid flowchart can render edges. All new
641
+ * fields are optional — descriptors that only carry `{name, kind, description}`
642
+ * (the Y1 / Z1 contract) still produce a node-only flowchart with no edges.
643
+ * @returns {string} Markdown document body, ending with exactly one trailing newline.
644
+ */
645
+ function formatStepKindsDoc(pipelines) {
646
+ const lines = [];
647
+ lines.push(
648
+ '# Auto Pipeline Step Kinds Reference',
649
+ '',
650
+ '> **AUTO-GENERATED** by `tools/validate-step-schemas.js --emit-doc`. Do not edit by hand.',
651
+ '> Run `npm run validate:step-kinds-doc` to detect drift between this file and the live step tree.',
652
+ '',
653
+ 'Each row shows a step file in the four `auto-*` pipelines along with its `kind` annotation from YAML frontmatter and a short description. Each pipeline section also renders a mermaid flowchart wired from the live `nextStepFile*` references.',
654
+ '',
655
+ );
656
+
657
+ // Aggregate counts as we walk the pipelines so the histogram below stays
658
+ // consistent with the per-pipeline tables without a second pass.
659
+ const totals = Object.fromEntries(KIND_VALUES.map((v) => [v, 0]));
660
+ totals.unclassified = 0;
661
+
662
+ for (const pipeline of pipelines) {
663
+ // Z1 (run #24) — Shape signature: a single arrow-connected line of the
664
+ // ordered step kinds, rendered between the H2 and the per-step table so
665
+ // reviewers can eyeball pipeline silhouettes without scanning the rows.
666
+ // Empty pipelines produce `**Shape:** _(empty)_` rather than a bare label
667
+ // so the line is still visually present and grep-able.
668
+ const shapeTokens = pipeline.steps.map((step) => `\`${step.kind || 'unclassified'}\``);
669
+ const shapeLine = shapeTokens.length > 0 ? shapeTokens.join(' → ') : '_(empty)_';
670
+ lines.push(`## ${pipeline.label}`, '', `**Shape:** ${shapeLine}`, '');
671
+
672
+ // AB1 (run #26) — Mermaid flowchart block sits between the Shape line and
673
+ // the per-step detail table. Empty pipelines are skipped (no useful graph
674
+ // to render); the `_(empty)_` Shape line already conveys the same fact.
675
+ if (pipeline.steps.length > 0) {
676
+ lines.push(...formatMermaidFlowchart(pipeline.steps), '');
677
+ }
678
+
679
+ lines.push('| # | Step | Kind | Description |', '|---|------|------|-------------|');
680
+ for (const [idx, step] of pipeline.steps.entries()) {
681
+ const num = String(idx + 1).padStart(2, '0');
682
+ const kind = step.kind || 'unclassified';
683
+ const description = firstSentence(step.description || '');
684
+ lines.push(`| ${num} | \`${step.name}\` | \`${kind}\` | ${description} |`);
685
+ if (Object.prototype.hasOwnProperty.call(totals, kind)) {
686
+ totals[kind]++;
687
+ } else {
688
+ totals.unclassified++;
689
+ }
690
+ }
691
+ lines.push('');
692
+ }
693
+
694
+ // Histogram — mirrors the walker's stdout output but persisted to disk so a
695
+ // dashboard or external consumer can `grep` it without invoking the validator.
696
+ lines.push('## Kind Distribution', '', '| Kind | Count |', '|------|-------|');
697
+ for (const kindValue of KIND_VALUES) {
698
+ lines.push(`| \`${kindValue}\` | ${totals[kindValue]} |`);
699
+ }
700
+ lines.push(`| \`unclassified\` | ${totals.unclassified} |`, '');
701
+
702
+ return lines.join('\n');
703
+ }
704
+
705
+ // AB1 (run #26) — conditional-edge variant descriptor used by
706
+ // `formatMermaidFlowchart`. The order is the rendering order for conditional
707
+ // edges so the generated flowchart stays deterministic: loop first (most
708
+ // pipeline-shape-relevant — a loop edge usually re-enters the same node),
709
+ // then issues / fail (the two routing variants used by live auto-story
710
+ // pipeline gates), then the rarely-used skip / alt tails. Adding a new
711
+ // conditional variant in `tools/schema/step.js` (and the matching strict
712
+ // schema) requires appending to this list to surface the edge in the
713
+ // flowchart; existing tests' variant-order assertions will fail until the
714
+ // new entry is added consistently.
715
+ const CONDITIONAL_EDGE_VARIANTS = Object.freeze([
716
+ { field: 'nextStepFile_loop', label: 'loop' },
717
+ { field: 'nextStepFile_issues', label: 'issues' },
718
+ { field: 'nextStepFile_fail', label: 'fail' },
719
+ { field: 'nextStepFile_skip', label: 'skip' },
720
+ { field: 'altStepFile', label: 'alt' },
721
+ ]);
722
+
723
+ // AB1 (run #26) — STEP_REF_PATTERN-compatible target extractor. The mermaid
724
+ // flowchart formatter resolves each `nextStepFile*` value (e.g.
725
+ // `./step-02-create-story.md`) back to its source step name so it can look up
726
+ // the target's node id within the same pipeline. The regex mirrors the schema
727
+ // STEP_REF_PATTERN above so the two layers stay in sync; a non-matching value
728
+ // (or one whose target isn't a sibling in the same pipeline) is silently
729
+ // skipped — the formatter must remain safe for partial-pipeline test inputs.
730
+ const STEP_REF_TARGET_PATTERN = /^\.\/(step-\d{2}[a-z]?-[a-z0-9]+(?:-[a-z0-9]+)*)\.md$/;
731
+
732
+ /**
733
+ * Format one pipeline's mermaid `flowchart TD` block.
734
+ *
735
+ * Renders each step as a node `sN["step-name<br/>kind"]`, then draws:
736
+ * * a solid main-flow arrow `sN --> sM` for each `nextStepFile`
737
+ * (terminal steps with `null` or absent `nextStepFile` emit no arrow);
738
+ * * a labeled dotted arrow `sN -. <variant> .-> sM` for each conditional
739
+ * variant declared in CONDITIONAL_EDGE_VARIANTS that points at a sibling
740
+ * in the same pipeline.
741
+ *
742
+ * Edges to targets outside the pipeline are silently skipped (a validated
743
+ * tree never has these; safety net for partial-pipeline unit-test inputs).
744
+ *
745
+ * Output is an array of lines (caller controls outer blank-line padding).
746
+ * The block always starts with `` ```mermaid `` and ends with `` ``` ``.
747
+ *
748
+ * Deterministic given the same input: nodes in pipeline order, main edges in
749
+ * pipeline order, conditional edges in pipeline order then variant order so
750
+ * the `validate:step-kinds-doc` drift check stays stable.
751
+ *
752
+ * @param {{ name: string, kind?: string, nextStepFile?: string | null,
753
+ * nextStepFile_loop?: string, nextStepFile_issues?: string,
754
+ * nextStepFile_fail?: string, nextStepFile_skip?: string,
755
+ * altStepFile?: string }[]} steps Ordered list of step descriptors. Must be
756
+ * non-empty; callers guard the empty case (the doc generator skips empty
757
+ * pipelines entirely so they don't produce a stub flowchart).
758
+ * @returns {string[]} Lines forming a fenced mermaid block.
759
+ */
760
+ function formatMermaidFlowchart(steps) {
761
+ const lines = ['```mermaid', 'flowchart TD'];
762
+
763
+ // Build the name → 1-based node id lookup once so edge resolution is O(1).
764
+ const nameToNodeId = new Map();
765
+ for (const [idx, step] of steps.entries()) {
766
+ nameToNodeId.set(step.name, `s${idx + 1}`);
767
+ }
768
+
769
+ function resolveTargetNodeId(value) {
770
+ if (typeof value !== 'string') return null;
771
+ const match = STEP_REF_TARGET_PATTERN.exec(value);
772
+ if (!match) return null;
773
+ return nameToNodeId.get(match[1]) || null;
774
+ }
775
+
776
+ // Node definitions.
777
+ for (const [idx, step] of steps.entries()) {
778
+ const nodeId = `s${idx + 1}`;
779
+ const kind = step.kind || 'unclassified';
780
+ lines.push(` ${nodeId}["${step.name}<br/>${kind}"]`);
781
+ }
782
+
783
+ // Main-flow edges.
784
+ for (const [idx, step] of steps.entries()) {
785
+ const sourceId = `s${idx + 1}`;
786
+ const targetId = resolveTargetNodeId(step.nextStepFile);
787
+ if (targetId) {
788
+ lines.push(` ${sourceId} --> ${targetId}`);
789
+ }
790
+ }
791
+
792
+ // Conditional edges (variant order matches CONDITIONAL_EDGE_VARIANTS).
793
+ for (const [idx, step] of steps.entries()) {
794
+ const sourceId = `s${idx + 1}`;
795
+ for (const { field, label } of CONDITIONAL_EDGE_VARIANTS) {
796
+ const targetId = resolveTargetNodeId(step[field]);
797
+ if (targetId) {
798
+ lines.push(` ${sourceId} -. ${label} .-> ${targetId}`);
799
+ }
800
+ }
801
+ }
802
+
803
+ lines.push('```');
804
+ return lines;
805
+ }
806
+
807
+ // Trim a free-form description down to the first sentence so the generated
808
+ // table stays readable. Falls back to the whole string when no terminator is
809
+ // found. Markdown table cells need pipe characters escaped so the table
810
+ // doesn't break.
811
+ //
812
+ // AA2 (run #25) — closes proposal (ee) in pipeline-optimization-report.md.
813
+ // Two changes to the original Y1 (run #23) regex:
814
+ //
815
+ // 1. Extends the terminator set with Chinese full-width semicolon `;`
816
+ // and Chinese full-width colon `:` (in addition to the pre-existing
817
+ // `。`, `!`, `?`) so future Chinese-language descriptions can be
818
+ // truncated at natural clause boundaries. ASCII `;` / `:` are
819
+ // intentionally NOT terminators — existing English descriptions that
820
+ // use a colon mid-sentence (e.g. "Phase 2 bridge: auto-run sprint
821
+ // planning…") remain intact.
822
+ // 2. Splits the trailing-context requirement by character class:
823
+ // * ASCII `.!?` still REQUIRE a following whitespace or end-of-string,
824
+ // so mid-token periods like `req.md` in English descriptions do
825
+ // not falsely terminate the sentence.
826
+ // * Chinese full-width terminators (`。!?;:`) DO NOT require
827
+ // trailing whitespace because Chinese prose runs words together
828
+ // without spaces — requiring whitespace would mean Chinese
829
+ // descriptions never truncate at the intended boundary.
830
+ //
831
+ // Adding more terminators requires updating both this regex and the matching
832
+ // AA2 unit test cases.
833
+ function firstSentence(text) {
834
+ if (!text) return '';
835
+ const trimmed = text.trim();
836
+ // Match the first sentence-terminating punctuation. ASCII `.!?` need a
837
+ // following whitespace or end-of-string (anti-`req.md` guard); Chinese
838
+ // full-width terminators stand alone (no whitespace requirement). Falls
839
+ // back to the entire trimmed text when no terminator matches.
840
+ const match = trimmed.match(/^(.*?(?:[.!?](?=\s|$)|[。!?;:]))/);
841
+ const sentence = match ? match[1] : trimmed;
842
+ return sentence.replaceAll('|', String.raw`\|`);
843
+ }
844
+
845
+ module.exports = {
846
+ validateStepFrontmatter,
847
+ verifyStepReferences,
848
+ verifyPipelineKindInvariants,
849
+ formatStepKindsDoc,
850
+ formatMermaidFlowchart,
851
+ STEP_REF_PATTERN,
852
+ NAME_PATTERN,
853
+ KIND_VALUES,
854
+ CONDITIONAL_EDGE_VARIANTS,
855
+ };