bmad-method 6.12.3 → 7.0.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 (388) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +107 -54
  3. package/agents.json +640 -0
  4. package/bin/bmad-method.js +4 -0
  5. package/messages.yaml +260 -0
  6. package/modules.yaml +56 -0
  7. package/package.json +32 -110
  8. package/src/agent-picks.js +77 -0
  9. package/src/agents.js +141 -0
  10. package/src/bmad-scripts.js +167 -0
  11. package/src/cli.js +266 -0
  12. package/src/commands/agent-choice.js +67 -0
  13. package/src/commands/apply.js +38 -0
  14. package/src/commands/deps.js +25 -0
  15. package/src/commands/ending.js +54 -0
  16. package/src/commands/existing-install.js +50 -0
  17. package/src/commands/install-plan.js +130 -0
  18. package/src/commands/install-steps.js +66 -0
  19. package/src/commands/install.js +86 -0
  20. package/src/commands/status.js +39 -0
  21. package/src/commands/update.js +106 -0
  22. package/src/installed.js +48 -0
  23. package/src/messages.js +84 -0
  24. package/src/modules.js +221 -0
  25. package/src/preflight.js +124 -0
  26. package/src/project-lock.js +68 -0
  27. package/src/prompts.js +626 -0
  28. package/src/report.js +199 -0
  29. package/src/run.js +124 -0
  30. package/src/self-update.js +88 -0
  31. package/src/skills-cli.js +133 -0
  32. package/src/version.js +11 -0
  33. package/.claude-plugin/marketplace.json +0 -53
  34. package/AGENTS.md +0 -24
  35. package/CLAUDE.md +0 -1
  36. package/README_CN.md +0 -98
  37. package/README_KR.md +0 -90
  38. package/README_VN.md +0 -99
  39. package/bmad-modules.yaml +0 -140
  40. package/body.md +0 -17
  41. package/greptile.json +0 -52
  42. package/removals.txt +0 -87
  43. package/src/bmm-skills/agents/bmad-agent-analyst/SKILL.md +0 -76
  44. package/src/bmm-skills/agents/bmad-agent-analyst/customize.toml +0 -103
  45. package/src/bmm-skills/agents/bmad-agent-architect/SKILL.md +0 -76
  46. package/src/bmm-skills/agents/bmad-agent-architect/customize.toml +0 -63
  47. package/src/bmm-skills/agents/bmad-agent-dev/SKILL.md +0 -76
  48. package/src/bmm-skills/agents/bmad-agent-dev/customize.toml +0 -81
  49. package/src/bmm-skills/agents/bmad-agent-pm/SKILL.md +0 -76
  50. package/src/bmm-skills/agents/bmad-agent-pm/customize.toml +0 -73
  51. package/src/bmm-skills/agents/bmad-agent-ux-designer/SKILL.md +0 -76
  52. package/src/bmm-skills/agents/bmad-agent-ux-designer/customize.toml +0 -58
  53. package/src/bmm-skills/module-help.csv +0 -19
  54. package/src/bmm-skills/module.yaml +0 -85
  55. package/src/bmm-skills/plan/bmad-architecture/SKILL.md +0 -85
  56. package/src/bmm-skills/plan/bmad-architecture/assets/spine-template.md +0 -79
  57. package/src/bmm-skills/plan/bmad-architecture/customize.toml +0 -101
  58. package/src/bmm-skills/plan/bmad-architecture/references/headless.md +0 -26
  59. package/src/bmm-skills/plan/bmad-architecture/references/reviewer-gate.md +0 -13
  60. package/src/bmm-skills/plan/bmad-architecture/scripts/lint_spine.py +0 -261
  61. package/src/bmm-skills/plan/bmad-architecture/scripts/tests/test_lint_spine.py +0 -270
  62. package/src/bmm-skills/plan/bmad-create-epics-and-stories/SKILL.md +0 -93
  63. package/src/bmm-skills/plan/bmad-create-epics-and-stories/customize.toml +0 -39
  64. package/src/bmm-skills/plan/bmad-create-epics-and-stories/steps/step-01-validate-prerequisites.md +0 -263
  65. package/src/bmm-skills/plan/bmad-create-epics-and-stories/steps/step-02-design-epics.md +0 -242
  66. package/src/bmm-skills/plan/bmad-create-epics-and-stories/steps/step-03-create-stories.md +0 -255
  67. package/src/bmm-skills/plan/bmad-create-epics-and-stories/steps/step-04-final-validation.md +0 -141
  68. package/src/bmm-skills/plan/bmad-create-epics-and-stories/templates/epics-template.md +0 -62
  69. package/src/bmm-skills/plan/bmad-generate-project-context/SKILL.md +0 -12
  70. package/src/bmm-skills/plan/bmad-prd/SKILL.md +0 -94
  71. package/src/bmm-skills/plan/bmad-prd/assets/headless-schemas.md +0 -76
  72. package/src/bmm-skills/plan/bmad-prd/assets/prd-template.md +0 -165
  73. package/src/bmm-skills/plan/bmad-prd/assets/prd-validation-checklist.md +0 -135
  74. package/src/bmm-skills/plan/bmad-prd/assets/validation-report-template.html +0 -325
  75. package/src/bmm-skills/plan/bmad-prd/customize.toml +0 -148
  76. package/src/bmm-skills/plan/bmad-prd/references/headless.md +0 -39
  77. package/src/bmm-skills/plan/bmad-prd/references/validate.md +0 -97
  78. package/src/bmm-skills/plan/bmad-prfaq/SKILL.md +0 -135
  79. package/src/bmm-skills/plan/bmad-prfaq/agents/artifact-analyzer.md +0 -60
  80. package/src/bmm-skills/plan/bmad-prfaq/agents/web-researcher.md +0 -49
  81. package/src/bmm-skills/plan/bmad-prfaq/assets/prfaq-template.md +0 -62
  82. package/src/bmm-skills/plan/bmad-prfaq/bmad-manifest.json +0 -16
  83. package/src/bmm-skills/plan/bmad-prfaq/customize.toml +0 -39
  84. package/src/bmm-skills/plan/bmad-prfaq/references/customer-faq.md +0 -55
  85. package/src/bmm-skills/plan/bmad-prfaq/references/internal-faq.md +0 -51
  86. package/src/bmm-skills/plan/bmad-prfaq/references/press-release.md +0 -60
  87. package/src/bmm-skills/plan/bmad-prfaq/references/verdict.md +0 -83
  88. package/src/bmm-skills/plan/bmad-product-brief/SKILL.md +0 -91
  89. package/src/bmm-skills/plan/bmad-product-brief/assets/brief-template.md +0 -41
  90. package/src/bmm-skills/plan/bmad-product-brief/customize.toml +0 -100
  91. package/src/bmm-skills/plan/bmad-project-context/SKILL.md +0 -121
  92. package/src/bmm-skills/plan/bmad-project-context/customize.toml +0 -24
  93. package/src/bmm-skills/plan/bmad-project-context/references/best-practices.md +0 -84
  94. package/src/bmm-skills/plan/bmad-project-context/references/template.md +0 -55
  95. package/src/bmm-skills/plan/bmad-spec/SKILL.md +0 -160
  96. package/src/bmm-skills/plan/bmad-spec/assets/headless-schemas.md +0 -33
  97. package/src/bmm-skills/plan/bmad-spec/assets/spec-template.md +0 -49
  98. package/src/bmm-skills/plan/bmad-spec/assets/stories-schema.md +0 -44
  99. package/src/bmm-skills/plan/bmad-spec/customize.toml +0 -52
  100. package/src/bmm-skills/plan/bmad-sprint-planning/SKILL.md +0 -62
  101. package/src/bmm-skills/plan/bmad-sprint-planning/customize.toml +0 -39
  102. package/src/bmm-skills/plan/bmad-sprint-planning/references/fix-sprint-status.md +0 -30
  103. package/src/bmm-skills/plan/bmad-sprint-planning/references/generate-tracking.md +0 -25
  104. package/src/bmm-skills/plan/bmad-sprint-planning/references/readiness-gate.md +0 -20
  105. package/src/bmm-skills/plan/bmad-sprint-planning/references/status-view.md +0 -14
  106. package/src/bmm-skills/plan/bmad-sprint-planning/references/validate.md +0 -10
  107. package/src/bmm-skills/plan/bmad-sprint-planning/scripts/__pycache__/sprint_plan.cpython-311.pyc +0 -0
  108. package/src/bmm-skills/plan/bmad-sprint-planning/scripts/sprint_plan.py +0 -701
  109. package/src/bmm-skills/plan/bmad-sprint-planning/scripts/tests/__pycache__/test_sprint_plan.cpython-311-pytest-9.1.1.pyc +0 -0
  110. package/src/bmm-skills/plan/bmad-sprint-planning/scripts/tests/test_sprint_plan.py +0 -524
  111. package/src/bmm-skills/plan/bmad-sprint-planning/sprint-status-template.yaml +0 -71
  112. package/src/bmm-skills/plan/bmad-ux/SKILL.md +0 -90
  113. package/src/bmm-skills/plan/bmad-ux/assets/color-themes.md +0 -9
  114. package/src/bmm-skills/plan/bmad-ux/assets/design-directions.md +0 -9
  115. package/src/bmm-skills/plan/bmad-ux/assets/design-example-editorial.md +0 -158
  116. package/src/bmm-skills/plan/bmad-ux/assets/design-example-mobile.md +0 -93
  117. package/src/bmm-skills/plan/bmad-ux/assets/design-example-shadcn.md +0 -109
  118. package/src/bmm-skills/plan/bmad-ux/assets/excalidraw-wireframe.md +0 -19
  119. package/src/bmm-skills/plan/bmad-ux/assets/experience-example-mobile.md +0 -112
  120. package/src/bmm-skills/plan/bmad-ux/assets/experience-example-shadcn.md +0 -133
  121. package/src/bmm-skills/plan/bmad-ux/assets/headless-schemas.md +0 -84
  122. package/src/bmm-skills/plan/bmad-ux/assets/key-screens.md +0 -29
  123. package/src/bmm-skills/plan/bmad-ux/assets/validation-report-template.html +0 -319
  124. package/src/bmm-skills/plan/bmad-ux/customize.toml +0 -100
  125. package/src/bmm-skills/plan/bmad-ux/references/creative-tools.md +0 -19
  126. package/src/bmm-skills/plan/bmad-ux/references/design-md-spec.md +0 -50
  127. package/src/bmm-skills/plan/bmad-ux/references/headless.md +0 -37
  128. package/src/bmm-skills/plan/bmad-ux/references/validate.md +0 -115
  129. package/src/bmm-skills/ship/bmad-build/SKILL.md +0 -13
  130. package/src/bmm-skills/ship/bmad-build/compile-epic-context.md +0 -62
  131. package/src/bmm-skills/ship/bmad-build/customize.toml +0 -152
  132. package/src/bmm-skills/ship/bmad-build/references/claims-check.md +0 -14
  133. package/src/bmm-skills/ship/bmad-build/references/deletion-check.md +0 -14
  134. package/src/bmm-skills/ship/bmad-build/review-prompts/edge-case-hunter.md +0 -112
  135. package/src/bmm-skills/ship/bmad-build/review-prompts/verification-gap.md +0 -113
  136. package/src/bmm-skills/ship/bmad-build/spec-template.md +0 -111
  137. package/src/bmm-skills/ship/bmad-build/step-01-clarify-and-route.md +0 -100
  138. package/src/bmm-skills/ship/bmad-build/step-02-plan.md +0 -62
  139. package/src/bmm-skills/ship/bmad-build/step-03-implement.md +0 -51
  140. package/src/bmm-skills/ship/bmad-build/step-04-review.md +0 -85
  141. package/src/bmm-skills/ship/bmad-build/step-05-present.md +0 -43
  142. package/src/bmm-skills/ship/bmad-build/step-oneshot.md +0 -107
  143. package/src/bmm-skills/ship/bmad-build/sync-sprint-status.md +0 -5
  144. package/src/bmm-skills/ship/bmad-build/workflow.md +0 -84
  145. package/src/bmm-skills/ship/bmad-build-auto/SKILL.md +0 -13
  146. package/src/bmm-skills/ship/bmad-build-auto/compile-epic-context.md +0 -62
  147. package/src/bmm-skills/ship/bmad-build-auto/customize.toml +0 -119
  148. package/src/bmm-skills/ship/bmad-build-auto/references/claims-check.md +0 -14
  149. package/src/bmm-skills/ship/bmad-build-auto/references/deletion-check.md +0 -14
  150. package/src/bmm-skills/ship/bmad-build-auto/review-prompts/edge-case-hunter.md +0 -112
  151. package/src/bmm-skills/ship/bmad-build-auto/review-prompts/verification-gap.md +0 -113
  152. package/src/bmm-skills/ship/bmad-build-auto/spec-template.md +0 -96
  153. package/src/bmm-skills/ship/bmad-build-auto/step-01-clarify-and-route.md +0 -84
  154. package/src/bmm-skills/ship/bmad-build-auto/step-02-plan.md +0 -27
  155. package/src/bmm-skills/ship/bmad-build-auto/step-03-implement.md +0 -48
  156. package/src/bmm-skills/ship/bmad-build-auto/step-04-review.md +0 -116
  157. package/src/bmm-skills/ship/bmad-build-auto/workflow.md +0 -104
  158. package/src/bmm-skills/ship/bmad-code-review/SKILL.md +0 -90
  159. package/src/bmm-skills/ship/bmad-code-review/customize.toml +0 -110
  160. package/src/bmm-skills/ship/bmad-code-review/references/claims-check.md +0 -14
  161. package/src/bmm-skills/ship/bmad-code-review/references/deletion-check.md +0 -14
  162. package/src/bmm-skills/ship/bmad-code-review/review-prompts/edge-case-hunter.md +0 -112
  163. package/src/bmm-skills/ship/bmad-code-review/review-prompts/verification-gap.md +0 -113
  164. package/src/bmm-skills/ship/bmad-code-review/steps/step-01-gather-context.md +0 -94
  165. package/src/bmm-skills/ship/bmad-code-review/steps/step-02-review.md +0 -32
  166. package/src/bmm-skills/ship/bmad-code-review/steps/step-03-triage.md +0 -54
  167. package/src/bmm-skills/ship/bmad-code-review/steps/step-04-present.md +0 -134
  168. package/src/bmm-skills/ship/bmad-correct-course/SKILL.md +0 -308
  169. package/src/bmm-skills/ship/bmad-correct-course/checklist.md +0 -288
  170. package/src/bmm-skills/ship/bmad-correct-course/customize.toml +0 -39
  171. package/src/bmm-skills/ship/bmad-qa-generate-e2e-tests/SKILL.md +0 -176
  172. package/src/bmm-skills/ship/bmad-qa-generate-e2e-tests/checklist.md +0 -33
  173. package/src/bmm-skills/ship/bmad-qa-generate-e2e-tests/customize.toml +0 -39
  174. package/src/bmm-skills/ship/bmad-retrospective/SKILL.md +0 -94
  175. package/src/bmm-skills/ship/bmad-retrospective/customize.toml +0 -39
  176. package/src/bmm-skills/ship/bmad-retrospective/references/acceptance-verdict.md +0 -55
  177. package/src/bmm-skills/ship/bmad-retrospective/references/aggregate-views.md +0 -17
  178. package/src/bmm-skills/ship/bmad-retrospective/references/evidence-gathering.md +0 -30
  179. package/src/bmm-skills/ship/bmad-retrospective/references/retro-document.md +0 -84
  180. package/src/bmm-skills/ship/bmad-retrospective/references/team-discussion.md +0 -22
  181. package/src/bmm-skills/ship/bmad-retrospective/scripts/__pycache__/sprint_status.cpython-311.pyc +0 -0
  182. package/src/bmm-skills/ship/bmad-retrospective/scripts/git_evidence.py +0 -308
  183. package/src/bmm-skills/ship/bmad-retrospective/scripts/sprint_status.py +0 -750
  184. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/__pycache__/test_git_evidence.cpython-311-pytest-9.1.1.pyc +0 -0
  185. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/__pycache__/test_sprint_status.cpython-311-pytest-9.1.1.pyc +0 -0
  186. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/fixtures/sprint-status-template.yaml +0 -71
  187. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/test_git_evidence.py +0 -750
  188. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/test_sprint_status.py +0 -1579
  189. package/src/bmm-skills/ship/bmad-walkthrough/SKILL.md +0 -68
  190. package/src/bmm-skills/ship/bmad-walkthrough/customize.toml +0 -39
  191. package/src/bmm-skills/ship/bmad-walkthrough/generate-trail.md +0 -38
  192. package/src/bmm-skills/ship/bmad-walkthrough/step-01-orientation.md +0 -105
  193. package/src/bmm-skills/ship/bmad-walkthrough/step-02-walkthrough.md +0 -89
  194. package/src/bmm-skills/ship/bmad-walkthrough/step-03-detail-pass.md +0 -106
  195. package/src/bmm-skills/ship/bmad-walkthrough/step-04-testing.md +0 -74
  196. package/src/bmm-skills/ship/bmad-walkthrough/step-05-wrapup.md +0 -30
  197. package/src/bmm-skills/v6-shims/README.md +0 -29
  198. package/src/bmm-skills/v6-shims/bmad-checkpoint-preview/SKILL.md +0 -21
  199. package/src/bmm-skills/v6-shims/bmad-create-architecture/SKILL.md +0 -32
  200. package/src/bmm-skills/v6-shims/bmad-create-architecture/customize.toml +0 -39
  201. package/src/bmm-skills/v6-shims/bmad-create-prd/SKILL.md +0 -32
  202. package/src/bmm-skills/v6-shims/bmad-create-prd/customize.toml +0 -39
  203. package/src/bmm-skills/v6-shims/bmad-create-story/SKILL.md +0 -436
  204. package/src/bmm-skills/v6-shims/bmad-create-story/checklist.md +0 -357
  205. package/src/bmm-skills/v6-shims/bmad-create-story/customize.toml +0 -39
  206. package/src/bmm-skills/v6-shims/bmad-create-story/discover-inputs.md +0 -88
  207. package/src/bmm-skills/v6-shims/bmad-create-story/template.md +0 -49
  208. package/src/bmm-skills/v6-shims/bmad-dev-auto/SKILL.md +0 -21
  209. package/src/bmm-skills/v6-shims/bmad-dev-story/SKILL.md +0 -504
  210. package/src/bmm-skills/v6-shims/bmad-dev-story/checklist.md +0 -80
  211. package/src/bmm-skills/v6-shims/bmad-dev-story/customize.toml +0 -39
  212. package/src/bmm-skills/v6-shims/bmad-document-project/SKILL.md +0 -16
  213. package/src/bmm-skills/v6-shims/bmad-domain-research/SKILL.md +0 -16
  214. package/src/bmm-skills/v6-shims/bmad-edit-prd/SKILL.md +0 -32
  215. package/src/bmm-skills/v6-shims/bmad-edit-prd/customize.toml +0 -40
  216. package/src/bmm-skills/v6-shims/bmad-market-research/SKILL.md +0 -16
  217. package/src/bmm-skills/v6-shims/bmad-quick-dev/SKILL.md +0 -21
  218. package/src/bmm-skills/v6-shims/bmad-sprint-status/SKILL.md +0 -28
  219. package/src/bmm-skills/v6-shims/bmad-sprint-status/customize.toml +0 -39
  220. package/src/bmm-skills/v6-shims/bmad-technical-research/SKILL.md +0 -16
  221. package/src/bmm-skills/v6-shims/bmad-validate-prd/SKILL.md +0 -32
  222. package/src/bmm-skills/v6-shims/bmad-validate-prd/customize.toml +0 -40
  223. package/src/core-skills/bmad-advanced-elicitation/SKILL.md +0 -64
  224. package/src/core-skills/bmad-advanced-elicitation/assets/methods.csv +0 -72
  225. package/src/core-skills/bmad-advanced-elicitation/customize.toml +0 -54
  226. package/src/core-skills/bmad-advanced-elicitation/scripts/pick_methods.py +0 -233
  227. package/src/core-skills/bmad-advanced-elicitation/scripts/tests/test_pick_methods.py +0 -228
  228. package/src/core-skills/bmad-brainstorming/SKILL.md +0 -80
  229. package/src/core-skills/bmad-brainstorming/assets/brain-icons.json +0 -166
  230. package/src/core-skills/bmad-brainstorming/assets/brain-methods.csv +0 -109
  231. package/src/core-skills/bmad-brainstorming/assets/brain-selector.html +0 -328
  232. package/src/core-skills/bmad-brainstorming/customize.toml +0 -83
  233. package/src/core-skills/bmad-brainstorming/references/converge.md +0 -24
  234. package/src/core-skills/bmad-brainstorming/references/finalize.md +0 -26
  235. package/src/core-skills/bmad-brainstorming/references/headless.md +0 -54
  236. package/src/core-skills/bmad-brainstorming/references/in-chat-techniques.md +0 -18
  237. package/src/core-skills/bmad-brainstorming/references/mode-autonomous.md +0 -10
  238. package/src/core-skills/bmad-brainstorming/references/mode-facilitator.md +0 -11
  239. package/src/core-skills/bmad-brainstorming/references/mode-partner.md +0 -16
  240. package/src/core-skills/bmad-brainstorming/references/resume.md +0 -5
  241. package/src/core-skills/bmad-brainstorming/scripts/brain.py +0 -789
  242. package/src/core-skills/bmad-brainstorming/scripts/tests/test_brain.py +0 -289
  243. package/src/core-skills/bmad-customize/SKILL.md +0 -111
  244. package/src/core-skills/bmad-customize/scripts/list_customizable_skills.py +0 -235
  245. package/src/core-skills/bmad-customize/scripts/tests/test_list_customizable_skills.py +0 -249
  246. package/src/core-skills/bmad-deep-recon/SKILL.md +0 -82
  247. package/src/core-skills/bmad-deep-recon/assets/research.template.md +0 -18
  248. package/src/core-skills/bmad-deep-recon/customize.toml +0 -212
  249. package/src/core-skills/bmad-deep-recon/references/draft.md +0 -8
  250. package/src/core-skills/bmad-deep-recon/references/finalize.md +0 -11
  251. package/src/core-skills/bmad-deep-recon/references/html-briefing.md +0 -16
  252. package/src/core-skills/bmad-deep-recon/references/lifecycle.md +0 -11
  253. package/src/core-skills/bmad-deep-recon/references/process.md +0 -10
  254. package/src/core-skills/bmad-deep-recon/references/run.md +0 -73
  255. package/src/core-skills/bmad-deep-recon/references/selection.md +0 -13
  256. package/src/core-skills/bmad-deep-recon/references/synthesis.md +0 -16
  257. package/src/core-skills/bmad-deep-recon/references/verification.md +0 -29
  258. package/src/core-skills/bmad-deep-recon/scripts/recon_kit.py +0 -326
  259. package/src/core-skills/bmad-deep-recon/scripts/tests/test_recon_kit.py +0 -144
  260. package/src/core-skills/bmad-deep-recon/types/academic-lit.md +0 -19
  261. package/src/core-skills/bmad-deep-recon/types/competitive.md +0 -19
  262. package/src/core-skills/bmad-deep-recon/types/domain.md +0 -19
  263. package/src/core-skills/bmad-deep-recon/types/market.md +0 -19
  264. package/src/core-skills/bmad-deep-recon/types/technical.md +0 -19
  265. package/src/core-skills/bmad-deep-recon/types/user-voice.md +0 -19
  266. package/src/core-skills/bmad-forge-idea/SKILL.md +0 -107
  267. package/src/core-skills/bmad-forge-idea/customize.toml +0 -41
  268. package/src/core-skills/bmad-forge-idea/scripts/resolve_personas.py +0 -277
  269. package/src/core-skills/bmad-forge-idea/scripts/tests/test_resolve_personas.py +0 -160
  270. package/src/core-skills/bmad-help/SKILL.md +0 -77
  271. package/src/core-skills/bmad-party-mode/SKILL.md +0 -60
  272. package/src/core-skills/bmad-party-mode/customize.toml +0 -211
  273. package/src/core-skills/bmad-party-mode/references/create-party.md +0 -70
  274. package/src/core-skills/bmad-party-mode/references/mode-agent-team.md +0 -13
  275. package/src/core-skills/bmad-party-mode/references/mode-auto.md +0 -13
  276. package/src/core-skills/bmad-party-mode/references/mode-subagent.md +0 -31
  277. package/src/core-skills/bmad-party-mode/references/party-memory.md +0 -51
  278. package/src/core-skills/bmad-party-mode/scripts/resolve_party.py +0 -300
  279. package/src/core-skills/bmad-party-mode/scripts/tests/test_resolve_party.py +0 -183
  280. package/src/core-skills/bmad-review/SKILL.md +0 -50
  281. package/src/core-skills/bmad-review/customize.toml +0 -141
  282. package/src/core-skills/bmad-review/references/editorial-common.md +0 -56
  283. package/src/core-skills/bmad-review/references/lens-adversarial.md +0 -19
  284. package/src/core-skills/bmad-review/references/lens-edge-case-hunter.md +0 -72
  285. package/src/core-skills/bmad-review/references/lens-prose.md +0 -7
  286. package/src/core-skills/bmad-review/references/lens-structure.md +0 -9
  287. package/src/core-skills/bmad-review/references/lens-verification-gap.md +0 -92
  288. package/src/core-skills/bmad-review/references/structure-models.md +0 -44
  289. package/src/core-skills/bmad-review/scripts/tests/test_word_metrics.py +0 -62
  290. package/src/core-skills/bmad-review/scripts/word_metrics.py +0 -102
  291. package/src/core-skills/module-help.csv +0 -10
  292. package/src/core-skills/module.yaml +0 -38
  293. package/src/core-skills/v6-shims/README.md +0 -25
  294. package/src/core-skills/v6-shims/bmad-editorial-review/SKILL.md +0 -8
  295. package/src/core-skills/v6-shims/bmad-editorial-review/customize.toml +0 -31
  296. package/src/core-skills/v6-shims/bmad-editorial-review-prose/SKILL.md +0 -8
  297. package/src/core-skills/v6-shims/bmad-editorial-review-structure/SKILL.md +0 -8
  298. package/src/core-skills/v6-shims/bmad-review-adversarial-general/SKILL.md +0 -8
  299. package/src/core-skills/v6-shims/bmad-review-edge-case-hunter/SKILL.md +0 -8
  300. package/src/core-skills/v6-shims/bmad-review-verification-gap/SKILL.md +0 -8
  301. package/src/scripts/__pycache__/config_utils.cpython-311.pyc +0 -0
  302. package/src/scripts/config_utils.py +0 -119
  303. package/src/scripts/memlog.py +0 -228
  304. package/src/scripts/render_skill.py +0 -401
  305. package/src/scripts/resolve_config.py +0 -82
  306. package/src/scripts/resolve_customization.py +0 -164
  307. package/src/scripts/tests/__pycache__/test_config_utils.cpython-311.pyc +0 -0
  308. package/src/scripts/tests/__pycache__/test_resolve_config.cpython-311.pyc +0 -0
  309. package/src/scripts/tests/__pycache__/test_resolve_customization.cpython-311.pyc +0 -0
  310. package/src/scripts/tests/test_config_utils.py +0 -85
  311. package/src/scripts/tests/test_memlog.py +0 -306
  312. package/src/scripts/tests/test_resolve_config.py +0 -117
  313. package/src/scripts/tests/test_resolve_customization.py +0 -179
  314. package/tools/bundle-web-bundles.js +0 -117
  315. package/tools/format-workflow-md.js +0 -263
  316. package/tools/installer/README.md +0 -60
  317. package/tools/installer/bmad-cli.js +0 -105
  318. package/tools/installer/cli-utils.js +0 -57
  319. package/tools/installer/commands/install.js +0 -151
  320. package/tools/installer/commands/status.js +0 -65
  321. package/tools/installer/commands/uninstall.js +0 -167
  322. package/tools/installer/core/config.js +0 -76
  323. package/tools/installer/core/existing-install.js +0 -121
  324. package/tools/installer/core/install-paths.js +0 -132
  325. package/tools/installer/core/installer.js +0 -1826
  326. package/tools/installer/core/legacy-warnings.js +0 -151
  327. package/tools/installer/core/manifest-generator.js +0 -883
  328. package/tools/installer/core/manifest.js +0 -439
  329. package/tools/installer/core/shim-policy.js +0 -159
  330. package/tools/installer/core/uv-check.js +0 -195
  331. package/tools/installer/core/wsl-node-check.js +0 -109
  332. package/tools/installer/file-ops.js +0 -204
  333. package/tools/installer/fs-native.js +0 -116
  334. package/tools/installer/ide/_config-driven.js +0 -972
  335. package/tools/installer/ide/manager.js +0 -324
  336. package/tools/installer/ide/platform-codes.js +0 -80
  337. package/tools/installer/ide/platform-codes.yaml +0 -363
  338. package/tools/installer/ide/shared/installed-skills.js +0 -50
  339. package/tools/installer/ide/shared/path-utils.js +0 -219
  340. package/tools/installer/ide/shared/skill-manifest.js +0 -57
  341. package/tools/installer/install-messages.yaml +0 -44
  342. package/tools/installer/list-options.js +0 -210
  343. package/tools/installer/message-loader.js +0 -83
  344. package/tools/installer/modules/channel-plan.js +0 -216
  345. package/tools/installer/modules/channel-resolver.js +0 -241
  346. package/tools/installer/modules/custom-module-manager.js +0 -924
  347. package/tools/installer/modules/external-manager.js +0 -673
  348. package/tools/installer/modules/git-env.js +0 -47
  349. package/tools/installer/modules/module-help-schema.js +0 -13
  350. package/tools/installer/modules/official-modules.js +0 -2289
  351. package/tools/installer/modules/plugin-resolver.js +0 -398
  352. package/tools/installer/modules/version-resolver.js +0 -336
  353. package/tools/installer/project-root.js +0 -224
  354. package/tools/installer/prompts.js +0 -804
  355. package/tools/installer/set-overrides.js +0 -330
  356. package/tools/installer/ui.js +0 -2225
  357. package/tools/installer/yaml-format.js +0 -245
  358. package/tools/javascript-conventions.md +0 -5
  359. package/tools/migrate-custom-module-paths.js +0 -124
  360. package/tools/skill-validator.md +0 -312
  361. package/tools/tests/__pycache__/test_validate_skills.cpython-311.pyc +0 -0
  362. package/tools/tests/fixtures/validate-skills/bmad/SKILL.md +0 -8
  363. package/tools/tests/fixtures/validate-skills/deprecated-shim/SKILL.md +0 -9
  364. package/tools/tests/fixtures/validate-skills/missing-trigger/SKILL.md +0 -9
  365. package/tools/tests/fixtures/validate-skills/with-trigger/SKILL.md +0 -8
  366. package/tools/tests/test_validate_skills.py +0 -476
  367. package/tools/validate-published-implementation-model.mjs +0 -59
  368. package/tools/validate-sidebar-order.js +0 -388
  369. package/tools/validate-svg-changes.sh +0 -356
  370. package/tools/validate_skills.py +0 -698
  371. package/web-bundles/README.md +0 -46
  372. package/web-bundles/brainstorming-coach/INSTRUCTIONS.md +0 -86
  373. package/web-bundles/brainstorming-coach/SKILL.md +0 -83
  374. package/web-bundles/brainstorming-coach/brain-methods.csv +0 -62
  375. package/web-bundles/bundles.json +0 -139
  376. package/web-bundles/market-and-industry-research/INSTRUCTIONS.md +0 -88
  377. package/web-bundles/market-and-industry-research/SKILL.md +0 -59
  378. package/web-bundles/prd-coach/INSTRUCTIONS.md +0 -86
  379. package/web-bundles/prd-coach/SKILL.md +0 -101
  380. package/web-bundles/prd-coach/prd-template.md +0 -165
  381. package/web-bundles/prd-coach/prd-validation-checklist.md +0 -135
  382. package/web-bundles/prfaq-coach/INSTRUCTIONS.md +0 -86
  383. package/web-bundles/prfaq-coach/SKILL.md +0 -139
  384. package/web-bundles/product-brief-coach/INSTRUCTIONS.md +0 -86
  385. package/web-bundles/product-brief-coach/SKILL.md +0 -113
  386. package/web-bundles/ux-coach/INSTRUCTIONS.md +0 -92
  387. package/web-bundles/ux-coach/SKILL.md +0 -187
  388. package/web-bundles/ux-coach/ux-validation.md +0 -100
package/src/agents.js ADDED
@@ -0,0 +1,141 @@
1
+ import { existsSync } from 'node:fs'
2
+ import { readFile } from 'node:fs/promises'
3
+ import { homedir } from 'node:os'
4
+ import { join } from 'node:path'
5
+ import { packageRoot } from './version.js'
6
+
7
+ /** @typedef {{ id: string, name: string, skillsDir: string, detect: string[] }} Agent */
8
+ /** @typedef {{ skillsVersion: string, agents: Agent[] }} AgentsFile */
9
+ /** @typedef {{ home: string, project: string, exists: (path: string) => boolean }} DetectContext */
10
+
11
+ const UNIVERSAL_DIR = '.agents/skills'
12
+ export const UNIVERSAL_AGENT = 'universal'
13
+
14
+ export class AgentsError extends Error {
15
+ /** @param {string} message */
16
+ constructor(message) {
17
+ super(message)
18
+ this.name = 'AgentsError'
19
+ }
20
+ }
21
+
22
+ /**
23
+ * @param {string} [filePath]
24
+ * @returns {Promise<Agent[]>}
25
+ */
26
+ export async function loadAgents(filePath = join(packageRoot, 'agents.json')) {
27
+ /** @type {AgentsFile} */
28
+ const file = JSON.parse(await readFile(filePath, 'utf8'))
29
+ return file.agents
30
+ }
31
+
32
+ /**
33
+ * @param {string} project
34
+ * @returns {DetectContext}
35
+ */
36
+ export function detectContext(project) {
37
+ return { home: homedir(), project, exists: existsSync }
38
+ }
39
+
40
+ /**
41
+ * @param {string} path
42
+ * @param {DetectContext} context
43
+ */
44
+ function expand(path, context) {
45
+ if (path === '~' || path.startsWith('~/')) return join(context.home, path.slice(1))
46
+ if (path.startsWith('./')) return join(context.project, path.slice(2))
47
+ return path
48
+ }
49
+
50
+ /**
51
+ * The agents the skills CLI would detect on this machine, from the paths agents.json records,
52
+ * not collapsed.
53
+ * @param {Agent[]} agents
54
+ * @param {DetectContext} context
55
+ * @returns {string[]}
56
+ */
57
+ export function detectAgents(agents, context) {
58
+ return agents
59
+ .filter((agent) => agent.detect.some((path) => context.exists(expand(path, context))))
60
+ .map((agent) => agent.id)
61
+ }
62
+
63
+ /** @param {Agent} agent */
64
+ export function isUniversal(agent) {
65
+ return agent.skillsDir === UNIVERSAL_DIR
66
+ }
67
+
68
+ /**
69
+ * Every agent that reads `.agents/skills` gets the same files, so they all become the one
70
+ * `universal` id, listed first.
71
+ * @param {string[]} ids
72
+ * @param {Agent[]} agents
73
+ * @returns {string[]}
74
+ */
75
+ export function collapseUniversal(ids, agents) {
76
+ const shared = new Set(agents.filter(isUniversal).map((agent) => agent.id))
77
+ const rest = ids.filter((id) => !shared.has(id))
78
+ const collapsed = ids.some((id) => shared.has(id)) ? [UNIVERSAL_AGENT, ...rest] : rest
79
+ return [...new Set(collapsed)]
80
+ }
81
+
82
+ /**
83
+ * The agents with a folder of their own whose copy in the project already holds `skill`.
84
+ * `.agents/skills` holding it says nothing about which of the agents sharing it the user wants.
85
+ * @param {Agent[]} agents
86
+ * @param {string} skill
87
+ * @param {DetectContext} context
88
+ * @returns {string[]}
89
+ */
90
+ export function agentsHolding(agents, skill, context) {
91
+ return agents
92
+ .filter((agent) => !isUniversal(agent))
93
+ .filter((agent) => context.exists(join(context.project, agent.skillsDir, skill)))
94
+ .map((agent) => agent.id)
95
+ }
96
+
97
+ /**
98
+ * @param {string} skill
99
+ * @param {DetectContext} context
100
+ */
101
+ export function sharedFolderHolds(skill, context) {
102
+ return context.exists(join(context.project, UNIVERSAL_DIR, skill))
103
+ }
104
+
105
+ /**
106
+ * Reads `--tools`, matching an id or a display name without regard to case.
107
+ * @param {string} value
108
+ * @param {Agent[]} agents
109
+ * @returns {string[]}
110
+ */
111
+ export function parseToolsFlag(value, agents) {
112
+ /** @type {string[]} */
113
+ const ids = []
114
+ /** @type {string[]} */
115
+ const unknown = []
116
+ for (const token of value.split(',')) {
117
+ const wanted = token.trim().toLowerCase()
118
+ if (wanted === '') continue
119
+ const agent = agents.find((entry) => entry.id.toLowerCase() === wanted || entry.name.toLowerCase() === wanted)
120
+ if (!agent) unknown.push(token.trim())
121
+ else if (!ids.includes(agent.id)) ids.push(agent.id)
122
+ }
123
+ if (unknown.length > 0) throw new AgentsError(unknown.join(', '))
124
+ if (ids.length === 0) throw new AgentsError(value)
125
+ return ids
126
+ }
127
+
128
+ /**
129
+ * Whether every one of `ids` has `skill` in its skills folder in the project.
130
+ * @param {Agent[]} agents
131
+ * @param {string[]} ids
132
+ * @param {string} skill
133
+ * @param {DetectContext} context
134
+ * @returns {boolean}
135
+ */
136
+ export function everyAgentHolds(agents, ids, skill, context) {
137
+ return ids.every((id) => {
138
+ const agent = agents.find((entry) => entry.id === id)
139
+ return agent !== undefined && context.exists(join(context.project, agent.skillsDir, skill))
140
+ })
141
+ }
@@ -0,0 +1,167 @@
1
+ import { dirname, join } from 'node:path'
2
+
3
+ /** @typedef {import('./run.js').Runner} Runner */
4
+
5
+ /** @typedef {{ state: 'current' | 'newer-available' | 'ahead' | 'differing-unordered', source: string, source_version: string }} ModuleUpdateChecked */
6
+ /** @typedef {{ state: 'could-not-check', source: string, reason: string }} ModuleUpdateUnchecked */
7
+ /** @typedef {{ state: 'plugin-managed', plugin: string, instruction: string }} ModuleUpdatePluginManaged */
8
+ /** @typedef {ModuleUpdateChecked | ModuleUpdateUnchecked | ModuleUpdatePluginManaged} ModuleUpdate */
9
+
10
+ /** @typedef {{ module: string, folder: string, version: string, update_source: string, skills: string[], absent_skills: string[], scripts: string, update: ModuleUpdate }} ModuleStatus */
11
+ /** @typedef {{ skill: string, bmod: string, source: string, channel: string, install: string | null }} MissingRecord */
12
+ /** @typedef {{ skill: string, module: string | null, requires: string, minimum: string, installed: string, state: 'missing' | 'outdated' | 'unknown-version' | 'unorderable', source: string, channel: string, install: string | null }} UnmetEntry */
13
+ /** @typedef {{ module: string, key: string, prompt: string, default: unknown, scope: string }} PendingQuestion */
14
+ /** @typedef {{ kind: string, message: string } & Record<string, unknown>} Problem */
15
+ /** @typedef {{ module: string, path: string, file: string, from: string, to: string, title: string }} Migration */
16
+
17
+ /**
18
+ * @typedef {{
19
+ * mode: string,
20
+ * module: string | null,
21
+ * bmad_exists: boolean,
22
+ * bmad: { skill: string, version: string | null, module: string | null },
23
+ * shared_scripts: string,
24
+ * custom_gitignore: string,
25
+ * modules: ModuleStatus[],
26
+ * missing_module_records: MissingRecord[],
27
+ * pending_questions: PendingQuestion[],
28
+ * unmet_requirements: UnmetEntry[],
29
+ * unmet_recommendations: UnmetEntry[],
30
+ * problems: Problem[],
31
+ * current: boolean,
32
+ * next: string | null
33
+ * }} StatusReport
34
+ */
35
+
36
+ /** The `next` a status report carries when all that is left is running setup. */
37
+ export const SETUP_NEXT = 'bmad setup'
38
+
39
+ export class BmadScriptsError extends Error {
40
+ /**
41
+ * @param {string} message
42
+ * @param {string} [stderr]
43
+ */
44
+ constructor(message, stderr = '') {
45
+ super(message)
46
+ this.name = 'BmadScriptsError'
47
+ this.stderr = stderr
48
+ }
49
+ }
50
+
51
+ /**
52
+ * @param {string} bmadSkillDir
53
+ * @param {string} projectRoot
54
+ * @returns {string[]}
55
+ */
56
+ export function setupStatusArgv(bmadSkillDir, projectRoot) {
57
+ return [
58
+ 'uv',
59
+ 'run',
60
+ '--no-cache',
61
+ join(bmadSkillDir, 'scripts', 'setup.py'),
62
+ '--project-root',
63
+ projectRoot,
64
+ '--skill',
65
+ bmadSkillDir,
66
+ '--status',
67
+ ]
68
+ }
69
+
70
+ /**
71
+ * @param {string} bmadSkillDir
72
+ * @returns {string[]}
73
+ */
74
+ export function knowledgeArgv(bmadSkillDir) {
75
+ return [
76
+ 'uv',
77
+ 'run',
78
+ '--no-cache',
79
+ join(bmadSkillDir, 'scripts', 'knowledge.py'),
80
+ '--root',
81
+ dirname(bmadSkillDir),
82
+ ]
83
+ }
84
+
85
+ /**
86
+ * @param {string} stdout
87
+ * @returns {StatusReport}
88
+ */
89
+ export function parseStatus(stdout) {
90
+ const parsed = parseJson(stdout, 'setup.py --status')
91
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
92
+ throw new BmadScriptsError('setup.py --status did not return an object')
93
+ }
94
+ return /** @type {StatusReport} */ (parsed)
95
+ }
96
+
97
+ /**
98
+ * @param {string} stdout
99
+ * @returns {Migration[]}
100
+ */
101
+ export function parseMigrations(stdout) {
102
+ const parsed = parseJson(stdout, 'knowledge.py')
103
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
104
+ throw new BmadScriptsError('knowledge.py did not return an object')
105
+ }
106
+ const migrations = /** @type {{ migrations?: unknown }} */ (parsed).migrations
107
+ return Array.isArray(migrations) ? /** @type {Migration[]} */ (migrations) : []
108
+ }
109
+
110
+ /**
111
+ * @param {{ runner: Runner }} deps
112
+ */
113
+ export function createBmadScripts(deps) {
114
+ const { runner } = deps
115
+
116
+ return {
117
+ /**
118
+ * @param {string} bmadSkillDir
119
+ * @param {string} projectRoot
120
+ * @returns {Promise<StatusReport>}
121
+ */
122
+ async status(bmadSkillDir, projectRoot) {
123
+ const result = await runner({ argv: setupStatusArgv(bmadSkillDir, projectRoot) })
124
+ const stderr = result.error ? `${result.stderr}${result.error}` : result.stderr
125
+ if (result.code !== 0) {
126
+ throw new BmadScriptsError(`setup.py --status exited with ${result.code}`, stderr)
127
+ }
128
+ try {
129
+ return parseStatus(result.stdout)
130
+ } catch (err) {
131
+ throw new BmadScriptsError(errorMessage(err), stderr)
132
+ }
133
+ },
134
+
135
+ /**
136
+ * @param {string} bmadSkillDir
137
+ * @returns {Promise<Migration[]>}
138
+ */
139
+ async migrations(bmadSkillDir) {
140
+ const result = await runner({ argv: knowledgeArgv(bmadSkillDir) })
141
+ if (result.code !== 0) return []
142
+ try {
143
+ return parseMigrations(result.stdout)
144
+ } catch {
145
+ return []
146
+ }
147
+ },
148
+ }
149
+ }
150
+
151
+ /**
152
+ * @param {string} stdout
153
+ * @param {string} what
154
+ * @returns {unknown}
155
+ */
156
+ function parseJson(stdout, what) {
157
+ try {
158
+ return JSON.parse(stdout)
159
+ } catch {
160
+ throw new BmadScriptsError(`${what} did not return JSON`)
161
+ }
162
+ }
163
+
164
+ /** @param {unknown} err */
165
+ function errorMessage(err) {
166
+ return err instanceof Error ? err.message : String(err)
167
+ }
package/src/cli.js ADDED
@@ -0,0 +1,266 @@
1
+ import { parseArgs } from 'node:util'
2
+ import { AgentsError, loadAgents, parseToolsFlag } from './agents.js'
3
+ import { BmadScriptsError, createBmadScripts } from './bmad-scripts.js'
4
+ import { install } from './commands/install.js'
5
+ import { status } from './commands/status.js'
6
+ import { update } from './commands/update.js'
7
+ import { MessagesError, loadMessages, message } from './messages.js'
8
+ import { ModulesError, UnknownModuleError, loadModules, parseModulesFlag } from './modules.js'
9
+ import { PreflightError } from './preflight.js'
10
+ import * as prompts from './prompts.js'
11
+ import { createRunner } from './run.js'
12
+ import { createSkillsCli } from './skills-cli.js'
13
+ import { packageName, version } from './version.js'
14
+
15
+ /** @typedef {{ command: 'install' | 'update' | 'status', directory?: string, modules?: string, tools?: string, yes: boolean, telemetry: boolean, copy: boolean, debug: boolean }} CliOptions */
16
+ /** @typedef {{ stdout: NodeJS.WriteStream, stderr: NodeJS.WriteStream, env: NodeJS.ProcessEnv, cwd: string }} Io */
17
+
18
+ const OPTIONS = /** @type {const} */ ({
19
+ directory: { type: 'string', short: 'd' },
20
+ modules: { type: 'string', short: 'm' },
21
+ tools: { type: 'string', short: 't' },
22
+ yes: { type: 'boolean', short: 'y' },
23
+ action: { type: 'string' },
24
+ copy: { type: 'boolean' },
25
+ 'list-tools': { type: 'boolean' },
26
+ debug: { type: 'boolean' },
27
+ help: { type: 'boolean', short: 'h' },
28
+ version: { type: 'boolean', short: 'v' },
29
+ })
30
+
31
+ const DROPPED_FLAGS = new Set([
32
+ 'custom-source', 'set', 'list-options', 'user-name', 'communication-language',
33
+ 'document-output-language', 'output-folder', 'channel', 'all-stable', 'all-next',
34
+ 'next', 'pin', 'shims', 'no-shims',
35
+ ])
36
+ const KNOWN_FLAGS = new Set([...Object.keys(OPTIONS), 'no-telemetry'])
37
+ const COMMANDS = new Set(['install', 'update', 'status'])
38
+ /** @type {Record<string, 'install' | 'update'>} */
39
+ const ACTIONS = { install: 'install', update: 'update', 'quick-update': 'update' }
40
+ const DROPPED_COMMAND = 'uninstall'
41
+ const HELP_HINT = `Run ${packageName} --help for the list of flags.`
42
+
43
+ const HELP = `${packageName} [install|update|status] [flags]
44
+
45
+ Commands
46
+ install Install BMad modules into a project (the default)
47
+ update Update the BMad skills already installed
48
+ status Show what is installed and what is still missing
49
+
50
+ Flags
51
+ -d, --directory <path> Project directory, default the current one
52
+ -m, --modules <codes> Modules to install, e.g. method,creative, method#dev or acme/repo/folder
53
+ -t, --tools <ids> Comma-separated coding agent ids to install to
54
+ --list-tools List the coding agent ids --tools takes
55
+ -y, --yes Take the defaults and ask nothing
56
+ --action <name> install, update or quick-update, for 6.12 scripts
57
+ --no-telemetry Turn off skills CLI telemetry and the skills.sh install counts
58
+ --copy Copy skills instead of linking, if symlinks fail on your system
59
+ --debug Print every child command, its cwd and its output to stderr
60
+ -h, --help Show this help
61
+ -v, --version Show the version`
62
+
63
+ export class UsageError extends Error {
64
+ name = 'UsageError'
65
+ }
66
+
67
+ /** @returns {string} */
68
+ export function helpText() {
69
+ return HELP
70
+ }
71
+
72
+ /**
73
+ * @param {import('./agents.js').Agent[]} agents
74
+ * @returns {string}
75
+ */
76
+ export function toolsText(agents) {
77
+ const width = Math.max(...agents.map((agent) => agent.id.length)) + 2
78
+ const nameWidth = Math.max(...agents.map((agent) => agent.name.length)) + 2
79
+ return agents.map((agent) => `${agent.id.padEnd(width)}${agent.name.padEnd(nameWidth)}${agent.skillsDir}`).join('\n')
80
+ }
81
+
82
+ /**
83
+ * @param {Record<string, unknown>} values
84
+ * @param {string} name
85
+ * @returns {string | undefined}
86
+ */
87
+ function textValue(values, name) {
88
+ const value = values[name]
89
+ if (value === undefined) return undefined
90
+ if (typeof value !== 'string') throw new UsageError(`--${name} needs a value`)
91
+ return value
92
+ }
93
+
94
+ /**
95
+ * Non-strict parsing stores `--copy=true` as the string "true", so presence among the tokens,
96
+ * not the parsed value, decides a boolean flag.
97
+ * @param {{ name: string }[]} flags
98
+ * @param {string} name
99
+ * @returns {boolean}
100
+ */
101
+ function flagGiven(flags, name) {
102
+ return flags.some((flag) => flag.name === name)
103
+ }
104
+
105
+ /**
106
+ * @param {Record<string, unknown>} values
107
+ * @param {string[]} positionals
108
+ * @returns {'install' | 'update' | 'status'}
109
+ */
110
+ function readCommand(values, positionals) {
111
+ const [first, ...rest] = positionals
112
+ if (rest.length > 0) throw new UsageError(`unexpected argument ${rest[0]}`)
113
+ if (first !== undefined && !COMMANDS.has(first)) throw new UsageError(`unknown command ${first}`)
114
+ const action = textValue(values, 'action')
115
+ if (action === undefined) return /** @type {'install' | 'update' | 'status'} */ (first ?? 'install')
116
+ const mapped = ACTIONS[action]
117
+ if (!mapped) throw new UsageError(`unknown --action ${action}`)
118
+ return mapped
119
+ }
120
+
121
+ /**
122
+ * Dropped flags are read from the tokens before anything else, so a 6.12 command line
123
+ * explains itself instead of failing on a stray positional.
124
+ * @param {string[]} argv
125
+ * @param {Record<string, any>} messages
126
+ * @returns {{ kind: 'run', options: CliOptions } | { kind: 'help' } | { kind: 'version' } | { kind: 'listTools' } | { kind: 'dropped', text: string }}
127
+ */
128
+ export function parseCli(argv, messages) {
129
+ const parsed = parseArgs({ args: argv, options: OPTIONS, allowPositionals: true, strict: false, tokens: true })
130
+ const values = /** @type {Record<string, unknown>} */ (parsed.values)
131
+ const flags = (parsed.tokens ?? []).flatMap((token) => (token.kind === 'option' ? [token] : []))
132
+
133
+ const dropped = flags.filter((flag) => DROPPED_FLAGS.has(flag.name))
134
+ if (dropped.length > 0) {
135
+ return { kind: 'dropped', text: dropped.map((flag) => message(messages, `droppedFlags.${flag.name}`)).join('\n') }
136
+ }
137
+ if (parsed.positionals.includes(DROPPED_COMMAND)) {
138
+ return { kind: 'dropped', text: message(messages, 'droppedUninstall') }
139
+ }
140
+
141
+ const unknown = flags.find((flag) => !KNOWN_FLAGS.has(flag.name))
142
+ if (unknown) throw new UsageError(`unknown flag ${unknown.rawName}`)
143
+
144
+ if (flagGiven(flags, 'help')) return { kind: 'help' }
145
+ if (flagGiven(flags, 'version')) return { kind: 'version' }
146
+ if (flagGiven(flags, 'list-tools')) return { kind: 'listTools' }
147
+
148
+ return {
149
+ kind: 'run',
150
+ options: {
151
+ command: readCommand(values, parsed.positionals),
152
+ directory: textValue(values, 'directory'),
153
+ modules: textValue(values, 'modules'),
154
+ tools: textValue(values, 'tools'),
155
+ yes: flagGiven(flags, 'yes'),
156
+ telemetry: !flagGiven(flags, 'no-telemetry'),
157
+ copy: flagGiven(flags, 'copy'),
158
+ debug: flagGiven(flags, 'debug'),
159
+ },
160
+ }
161
+ }
162
+
163
+ /**
164
+ * @param {unknown} err
165
+ * @param {Io} io
166
+ * @param {{ debug: boolean, messages: Record<string, any> | null }} context
167
+ * @returns {number}
168
+ */
169
+ export function reportError(err, io, context) {
170
+ if (err instanceof prompts.Cancelled && context.messages) {
171
+ prompts.fail(message(context.messages, 'cancelled'))
172
+ return 1
173
+ }
174
+ if (err instanceof PreflightError) {
175
+ prompts.fail(err.message)
176
+ return 1
177
+ }
178
+ if (err instanceof UsageError) {
179
+ io.stderr.write(`${err.message}\n${HELP_HINT}\n`)
180
+ return 2
181
+ }
182
+ if (err instanceof UnknownModuleError && context.messages) {
183
+ io.stderr.write(`${message(context.messages, 'unknownModules', { codes: err.code, known: err.known })}\n`)
184
+ return 2
185
+ }
186
+ if (err instanceof AgentsError && context.messages) {
187
+ io.stderr.write(`${message(context.messages, 'unknownTools', { ids: err.message })}\n`)
188
+ return 2
189
+ }
190
+ if (err instanceof BmadScriptsError) {
191
+ io.stderr.write(`${[err.message, err.stderr.trim()].filter(Boolean).join('\n')}\n`)
192
+ return 1
193
+ }
194
+ if (err instanceof MessagesError || err instanceof ModulesError) {
195
+ io.stderr.write(`${err.message}\n`)
196
+ return 1
197
+ }
198
+ const detail = err instanceof Error ? ((context.debug && err.stack) || err.message) : String(err)
199
+ io.stderr.write(`${detail}\n`)
200
+ return 1
201
+ }
202
+
203
+ /**
204
+ * @param {string[]} argv
205
+ * @param {Io} [io]
206
+ * @returns {Promise<number>}
207
+ */
208
+ export async function main(argv, io) {
209
+ const out = io ?? { stdout: process.stdout, stderr: process.stderr, env: process.env, cwd: process.cwd() }
210
+ /** @type {Record<string, any> | null} */
211
+ let messages = null
212
+ let debug = false
213
+
214
+ try {
215
+ messages = await loadMessages()
216
+ const parsed = parseCli(argv, messages)
217
+ if (parsed.kind === 'help') {
218
+ out.stdout.write(`${helpText()}\n`)
219
+ return 0
220
+ }
221
+ if (parsed.kind === 'version') {
222
+ out.stdout.write(`${version}\n`)
223
+ return 0
224
+ }
225
+ if (parsed.kind === 'listTools') {
226
+ out.stdout.write(`${toolsText(await loadAgents())}\n`)
227
+ return 0
228
+ }
229
+ if (parsed.kind === 'dropped') {
230
+ out.stderr.write(`${parsed.text}\n`)
231
+ return 2
232
+ }
233
+
234
+ const options = parsed.options
235
+ debug = options.debug
236
+ const modules = await loadModules()
237
+ const agents = await loadAgents()
238
+ if (options.tools) parseToolsFlag(options.tools, agents)
239
+ if (options.modules) parseModulesFlag(options.modules, modules)
240
+ const runner = createRunner({ debug, log: (line) => out.stderr.write(`${line}\n`) })
241
+ const deps = {
242
+ runner,
243
+ skillsCli: createSkillsCli({
244
+ runner,
245
+ env: out.env,
246
+ telemetry: options.telemetry,
247
+ copy: options.copy,
248
+ metadata: { installer: packageName, version },
249
+ }),
250
+ bmadScripts: createBmadScripts({ runner }),
251
+ messages,
252
+ modules,
253
+ agents,
254
+ prompts,
255
+ env: out.env,
256
+ cwd: out.cwd,
257
+ version,
258
+ }
259
+
260
+ if (options.command === 'update') return await update(options, deps)
261
+ if (options.command === 'status') return await status(options, deps)
262
+ return await install(options, deps)
263
+ } catch (err) {
264
+ return reportError(err, out, { debug, messages })
265
+ }
266
+ }
@@ -0,0 +1,67 @@
1
+ import {
2
+ UNIVERSAL_AGENT,
3
+ agentsHolding,
4
+ collapseUniversal,
5
+ detectAgents,
6
+ detectContext,
7
+ isUniversal,
8
+ parseToolsFlag,
9
+ sharedFolderHolds,
10
+ } from '../agents.js'
11
+ import { lastPickedAgents, saveAgentPick, savedAgentPick } from '../agent-picks.js'
12
+ import { BMAD_SKILL } from '../installed.js'
13
+
14
+ /** @typedef {import('../cli.js').CliOptions} CliOptions */
15
+ /** @typedef {import('./deps.js').CommandDeps} CommandDeps */
16
+
17
+ /**
18
+ * The agents an install goes to. `--tools` wins. Otherwise the picker ticks the agents with their
19
+ * own folder already holding BMad here, plus the shared-folder agents of the last pick when
20
+ * `.agents/skills` holds it; with neither, the last pick. The last pick is our own saved one, else
21
+ * the skills CLI's without its shared-folder agents. `--yes` takes those same ticks; with none,
22
+ * the agents whose config folder is in the home folder, the way the skills CLI's own `--yes`
23
+ * picks, or `universal` alone.
24
+ * @param {CliOptions} options
25
+ * @param {CommandDeps} deps
26
+ * @param {string} directory
27
+ * @param {boolean} interactive
28
+ * @returns {Promise<string[]>}
29
+ */
30
+ export async function agentsToInstall(options, deps, directory, interactive) {
31
+ const { agents, messages, prompts } = deps
32
+ if (options.tools) return parseToolsFlag(options.tools, agents)
33
+ const context = (deps.detect ?? detectContext)(directory)
34
+ const listed = agents.filter((agent) => agent.id !== UNIVERSAL_AGENT)
35
+ const shared = new Set(listed.filter(isUniversal).map((agent) => agent.id))
36
+ // The skills CLI saves every shared-folder agent it shows as locked, so its pick says nothing about those.
37
+ const saved = (await savedAgentPick(deps.env)) ?? (await lastPickedAgents(deps.env)).filter((id) => !shared.has(id))
38
+ const last = saved.filter((id) => listed.some((agent) => agent.id === id))
39
+ const holding = [
40
+ ...agentsHolding(agents, BMAD_SKILL, context),
41
+ ...(sharedFolderHolds(BMAD_SKILL, context) ? last.filter((id) => shared.has(id)) : []),
42
+ ]
43
+ const initial = holding.length > 0 ? holding : last
44
+
45
+ if (!interactive) {
46
+ if (initial.length > 0) return initial
47
+ const detected = collapseUniversal(detectAgents(agents, context), agents)
48
+ return detected.length > 0 ? detected : [UNIVERSAL_AGENT]
49
+ }
50
+ const picked = await prompts.chooseAgents(messages, agents, { initial })
51
+ await saveAgentPick(picked, deps.env)
52
+ return picked
53
+ }
54
+
55
+ /**
56
+ * The agents an update goes to: those whose project folder already holds BMad, with `universal`
57
+ * for `.agents/skills`.
58
+ * @param {CommandDeps} deps
59
+ * @param {string} directory
60
+ * @returns {string[]}
61
+ */
62
+ export function agentsToUpdate(deps, directory) {
63
+ const context = (deps.detect ?? detectContext)(directory)
64
+ const own = agentsHolding(deps.agents, BMAD_SKILL, context)
65
+ const agents = sharedFolderHolds(BMAD_SKILL, context) ? [UNIVERSAL_AGENT, ...own] : own
66
+ return agents.length > 0 ? agents : [UNIVERSAL_AGENT]
67
+ }
@@ -0,0 +1,38 @@
1
+ import { inspectInstall } from '../installed.js'
2
+ import { message } from '../messages.js'
3
+
4
+ /** @typedef {import('../bmad-scripts.js').StatusReport} StatusReport */
5
+ /** @typedef {import('../skills-cli.js').AddResult} AddResult */
6
+ /** @typedef {import('../skills-cli.js').ListedSkill} ListedSkill */
7
+ /** @typedef {import('./deps.js').CommandDeps} CommandDeps */
8
+ /** @typedef {import('./install-plan.js').InstallCall} InstallCall */
9
+
10
+ /**
11
+ * Runs one `skills add` per call under a single spinner, then reads the install back. `plan` runs
12
+ * inside the spinner, so a plan that has to read the install first shows no second spinner.
13
+ * `report` is null when the `bmad` skill is nowhere in the project afterwards or when `hasUv` is false.
14
+ * @param {CommandDeps} deps
15
+ * @param {{ directory: string, agents: string[], spinner: 'installingSpinner' | 'updatingSpinner', plan: () => Promise<InstallCall[]> | InstallCall[], bmadSkillDir?: string | null, hasUv?: boolean }} run
16
+ * @returns {Promise<{ failures: AddResult[], bmadSkillDir: string | null, report: StatusReport | null, skills: ListedSkill[] }>}
17
+ */
18
+ export async function applyCalls(deps, run) {
19
+ const { bmadScripts, messages, prompts, skillsCli } = deps
20
+ const { directory, agents } = run
21
+ /** @type {AddResult[]} */
22
+ const failures = []
23
+ const progress = prompts.startSpinner(message(messages, 'statusSpinner'))
24
+ try {
25
+ for (const call of await run.plan()) {
26
+ progress.update(message(messages, run.spinner, { what: call.label }))
27
+ const results = await skillsCli.add({ source: call.source, skills: call.skills, agents, cwd: directory })
28
+ failures.push(...results.filter((entry) => entry.status !== 'installed'))
29
+ }
30
+ const after = await inspectInstall(directory, skillsCli)
31
+ const bmadSkillDir = after.bmadSkillDir ?? run.bmadSkillDir ?? null
32
+ if (!bmadSkillDir || run.hasUv === false) return { failures, bmadSkillDir, report: null, skills: after.skills }
33
+ progress.update(message(messages, 'statusSpinner'))
34
+ return { failures, bmadSkillDir, report: await bmadScripts.status(bmadSkillDir, directory), skills: after.skills }
35
+ } finally {
36
+ progress.stop()
37
+ }
38
+ }