bmad-method 6.12.4 → 7.1.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 (389) 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 +267 -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 +66 -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 +128 -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/pr2.md +0 -11
  43. package/removals.txt +0 -87
  44. package/src/bmm-skills/agents/bmad-agent-analyst/SKILL.md +0 -76
  45. package/src/bmm-skills/agents/bmad-agent-analyst/customize.toml +0 -103
  46. package/src/bmm-skills/agents/bmad-agent-architect/SKILL.md +0 -76
  47. package/src/bmm-skills/agents/bmad-agent-architect/customize.toml +0 -63
  48. package/src/bmm-skills/agents/bmad-agent-dev/SKILL.md +0 -76
  49. package/src/bmm-skills/agents/bmad-agent-dev/customize.toml +0 -81
  50. package/src/bmm-skills/agents/bmad-agent-pm/SKILL.md +0 -76
  51. package/src/bmm-skills/agents/bmad-agent-pm/customize.toml +0 -73
  52. package/src/bmm-skills/agents/bmad-agent-ux-designer/SKILL.md +0 -76
  53. package/src/bmm-skills/agents/bmad-agent-ux-designer/customize.toml +0 -58
  54. package/src/bmm-skills/module-help.csv +0 -19
  55. package/src/bmm-skills/module.yaml +0 -85
  56. package/src/bmm-skills/plan/bmad-architecture/SKILL.md +0 -85
  57. package/src/bmm-skills/plan/bmad-architecture/assets/spine-template.md +0 -79
  58. package/src/bmm-skills/plan/bmad-architecture/customize.toml +0 -101
  59. package/src/bmm-skills/plan/bmad-architecture/references/headless.md +0 -26
  60. package/src/bmm-skills/plan/bmad-architecture/references/reviewer-gate.md +0 -13
  61. package/src/bmm-skills/plan/bmad-architecture/scripts/lint_spine.py +0 -261
  62. package/src/bmm-skills/plan/bmad-architecture/scripts/tests/test_lint_spine.py +0 -270
  63. package/src/bmm-skills/plan/bmad-create-epics-and-stories/SKILL.md +0 -93
  64. package/src/bmm-skills/plan/bmad-create-epics-and-stories/customize.toml +0 -39
  65. package/src/bmm-skills/plan/bmad-create-epics-and-stories/steps/step-01-validate-prerequisites.md +0 -263
  66. package/src/bmm-skills/plan/bmad-create-epics-and-stories/steps/step-02-design-epics.md +0 -242
  67. package/src/bmm-skills/plan/bmad-create-epics-and-stories/steps/step-03-create-stories.md +0 -255
  68. package/src/bmm-skills/plan/bmad-create-epics-and-stories/steps/step-04-final-validation.md +0 -141
  69. package/src/bmm-skills/plan/bmad-create-epics-and-stories/templates/epics-template.md +0 -62
  70. package/src/bmm-skills/plan/bmad-generate-project-context/SKILL.md +0 -12
  71. package/src/bmm-skills/plan/bmad-prd/SKILL.md +0 -94
  72. package/src/bmm-skills/plan/bmad-prd/assets/headless-schemas.md +0 -76
  73. package/src/bmm-skills/plan/bmad-prd/assets/prd-template.md +0 -165
  74. package/src/bmm-skills/plan/bmad-prd/assets/prd-validation-checklist.md +0 -135
  75. package/src/bmm-skills/plan/bmad-prd/assets/validation-report-template.html +0 -325
  76. package/src/bmm-skills/plan/bmad-prd/customize.toml +0 -148
  77. package/src/bmm-skills/plan/bmad-prd/references/headless.md +0 -39
  78. package/src/bmm-skills/plan/bmad-prd/references/validate.md +0 -97
  79. package/src/bmm-skills/plan/bmad-prfaq/SKILL.md +0 -135
  80. package/src/bmm-skills/plan/bmad-prfaq/agents/artifact-analyzer.md +0 -60
  81. package/src/bmm-skills/plan/bmad-prfaq/agents/web-researcher.md +0 -49
  82. package/src/bmm-skills/plan/bmad-prfaq/assets/prfaq-template.md +0 -62
  83. package/src/bmm-skills/plan/bmad-prfaq/bmad-manifest.json +0 -16
  84. package/src/bmm-skills/plan/bmad-prfaq/customize.toml +0 -39
  85. package/src/bmm-skills/plan/bmad-prfaq/references/customer-faq.md +0 -55
  86. package/src/bmm-skills/plan/bmad-prfaq/references/internal-faq.md +0 -51
  87. package/src/bmm-skills/plan/bmad-prfaq/references/press-release.md +0 -60
  88. package/src/bmm-skills/plan/bmad-prfaq/references/verdict.md +0 -83
  89. package/src/bmm-skills/plan/bmad-product-brief/SKILL.md +0 -91
  90. package/src/bmm-skills/plan/bmad-product-brief/assets/brief-template.md +0 -41
  91. package/src/bmm-skills/plan/bmad-product-brief/customize.toml +0 -100
  92. package/src/bmm-skills/plan/bmad-project-context/SKILL.md +0 -121
  93. package/src/bmm-skills/plan/bmad-project-context/customize.toml +0 -24
  94. package/src/bmm-skills/plan/bmad-project-context/references/best-practices.md +0 -84
  95. package/src/bmm-skills/plan/bmad-project-context/references/template.md +0 -55
  96. package/src/bmm-skills/plan/bmad-spec/SKILL.md +0 -160
  97. package/src/bmm-skills/plan/bmad-spec/assets/headless-schemas.md +0 -33
  98. package/src/bmm-skills/plan/bmad-spec/assets/spec-template.md +0 -49
  99. package/src/bmm-skills/plan/bmad-spec/assets/stories-schema.md +0 -44
  100. package/src/bmm-skills/plan/bmad-spec/customize.toml +0 -52
  101. package/src/bmm-skills/plan/bmad-sprint-planning/SKILL.md +0 -62
  102. package/src/bmm-skills/plan/bmad-sprint-planning/customize.toml +0 -39
  103. package/src/bmm-skills/plan/bmad-sprint-planning/references/fix-sprint-status.md +0 -30
  104. package/src/bmm-skills/plan/bmad-sprint-planning/references/generate-tracking.md +0 -25
  105. package/src/bmm-skills/plan/bmad-sprint-planning/references/readiness-gate.md +0 -20
  106. package/src/bmm-skills/plan/bmad-sprint-planning/references/status-view.md +0 -14
  107. package/src/bmm-skills/plan/bmad-sprint-planning/references/validate.md +0 -10
  108. package/src/bmm-skills/plan/bmad-sprint-planning/scripts/__pycache__/sprint_plan.cpython-311.pyc +0 -0
  109. package/src/bmm-skills/plan/bmad-sprint-planning/scripts/sprint_plan.py +0 -701
  110. package/src/bmm-skills/plan/bmad-sprint-planning/scripts/tests/__pycache__/test_sprint_plan.cpython-311-pytest-9.1.1.pyc +0 -0
  111. package/src/bmm-skills/plan/bmad-sprint-planning/scripts/tests/test_sprint_plan.py +0 -524
  112. package/src/bmm-skills/plan/bmad-sprint-planning/sprint-status-template.yaml +0 -71
  113. package/src/bmm-skills/plan/bmad-ux/SKILL.md +0 -90
  114. package/src/bmm-skills/plan/bmad-ux/assets/color-themes.md +0 -9
  115. package/src/bmm-skills/plan/bmad-ux/assets/design-directions.md +0 -9
  116. package/src/bmm-skills/plan/bmad-ux/assets/design-example-editorial.md +0 -158
  117. package/src/bmm-skills/plan/bmad-ux/assets/design-example-mobile.md +0 -93
  118. package/src/bmm-skills/plan/bmad-ux/assets/design-example-shadcn.md +0 -109
  119. package/src/bmm-skills/plan/bmad-ux/assets/excalidraw-wireframe.md +0 -19
  120. package/src/bmm-skills/plan/bmad-ux/assets/experience-example-mobile.md +0 -112
  121. package/src/bmm-skills/plan/bmad-ux/assets/experience-example-shadcn.md +0 -133
  122. package/src/bmm-skills/plan/bmad-ux/assets/headless-schemas.md +0 -84
  123. package/src/bmm-skills/plan/bmad-ux/assets/key-screens.md +0 -29
  124. package/src/bmm-skills/plan/bmad-ux/assets/validation-report-template.html +0 -319
  125. package/src/bmm-skills/plan/bmad-ux/customize.toml +0 -100
  126. package/src/bmm-skills/plan/bmad-ux/references/creative-tools.md +0 -19
  127. package/src/bmm-skills/plan/bmad-ux/references/design-md-spec.md +0 -50
  128. package/src/bmm-skills/plan/bmad-ux/references/headless.md +0 -37
  129. package/src/bmm-skills/plan/bmad-ux/references/validate.md +0 -115
  130. package/src/bmm-skills/ship/bmad-build/SKILL.md +0 -13
  131. package/src/bmm-skills/ship/bmad-build/compile-epic-context.md +0 -62
  132. package/src/bmm-skills/ship/bmad-build/customize.toml +0 -152
  133. package/src/bmm-skills/ship/bmad-build/references/claims-check.md +0 -14
  134. package/src/bmm-skills/ship/bmad-build/references/deletion-check.md +0 -14
  135. package/src/bmm-skills/ship/bmad-build/review-prompts/edge-case-hunter.md +0 -112
  136. package/src/bmm-skills/ship/bmad-build/review-prompts/verification-gap.md +0 -113
  137. package/src/bmm-skills/ship/bmad-build/spec-template.md +0 -111
  138. package/src/bmm-skills/ship/bmad-build/step-01-clarify-and-route.md +0 -100
  139. package/src/bmm-skills/ship/bmad-build/step-02-plan.md +0 -62
  140. package/src/bmm-skills/ship/bmad-build/step-03-implement.md +0 -51
  141. package/src/bmm-skills/ship/bmad-build/step-04-review.md +0 -85
  142. package/src/bmm-skills/ship/bmad-build/step-05-present.md +0 -43
  143. package/src/bmm-skills/ship/bmad-build/step-oneshot.md +0 -107
  144. package/src/bmm-skills/ship/bmad-build/sync-sprint-status.md +0 -5
  145. package/src/bmm-skills/ship/bmad-build/workflow.md +0 -84
  146. package/src/bmm-skills/ship/bmad-build-auto/SKILL.md +0 -13
  147. package/src/bmm-skills/ship/bmad-build-auto/compile-epic-context.md +0 -62
  148. package/src/bmm-skills/ship/bmad-build-auto/customize.toml +0 -119
  149. package/src/bmm-skills/ship/bmad-build-auto/references/claims-check.md +0 -14
  150. package/src/bmm-skills/ship/bmad-build-auto/references/deletion-check.md +0 -14
  151. package/src/bmm-skills/ship/bmad-build-auto/review-prompts/edge-case-hunter.md +0 -112
  152. package/src/bmm-skills/ship/bmad-build-auto/review-prompts/verification-gap.md +0 -113
  153. package/src/bmm-skills/ship/bmad-build-auto/spec-template.md +0 -96
  154. package/src/bmm-skills/ship/bmad-build-auto/step-01-clarify-and-route.md +0 -84
  155. package/src/bmm-skills/ship/bmad-build-auto/step-02-plan.md +0 -27
  156. package/src/bmm-skills/ship/bmad-build-auto/step-03-implement.md +0 -48
  157. package/src/bmm-skills/ship/bmad-build-auto/step-04-review.md +0 -116
  158. package/src/bmm-skills/ship/bmad-build-auto/workflow.md +0 -104
  159. package/src/bmm-skills/ship/bmad-code-review/SKILL.md +0 -90
  160. package/src/bmm-skills/ship/bmad-code-review/customize.toml +0 -110
  161. package/src/bmm-skills/ship/bmad-code-review/references/claims-check.md +0 -14
  162. package/src/bmm-skills/ship/bmad-code-review/references/deletion-check.md +0 -14
  163. package/src/bmm-skills/ship/bmad-code-review/review-prompts/edge-case-hunter.md +0 -112
  164. package/src/bmm-skills/ship/bmad-code-review/review-prompts/verification-gap.md +0 -113
  165. package/src/bmm-skills/ship/bmad-code-review/steps/step-01-gather-context.md +0 -94
  166. package/src/bmm-skills/ship/bmad-code-review/steps/step-02-review.md +0 -32
  167. package/src/bmm-skills/ship/bmad-code-review/steps/step-03-triage.md +0 -54
  168. package/src/bmm-skills/ship/bmad-code-review/steps/step-04-present.md +0 -134
  169. package/src/bmm-skills/ship/bmad-correct-course/SKILL.md +0 -308
  170. package/src/bmm-skills/ship/bmad-correct-course/checklist.md +0 -288
  171. package/src/bmm-skills/ship/bmad-correct-course/customize.toml +0 -39
  172. package/src/bmm-skills/ship/bmad-qa-generate-e2e-tests/SKILL.md +0 -176
  173. package/src/bmm-skills/ship/bmad-qa-generate-e2e-tests/checklist.md +0 -33
  174. package/src/bmm-skills/ship/bmad-qa-generate-e2e-tests/customize.toml +0 -39
  175. package/src/bmm-skills/ship/bmad-retrospective/SKILL.md +0 -94
  176. package/src/bmm-skills/ship/bmad-retrospective/customize.toml +0 -39
  177. package/src/bmm-skills/ship/bmad-retrospective/references/acceptance-verdict.md +0 -55
  178. package/src/bmm-skills/ship/bmad-retrospective/references/aggregate-views.md +0 -17
  179. package/src/bmm-skills/ship/bmad-retrospective/references/evidence-gathering.md +0 -30
  180. package/src/bmm-skills/ship/bmad-retrospective/references/retro-document.md +0 -84
  181. package/src/bmm-skills/ship/bmad-retrospective/references/team-discussion.md +0 -22
  182. package/src/bmm-skills/ship/bmad-retrospective/scripts/__pycache__/sprint_status.cpython-311.pyc +0 -0
  183. package/src/bmm-skills/ship/bmad-retrospective/scripts/git_evidence.py +0 -308
  184. package/src/bmm-skills/ship/bmad-retrospective/scripts/sprint_status.py +0 -750
  185. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/__pycache__/test_git_evidence.cpython-311-pytest-9.1.1.pyc +0 -0
  186. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/__pycache__/test_sprint_status.cpython-311-pytest-9.1.1.pyc +0 -0
  187. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/fixtures/sprint-status-template.yaml +0 -71
  188. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/test_git_evidence.py +0 -750
  189. package/src/bmm-skills/ship/bmad-retrospective/scripts/tests/test_sprint_status.py +0 -1579
  190. package/src/bmm-skills/ship/bmad-walkthrough/SKILL.md +0 -68
  191. package/src/bmm-skills/ship/bmad-walkthrough/customize.toml +0 -39
  192. package/src/bmm-skills/ship/bmad-walkthrough/generate-trail.md +0 -38
  193. package/src/bmm-skills/ship/bmad-walkthrough/step-01-orientation.md +0 -105
  194. package/src/bmm-skills/ship/bmad-walkthrough/step-02-walkthrough.md +0 -89
  195. package/src/bmm-skills/ship/bmad-walkthrough/step-03-detail-pass.md +0 -106
  196. package/src/bmm-skills/ship/bmad-walkthrough/step-04-testing.md +0 -74
  197. package/src/bmm-skills/ship/bmad-walkthrough/step-05-wrapup.md +0 -30
  198. package/src/bmm-skills/v6-shims/README.md +0 -29
  199. package/src/bmm-skills/v6-shims/bmad-checkpoint-preview/SKILL.md +0 -21
  200. package/src/bmm-skills/v6-shims/bmad-create-architecture/SKILL.md +0 -32
  201. package/src/bmm-skills/v6-shims/bmad-create-architecture/customize.toml +0 -39
  202. package/src/bmm-skills/v6-shims/bmad-create-prd/SKILL.md +0 -32
  203. package/src/bmm-skills/v6-shims/bmad-create-prd/customize.toml +0 -39
  204. package/src/bmm-skills/v6-shims/bmad-create-story/SKILL.md +0 -436
  205. package/src/bmm-skills/v6-shims/bmad-create-story/checklist.md +0 -357
  206. package/src/bmm-skills/v6-shims/bmad-create-story/customize.toml +0 -39
  207. package/src/bmm-skills/v6-shims/bmad-create-story/discover-inputs.md +0 -88
  208. package/src/bmm-skills/v6-shims/bmad-create-story/template.md +0 -49
  209. package/src/bmm-skills/v6-shims/bmad-dev-auto/SKILL.md +0 -21
  210. package/src/bmm-skills/v6-shims/bmad-dev-story/SKILL.md +0 -504
  211. package/src/bmm-skills/v6-shims/bmad-dev-story/checklist.md +0 -80
  212. package/src/bmm-skills/v6-shims/bmad-dev-story/customize.toml +0 -39
  213. package/src/bmm-skills/v6-shims/bmad-document-project/SKILL.md +0 -16
  214. package/src/bmm-skills/v6-shims/bmad-domain-research/SKILL.md +0 -16
  215. package/src/bmm-skills/v6-shims/bmad-edit-prd/SKILL.md +0 -32
  216. package/src/bmm-skills/v6-shims/bmad-edit-prd/customize.toml +0 -40
  217. package/src/bmm-skills/v6-shims/bmad-market-research/SKILL.md +0 -16
  218. package/src/bmm-skills/v6-shims/bmad-quick-dev/SKILL.md +0 -21
  219. package/src/bmm-skills/v6-shims/bmad-sprint-status/SKILL.md +0 -28
  220. package/src/bmm-skills/v6-shims/bmad-sprint-status/customize.toml +0 -39
  221. package/src/bmm-skills/v6-shims/bmad-technical-research/SKILL.md +0 -16
  222. package/src/bmm-skills/v6-shims/bmad-validate-prd/SKILL.md +0 -32
  223. package/src/bmm-skills/v6-shims/bmad-validate-prd/customize.toml +0 -40
  224. package/src/core-skills/bmad-advanced-elicitation/SKILL.md +0 -64
  225. package/src/core-skills/bmad-advanced-elicitation/assets/methods.csv +0 -72
  226. package/src/core-skills/bmad-advanced-elicitation/customize.toml +0 -54
  227. package/src/core-skills/bmad-advanced-elicitation/scripts/pick_methods.py +0 -233
  228. package/src/core-skills/bmad-advanced-elicitation/scripts/tests/test_pick_methods.py +0 -228
  229. package/src/core-skills/bmad-brainstorming/SKILL.md +0 -80
  230. package/src/core-skills/bmad-brainstorming/assets/brain-icons.json +0 -166
  231. package/src/core-skills/bmad-brainstorming/assets/brain-methods.csv +0 -109
  232. package/src/core-skills/bmad-brainstorming/assets/brain-selector.html +0 -328
  233. package/src/core-skills/bmad-brainstorming/customize.toml +0 -83
  234. package/src/core-skills/bmad-brainstorming/references/converge.md +0 -24
  235. package/src/core-skills/bmad-brainstorming/references/finalize.md +0 -26
  236. package/src/core-skills/bmad-brainstorming/references/headless.md +0 -54
  237. package/src/core-skills/bmad-brainstorming/references/in-chat-techniques.md +0 -18
  238. package/src/core-skills/bmad-brainstorming/references/mode-autonomous.md +0 -10
  239. package/src/core-skills/bmad-brainstorming/references/mode-facilitator.md +0 -11
  240. package/src/core-skills/bmad-brainstorming/references/mode-partner.md +0 -16
  241. package/src/core-skills/bmad-brainstorming/references/resume.md +0 -5
  242. package/src/core-skills/bmad-brainstorming/scripts/brain.py +0 -789
  243. package/src/core-skills/bmad-brainstorming/scripts/tests/test_brain.py +0 -289
  244. package/src/core-skills/bmad-customize/SKILL.md +0 -111
  245. package/src/core-skills/bmad-customize/scripts/list_customizable_skills.py +0 -235
  246. package/src/core-skills/bmad-customize/scripts/tests/test_list_customizable_skills.py +0 -249
  247. package/src/core-skills/bmad-deep-recon/SKILL.md +0 -82
  248. package/src/core-skills/bmad-deep-recon/assets/research.template.md +0 -18
  249. package/src/core-skills/bmad-deep-recon/customize.toml +0 -212
  250. package/src/core-skills/bmad-deep-recon/references/draft.md +0 -8
  251. package/src/core-skills/bmad-deep-recon/references/finalize.md +0 -11
  252. package/src/core-skills/bmad-deep-recon/references/html-briefing.md +0 -16
  253. package/src/core-skills/bmad-deep-recon/references/lifecycle.md +0 -11
  254. package/src/core-skills/bmad-deep-recon/references/process.md +0 -10
  255. package/src/core-skills/bmad-deep-recon/references/run.md +0 -73
  256. package/src/core-skills/bmad-deep-recon/references/selection.md +0 -13
  257. package/src/core-skills/bmad-deep-recon/references/synthesis.md +0 -16
  258. package/src/core-skills/bmad-deep-recon/references/verification.md +0 -29
  259. package/src/core-skills/bmad-deep-recon/scripts/recon_kit.py +0 -326
  260. package/src/core-skills/bmad-deep-recon/scripts/tests/test_recon_kit.py +0 -144
  261. package/src/core-skills/bmad-deep-recon/types/academic-lit.md +0 -19
  262. package/src/core-skills/bmad-deep-recon/types/competitive.md +0 -19
  263. package/src/core-skills/bmad-deep-recon/types/domain.md +0 -19
  264. package/src/core-skills/bmad-deep-recon/types/market.md +0 -19
  265. package/src/core-skills/bmad-deep-recon/types/technical.md +0 -19
  266. package/src/core-skills/bmad-deep-recon/types/user-voice.md +0 -19
  267. package/src/core-skills/bmad-forge-idea/SKILL.md +0 -107
  268. package/src/core-skills/bmad-forge-idea/customize.toml +0 -41
  269. package/src/core-skills/bmad-forge-idea/scripts/resolve_personas.py +0 -277
  270. package/src/core-skills/bmad-forge-idea/scripts/tests/test_resolve_personas.py +0 -160
  271. package/src/core-skills/bmad-help/SKILL.md +0 -77
  272. package/src/core-skills/bmad-party-mode/SKILL.md +0 -60
  273. package/src/core-skills/bmad-party-mode/customize.toml +0 -211
  274. package/src/core-skills/bmad-party-mode/references/create-party.md +0 -70
  275. package/src/core-skills/bmad-party-mode/references/mode-agent-team.md +0 -13
  276. package/src/core-skills/bmad-party-mode/references/mode-auto.md +0 -13
  277. package/src/core-skills/bmad-party-mode/references/mode-subagent.md +0 -31
  278. package/src/core-skills/bmad-party-mode/references/party-memory.md +0 -51
  279. package/src/core-skills/bmad-party-mode/scripts/resolve_party.py +0 -300
  280. package/src/core-skills/bmad-party-mode/scripts/tests/test_resolve_party.py +0 -183
  281. package/src/core-skills/bmad-review/SKILL.md +0 -50
  282. package/src/core-skills/bmad-review/customize.toml +0 -141
  283. package/src/core-skills/bmad-review/references/editorial-common.md +0 -56
  284. package/src/core-skills/bmad-review/references/lens-adversarial.md +0 -19
  285. package/src/core-skills/bmad-review/references/lens-edge-case-hunter.md +0 -72
  286. package/src/core-skills/bmad-review/references/lens-prose.md +0 -7
  287. package/src/core-skills/bmad-review/references/lens-structure.md +0 -9
  288. package/src/core-skills/bmad-review/references/lens-verification-gap.md +0 -92
  289. package/src/core-skills/bmad-review/references/structure-models.md +0 -44
  290. package/src/core-skills/bmad-review/scripts/tests/test_word_metrics.py +0 -62
  291. package/src/core-skills/bmad-review/scripts/word_metrics.py +0 -102
  292. package/src/core-skills/module-help.csv +0 -10
  293. package/src/core-skills/module.yaml +0 -38
  294. package/src/core-skills/v6-shims/README.md +0 -25
  295. package/src/core-skills/v6-shims/bmad-editorial-review/SKILL.md +0 -8
  296. package/src/core-skills/v6-shims/bmad-editorial-review/customize.toml +0 -31
  297. package/src/core-skills/v6-shims/bmad-editorial-review-prose/SKILL.md +0 -8
  298. package/src/core-skills/v6-shims/bmad-editorial-review-structure/SKILL.md +0 -8
  299. package/src/core-skills/v6-shims/bmad-review-adversarial-general/SKILL.md +0 -8
  300. package/src/core-skills/v6-shims/bmad-review-edge-case-hunter/SKILL.md +0 -8
  301. package/src/core-skills/v6-shims/bmad-review-verification-gap/SKILL.md +0 -8
  302. package/src/scripts/__pycache__/config_utils.cpython-311.pyc +0 -0
  303. package/src/scripts/config_utils.py +0 -119
  304. package/src/scripts/memlog.py +0 -228
  305. package/src/scripts/render_skill.py +0 -401
  306. package/src/scripts/resolve_config.py +0 -82
  307. package/src/scripts/resolve_customization.py +0 -164
  308. package/src/scripts/tests/__pycache__/test_config_utils.cpython-311.pyc +0 -0
  309. package/src/scripts/tests/__pycache__/test_resolve_config.cpython-311.pyc +0 -0
  310. package/src/scripts/tests/__pycache__/test_resolve_customization.cpython-311.pyc +0 -0
  311. package/src/scripts/tests/test_config_utils.py +0 -85
  312. package/src/scripts/tests/test_memlog.py +0 -306
  313. package/src/scripts/tests/test_resolve_config.py +0 -117
  314. package/src/scripts/tests/test_resolve_customization.py +0 -179
  315. package/tools/bundle-web-bundles.js +0 -117
  316. package/tools/format-workflow-md.js +0 -263
  317. package/tools/installer/README.md +0 -60
  318. package/tools/installer/bmad-cli.js +0 -105
  319. package/tools/installer/cli-utils.js +0 -57
  320. package/tools/installer/commands/install.js +0 -151
  321. package/tools/installer/commands/status.js +0 -65
  322. package/tools/installer/commands/uninstall.js +0 -167
  323. package/tools/installer/core/config.js +0 -76
  324. package/tools/installer/core/existing-install.js +0 -121
  325. package/tools/installer/core/install-paths.js +0 -132
  326. package/tools/installer/core/installer.js +0 -1826
  327. package/tools/installer/core/legacy-warnings.js +0 -151
  328. package/tools/installer/core/manifest-generator.js +0 -883
  329. package/tools/installer/core/manifest.js +0 -439
  330. package/tools/installer/core/shim-policy.js +0 -159
  331. package/tools/installer/core/uv-check.js +0 -195
  332. package/tools/installer/core/wsl-node-check.js +0 -109
  333. package/tools/installer/file-ops.js +0 -204
  334. package/tools/installer/fs-native.js +0 -116
  335. package/tools/installer/ide/_config-driven.js +0 -972
  336. package/tools/installer/ide/manager.js +0 -324
  337. package/tools/installer/ide/platform-codes.js +0 -80
  338. package/tools/installer/ide/platform-codes.yaml +0 -363
  339. package/tools/installer/ide/shared/installed-skills.js +0 -50
  340. package/tools/installer/ide/shared/path-utils.js +0 -219
  341. package/tools/installer/ide/shared/skill-manifest.js +0 -57
  342. package/tools/installer/install-messages.yaml +0 -44
  343. package/tools/installer/list-options.js +0 -210
  344. package/tools/installer/message-loader.js +0 -83
  345. package/tools/installer/modules/channel-plan.js +0 -216
  346. package/tools/installer/modules/channel-resolver.js +0 -241
  347. package/tools/installer/modules/custom-module-manager.js +0 -924
  348. package/tools/installer/modules/external-manager.js +0 -673
  349. package/tools/installer/modules/git-env.js +0 -47
  350. package/tools/installer/modules/module-help-schema.js +0 -13
  351. package/tools/installer/modules/official-modules.js +0 -2289
  352. package/tools/installer/modules/plugin-resolver.js +0 -398
  353. package/tools/installer/modules/version-resolver.js +0 -336
  354. package/tools/installer/project-root.js +0 -224
  355. package/tools/installer/prompts.js +0 -804
  356. package/tools/installer/set-overrides.js +0 -330
  357. package/tools/installer/ui.js +0 -2262
  358. package/tools/installer/yaml-format.js +0 -245
  359. package/tools/javascript-conventions.md +0 -5
  360. package/tools/migrate-custom-module-paths.js +0 -124
  361. package/tools/skill-validator.md +0 -312
  362. package/tools/tests/__pycache__/test_validate_skills.cpython-311.pyc +0 -0
  363. package/tools/tests/fixtures/validate-skills/bmad/SKILL.md +0 -8
  364. package/tools/tests/fixtures/validate-skills/deprecated-shim/SKILL.md +0 -9
  365. package/tools/tests/fixtures/validate-skills/missing-trigger/SKILL.md +0 -9
  366. package/tools/tests/fixtures/validate-skills/with-trigger/SKILL.md +0 -8
  367. package/tools/tests/test_validate_skills.py +0 -476
  368. package/tools/validate-published-implementation-model.mjs +0 -59
  369. package/tools/validate-sidebar-order.js +0 -388
  370. package/tools/validate-svg-changes.sh +0 -356
  371. package/tools/validate_skills.py +0 -698
  372. package/web-bundles/README.md +0 -46
  373. package/web-bundles/brainstorming-coach/INSTRUCTIONS.md +0 -86
  374. package/web-bundles/brainstorming-coach/SKILL.md +0 -83
  375. package/web-bundles/brainstorming-coach/brain-methods.csv +0 -62
  376. package/web-bundles/bundles.json +0 -139
  377. package/web-bundles/market-and-industry-research/INSTRUCTIONS.md +0 -88
  378. package/web-bundles/market-and-industry-research/SKILL.md +0 -59
  379. package/web-bundles/prd-coach/INSTRUCTIONS.md +0 -86
  380. package/web-bundles/prd-coach/SKILL.md +0 -101
  381. package/web-bundles/prd-coach/prd-template.md +0 -165
  382. package/web-bundles/prd-coach/prd-validation-checklist.md +0 -135
  383. package/web-bundles/prfaq-coach/INSTRUCTIONS.md +0 -86
  384. package/web-bundles/prfaq-coach/SKILL.md +0 -139
  385. package/web-bundles/product-brief-coach/INSTRUCTIONS.md +0 -86
  386. package/web-bundles/product-brief-coach/SKILL.md +0 -113
  387. package/web-bundles/ux-coach/INSTRUCTIONS.md +0 -92
  388. package/web-bundles/ux-coach/SKILL.md +0 -187
  389. package/web-bundles/ux-coach/ux-validation.md +0 -100
@@ -1,673 +0,0 @@
1
- const fs = require('../fs-native');
2
- const os = require('node:os');
3
- const path = require('node:path');
4
- const { execSync } = require('node:child_process');
5
- const yaml = require('yaml');
6
- const prompts = require('../prompts');
7
- const { resolveChannel, tagExists, parseGitHubRepo } = require('./channel-resolver');
8
- const { gitEnv } = require('./git-env');
9
- const { decideChannelForModule } = require('./channel-plan');
10
- const { getProjectRoot } = require('../project-root');
11
-
12
- const VALID_CHANNELS = new Set(['stable', 'next', 'pinned']);
13
-
14
- function normalizeChannelName(raw) {
15
- if (typeof raw !== 'string') return null;
16
- const lower = raw.trim().toLowerCase();
17
- return VALID_CHANNELS.has(lower) ? lower : null;
18
- }
19
-
20
- /**
21
- * Conservative quoting for tag names passed to git commands. Tags are
22
- * user-typed (--pin) or come from the GitHub API. Only allow the semver
23
- * character class we use to tag BMad releases; anything else throws.
24
- */
25
- function quoteShell(ref) {
26
- if (typeof ref !== 'string' || !/^[\w.\-+/]+$/.test(ref)) {
27
- throw new Error(`Unsafe ref name: ${JSON.stringify(ref)}`);
28
- }
29
- return `"${ref}"`;
30
- }
31
-
32
- async function readChannelMarker(markerPath) {
33
- try {
34
- if (!(await fs.pathExists(markerPath))) return null;
35
- const content = await fs.readFile(markerPath, 'utf8');
36
- return JSON.parse(content);
37
- } catch {
38
- return null;
39
- }
40
- }
41
-
42
- async function writeChannelMarker(markerPath, data) {
43
- try {
44
- await fs.writeFile(markerPath, JSON.stringify({ ...data, writtenAt: new Date().toISOString() }, null, 2));
45
- } catch {
46
- // Best-effort: marker is an optimization, not a correctness requirement.
47
- }
48
- }
49
-
50
- const REGISTRY_CONFIG_PATH = path.join(getProjectRoot(), 'bmad-modules.yaml');
51
-
52
- /**
53
- * Manages official modules from the bundled registry file. The remote
54
- * marketplace fetch has been retired; this repo is the single source of truth
55
- * for which official modules exist and how they are displayed.
56
- *
57
- * @class ExternalModuleManager
58
- */
59
- class ExternalModuleManager {
60
- // moduleCode → { channel, version, ref, sha, repoUrl, resolvedFallback }
61
- // Populated when cloneExternalModule resolves a channel. Shared across all
62
- // instances so the manifest writer (which often instantiates a fresh
63
- // ExternalModuleManager) sees resolutions made during install.
64
- static _resolutions = new Map();
65
-
66
- // moduleCode → ResolvedModule (from PluginResolver). Populated for registry
67
- // modules flagged `marketplace-plugin: true`, whose installable skills live
68
- // outside a single module.yaml directory and must be resolved from
69
- // .claude-plugin/marketplace.json. Shared across instances so install() can
70
- // pick up the resolution computed during findExternalModuleSource.
71
- static _pluginResolutions = new Map();
72
-
73
- constructor() {}
74
-
75
- /**
76
- * Get the most recent channel resolution for a module (if any).
77
- * @param {string} moduleCode
78
- * @returns {Object|null}
79
- */
80
- getResolution(moduleCode) {
81
- return ExternalModuleManager._resolutions.get(moduleCode) || null;
82
- }
83
-
84
- /**
85
- * Get the cached marketplace-plugin resolution for a module (if any).
86
- * @param {string} moduleCode
87
- * @returns {Object|null} ResolvedModule from PluginResolver, or null
88
- */
89
- getPluginResolution(moduleCode) {
90
- return ExternalModuleManager._pluginResolutions.get(moduleCode) || null;
91
- }
92
-
93
- /**
94
- * Load the official modules registry from the bundled YAML file.
95
- * @returns {Object} Parsed YAML content with modules array
96
- */
97
- async loadExternalModulesConfig() {
98
- if (this.cachedModules) {
99
- return this.cachedModules;
100
- }
101
-
102
- try {
103
- const content = await fs.readFile(REGISTRY_CONFIG_PATH, 'utf8');
104
- const config = yaml.parse(content);
105
- this.cachedModules = config;
106
- return config;
107
- } catch (error) {
108
- await prompts.log.warn(`Failed to load modules config: ${error.message}`);
109
- return { modules: [] };
110
- }
111
- }
112
-
113
- /**
114
- * Normalize a module entry from either the remote registry format
115
- * (snake_case, array) or the legacy bundled format (kebab-case, object map).
116
- * @param {Object} mod - Raw module config from YAML
117
- * @param {string} [key] - Key name (only for legacy map format)
118
- * @returns {Object} Normalized module info
119
- */
120
- _normalizeModule(mod, key) {
121
- return {
122
- key: key || mod.name,
123
- url: mod.repository || mod.url,
124
- moduleDefinition: mod.module_definition || mod['module-definition'],
125
- code: mod.code,
126
- name: mod.display_name || mod.name,
127
- description: mod.description || '',
128
- defaultSelected: mod.default_selected === true || mod.defaultSelected === true,
129
- type: mod.type || 'bmad-org',
130
- npmPackage: mod.npm_package || mod.npmPackage || null,
131
- pluginName: mod.plugin_name || mod.pluginName || null,
132
- defaultChannel: normalizeChannelName(mod.default_channel || mod.defaultChannel) || 'stable',
133
- pin: mod.pin || null,
134
- deprecated: mod.deprecated === true,
135
- deprecationMessage: mod.deprecation_message || mod['deprecation-message'] || mod.deprecationMessage || null,
136
- marketplacePlugin: mod.marketplace_plugin === true || mod['marketplace-plugin'] === true || mod.marketplacePlugin === true,
137
- postInstallMessage: mod.post_install_message || mod['post-install-message'] || mod.postInstallMessage || null,
138
- builtIn: mod.built_in === true,
139
- isExternal: mod.built_in !== true,
140
- // Prior codes this module was registered under (e.g. `bmad-loop` was
141
- // `bauto`). Lets a renamed module keep resolving existing installs
142
- // instead of orphaning them — see getModuleByCode().
143
- aliases: Array.isArray(mod.aliases) ? mod.aliases : [],
144
- };
145
- }
146
-
147
- /**
148
- * Get list of available modules from the registry
149
- * @returns {Array<Object>} Array of module info objects
150
- */
151
- async listAvailable() {
152
- const config = await this.loadExternalModulesConfig();
153
-
154
- // Remote format: modules is an array
155
- if (Array.isArray(config.modules)) {
156
- return config.modules.map((mod) => this._normalizeModule(mod));
157
- }
158
-
159
- // Legacy bundled format: modules is an object map
160
- const modules = [];
161
- for (const [key, mod] of Object.entries(config.modules || {})) {
162
- modules.push(this._normalizeModule(mod, key));
163
- }
164
- return modules;
165
- }
166
-
167
- /**
168
- * Get module info by code. Falls back to matching a registry entry's
169
- * `aliases` list, so a module that was renamed (its `code` changed) still
170
- * resolves for installs recorded under the prior code.
171
- * @param {string} code - The module code (e.g., 'cis'), current or aliased
172
- * @returns {Object|null} Module info or null if not found
173
- */
174
- async getModuleByCode(code) {
175
- const modules = await this.listAvailable();
176
- return modules.find((m) => m.code === code) || modules.find((m) => m.aliases.includes(code)) || null;
177
- }
178
-
179
- /**
180
- * Resolve a possibly-legacy module code to its current canonical code.
181
- * Returns the input unchanged if it doesn't match any registry entry or
182
- * alias (e.g. a custom/unknown module).
183
- * @param {string} code
184
- * @returns {Promise<string>}
185
- */
186
- async resolveCanonicalCode(code) {
187
- const info = await this.getModuleByCode(code);
188
- return info ? info.code : code;
189
- }
190
-
191
- /**
192
- * Get the cache directory for external modules
193
- * @returns {string} Path to the external modules cache directory
194
- */
195
- getExternalCacheDir() {
196
- const cacheDir = path.join(os.homedir(), '.bmad', 'cache', 'external-modules');
197
- return cacheDir;
198
- }
199
-
200
- /**
201
- * Clone an external module repository to cache, resolving the requested
202
- * channel (stable / next / pinned) to a concrete git ref.
203
- *
204
- * @param {string} moduleCode - Code of the external module
205
- * @param {Object} options - Clone options
206
- * @param {boolean} [options.silent] - Suppress spinner output
207
- * @param {Object} [options.channelOptions] - Parsed channel flags. See
208
- * modules/channel-plan.js. When absent, the module installs on its
209
- * registry-declared default channel (typically 'stable').
210
- * @returns {string} Path to the cloned repository
211
- */
212
- async cloneExternalModule(moduleCode, options = {}) {
213
- const moduleInfo = await this.getModuleByCode(moduleCode);
214
-
215
- if (!moduleInfo) {
216
- throw new Error(`External module '${moduleCode}' not found in the BMad registry`);
217
- }
218
-
219
- // Normalize to the canonical code so cache dir, in-memory resolutions,
220
- // and log/error text stay consistent even when called with a renamed
221
- // module's prior alias (getModuleByCode resolves aliases above).
222
- moduleCode = moduleInfo.code;
223
-
224
- const cacheDir = this.getExternalCacheDir();
225
- const moduleCacheDir = path.join(cacheDir, moduleCode);
226
- const silent = options.silent || false;
227
-
228
- // Create cache directory if it doesn't exist
229
- await fs.ensureDir(cacheDir);
230
-
231
- // Helper to create a spinner or a no-op when silent
232
- const createSpinner = async () => {
233
- if (silent) {
234
- return {
235
- start() {},
236
- stop() {},
237
- error() {},
238
- message() {},
239
- cancel() {},
240
- clear() {},
241
- get isSpinning() {
242
- return false;
243
- },
244
- get isCancelled() {
245
- return false;
246
- },
247
- };
248
- }
249
- return await prompts.spinner();
250
- };
251
-
252
- // ─── Resolve channel plan ─────────────────────────────────────────────
253
- // Post-install callers (config generation, directory setup, help catalog
254
- // rebuild) invoke findModuleSource/cloneExternalModule without
255
- // channelOptions just to locate the module's files. Those calls must not
256
- // redecide the channel — the install step already chose one, cloned the
257
- // right ref, and recorded a resolution. If we re-resolve without flags,
258
- // we'd snap back to stable and overwrite a pinned install.
259
- const hasExplicitChannelInput =
260
- options.channelOptions &&
261
- (options.channelOptions.global ||
262
- (options.channelOptions.nextSet && options.channelOptions.nextSet.size > 0) ||
263
- (options.channelOptions.pins && options.channelOptions.pins.size > 0));
264
- const existingResolution = ExternalModuleManager._resolutions.get(moduleCode);
265
- const haveUsableCache = await fs.pathExists(moduleCacheDir);
266
-
267
- if (!hasExplicitChannelInput && existingResolution && haveUsableCache) {
268
- // This is a look-up only; the module is already installed at its chosen
269
- // ref. Skip cloning and return the cached path unchanged.
270
- return moduleCacheDir;
271
- }
272
-
273
- const planEntry = decideChannelForModule({
274
- code: moduleCode,
275
- channelOptions: options.channelOptions,
276
- registryDefault: moduleInfo.defaultChannel,
277
- registryPin: moduleInfo.pin,
278
- });
279
-
280
- // Same-plan short-circuit: a single install calls cloneExternalModule
281
- // several times (config collection, directory setup, help-catalog rebuild)
282
- // with the same channelOptions. The first call resolves + clones; later
283
- // calls with an identical plan and a valid cache should return immediately
284
- // instead of re-running resolveChannel() and `git fetch` (slow; can fail
285
- // on flaky networks even though the tagCache dedupes the GitHub API hit).
286
- if (existingResolution && haveUsableCache && existingResolution.channel === planEntry.channel) {
287
- const samePin = planEntry.channel !== 'pinned' || existingResolution.version === planEntry.pin;
288
- if (samePin) return moduleCacheDir;
289
- }
290
-
291
- let resolved;
292
- try {
293
- resolved = await resolveChannel({
294
- channel: planEntry.channel,
295
- pin: planEntry.pin,
296
- repoUrl: moduleInfo.url,
297
- });
298
- } catch (error) {
299
- // Tag-API failure (rate limit, transient network). If we already have
300
- // a usable cache at a recorded ref, treat this as "couldn't check for
301
- // updates" and re-use the cached version silently — that's the right
302
- // call for an update/quick-update, since the semantics don't change
303
- // and the user isn't worse off than before they ran this command.
304
- const cachedMarker = await readChannelMarker(path.join(moduleCacheDir, '.bmad-channel.json'));
305
- if (cachedMarker?.channel && (await fs.pathExists(moduleCacheDir))) {
306
- if (!silent) {
307
- await prompts.log.warn(
308
- `Could not check for updates to ${moduleInfo.name} (${error.message}); using cached ${cachedMarker.version || cachedMarker.channel}.`,
309
- );
310
- }
311
- ExternalModuleManager._resolutions.set(moduleCode, {
312
- channel: cachedMarker.channel,
313
- version: cachedMarker.version || 'main',
314
- ref: cachedMarker.version && cachedMarker.version !== 'main' ? cachedMarker.version : null,
315
- sha: cachedMarker.sha,
316
- repoUrl: moduleInfo.url,
317
- resolvedFallback: false,
318
- planSource: 'cached',
319
- });
320
- return moduleCacheDir;
321
- }
322
- // No cache to fall back on — this is effectively a fresh install with
323
- // no offline safety net. Surface a clear error with actionable guidance.
324
- const isRateLimited = /rate limit/i.test(error.message);
325
- const hint = isRateLimited
326
- ? process.env.GITHUB_TOKEN
327
- ? 'Your GITHUB_TOKEN may have expired or been rate-limited on its own budget. Try a different token or wait for the reset.'
328
- : 'Set a GITHUB_TOKEN env var (any personal access token with public-repo read) to raise the 60-req/hour anonymous limit.'
329
- : `Check your network connection, or rerun with \`--next=${moduleCode}\` / \`--pin ${moduleCode}=<tag>\` to skip the tag lookup.`;
330
- throw new Error(`Could not resolve stable tag for '${moduleCode}' (${error.message}). ${hint}`);
331
- }
332
-
333
- if (resolved.resolvedFallback && !silent) {
334
- if (resolved.reason === 'no-stable-tags') {
335
- await prompts.log.warn(`No stable releases found for ${moduleInfo.name}; installing from main.`);
336
- } else if (resolved.reason === 'not-a-github-url') {
337
- await prompts.log.warn(`Cannot determine stable tags for ${moduleInfo.name} (non-GitHub URL); installing from main.`);
338
- }
339
- }
340
-
341
- // Validate pin before we burn time cloning. Best-effort: skip on non-GitHub URLs.
342
- if (planEntry.channel === 'pinned') {
343
- const parsed = parseGitHubRepo(moduleInfo.url);
344
- if (parsed) {
345
- try {
346
- const exists = await tagExists(parsed.owner, parsed.repo, planEntry.pin);
347
- if (!exists) {
348
- throw new Error(`Tag '${planEntry.pin}' not found in ${parsed.owner}/${parsed.repo}.`);
349
- }
350
- } catch (error) {
351
- if (error.message?.includes('not found')) throw error;
352
- // Network hiccup on tag verification — let the clone attempt fail clearly.
353
- }
354
- }
355
- }
356
-
357
- // ─── Clone or update cache by resolved channel ────────────────────────
358
- const markerPath = path.join(moduleCacheDir, '.bmad-channel.json');
359
- const currentMarker = await readChannelMarker(markerPath);
360
- const needsChannelReset = currentMarker && currentMarker.channel !== resolved.channel;
361
-
362
- let needsDependencyInstall = false;
363
- let wasNewClone = false;
364
-
365
- if (needsChannelReset && (await fs.pathExists(moduleCacheDir))) {
366
- // Channel changed (e.g. user switched stable→next). Blow away and re-clone
367
- // to avoid tangling shallow clones of different refs.
368
- await fs.remove(moduleCacheDir);
369
- }
370
-
371
- if (await fs.pathExists(moduleCacheDir)) {
372
- // Cache exists on the right channel. Refresh the ref.
373
- const fetchSpinner = await createSpinner();
374
- fetchSpinner.start(`Fetching ${moduleInfo.name}...`);
375
- try {
376
- const currentSha = execSync('git rev-parse HEAD', { cwd: moduleCacheDir, stdio: 'pipe', env: gitEnv() }).toString().trim();
377
-
378
- if (resolved.channel === 'next') {
379
- execSync('git fetch origin --depth 1', {
380
- cwd: moduleCacheDir,
381
- stdio: ['ignore', 'pipe', 'pipe'],
382
- env: gitEnv({ GIT_TERMINAL_PROMPT: '0' }),
383
- });
384
- execSync('git reset --hard origin/HEAD', {
385
- cwd: moduleCacheDir,
386
- stdio: ['ignore', 'pipe', 'pipe'],
387
- env: gitEnv({ GIT_TERMINAL_PROMPT: '0' }),
388
- });
389
- } else {
390
- // stable or pinned — fetch the specific tag and check it out.
391
- execSync(`git fetch --depth 1 origin tag ${quoteShell(resolved.ref)} --no-tags`, {
392
- cwd: moduleCacheDir,
393
- stdio: ['ignore', 'pipe', 'pipe'],
394
- env: gitEnv({ GIT_TERMINAL_PROMPT: '0' }),
395
- });
396
- execSync(`git checkout --quiet FETCH_HEAD`, {
397
- cwd: moduleCacheDir,
398
- stdio: ['ignore', 'pipe', 'pipe'],
399
- env: gitEnv(),
400
- });
401
- }
402
-
403
- const newSha = execSync('git rev-parse HEAD', { cwd: moduleCacheDir, stdio: 'pipe', env: gitEnv() }).toString().trim();
404
- fetchSpinner.stop(`Fetched ${moduleInfo.name}`);
405
- if (currentSha !== newSha) needsDependencyInstall = true;
406
- } catch {
407
- fetchSpinner.error(`Fetch failed, re-downloading ${moduleInfo.name}`);
408
- await fs.remove(moduleCacheDir);
409
- wasNewClone = true;
410
- }
411
- } else {
412
- wasNewClone = true;
413
- }
414
-
415
- if (wasNewClone) {
416
- const fetchSpinner = await createSpinner();
417
- fetchSpinner.start(`Fetching ${moduleInfo.name}...`);
418
- try {
419
- if (resolved.channel === 'next') {
420
- execSync(`git clone --depth 1 "${moduleInfo.url}" "${moduleCacheDir}"`, {
421
- stdio: ['ignore', 'pipe', 'pipe'],
422
- env: gitEnv({ GIT_TERMINAL_PROMPT: '0' }),
423
- });
424
- } else {
425
- execSync(`git clone --depth 1 --branch ${quoteShell(resolved.ref)} "${moduleInfo.url}" "${moduleCacheDir}"`, {
426
- stdio: ['ignore', 'pipe', 'pipe'],
427
- env: gitEnv({ GIT_TERMINAL_PROMPT: '0' }),
428
- });
429
- }
430
- fetchSpinner.stop(`Fetched ${moduleInfo.name}`);
431
- } catch (error) {
432
- fetchSpinner.error(`Failed to fetch ${moduleInfo.name}`);
433
- throw new Error(`Failed to clone external module '${moduleCode}' at ${resolved.version}: ${error.message}`);
434
- }
435
- }
436
-
437
- // Record resolution (channel + tag + SHA) for the manifest writer to pick up.
438
- const sha = execSync('git rev-parse HEAD', { cwd: moduleCacheDir, stdio: 'pipe', env: gitEnv() }).toString().trim();
439
- ExternalModuleManager._resolutions.set(moduleCode, {
440
- channel: resolved.channel,
441
- version: resolved.version,
442
- ref: resolved.ref,
443
- sha,
444
- repoUrl: moduleInfo.url,
445
- resolvedFallback: !!resolved.resolvedFallback,
446
- planSource: planEntry.source,
447
- });
448
- await writeChannelMarker(markerPath, { channel: resolved.channel, version: resolved.version, sha });
449
-
450
- // Install dependencies if package.json exists
451
- const packageJsonPath = path.join(moduleCacheDir, 'package.json');
452
- const nodeModulesPath = path.join(moduleCacheDir, 'node_modules');
453
- if (await fs.pathExists(packageJsonPath)) {
454
- // Install if node_modules doesn't exist, or if package.json is newer (dependencies changed)
455
- const nodeModulesMissing = !(await fs.pathExists(nodeModulesPath));
456
-
457
- // Force install if we updated or cloned new
458
- if (needsDependencyInstall || wasNewClone || nodeModulesMissing) {
459
- const installSpinner = await createSpinner();
460
- installSpinner.start(`Installing dependencies for ${moduleInfo.name}...`);
461
- try {
462
- execSync('npm install --omit=dev --no-audit --no-fund --no-progress --legacy-peer-deps', {
463
- cwd: moduleCacheDir,
464
- stdio: ['ignore', 'pipe', 'pipe'],
465
- timeout: 120_000, // 2 minute timeout
466
- env: gitEnv(), // npm shells out to git for git-URL deps; keep hook GIT_* vars away from it
467
- });
468
- installSpinner.stop(`Installed dependencies for ${moduleInfo.name}`);
469
- } catch (error) {
470
- installSpinner.error(`Failed to install dependencies for ${moduleInfo.name}`);
471
- if (!silent) await prompts.log.warn(` ${error.message}`);
472
- }
473
- } else {
474
- // Check if package.json is newer than node_modules
475
- let packageJsonNewer = false;
476
- try {
477
- const packageStats = await fs.stat(packageJsonPath);
478
- const nodeModulesStats = await fs.stat(nodeModulesPath);
479
- packageJsonNewer = packageStats.mtime > nodeModulesStats.mtime;
480
- } catch {
481
- // If stat fails, assume we need to install
482
- packageJsonNewer = true;
483
- }
484
-
485
- if (packageJsonNewer) {
486
- const installSpinner = await createSpinner();
487
- installSpinner.start(`Installing dependencies for ${moduleInfo.name}...`);
488
- try {
489
- execSync('npm install --omit=dev --no-audit --no-fund --no-progress --legacy-peer-deps', {
490
- cwd: moduleCacheDir,
491
- stdio: ['ignore', 'pipe', 'pipe'],
492
- timeout: 120_000, // 2 minute timeout
493
- env: gitEnv(), // npm shells out to git for git-URL deps; keep hook GIT_* vars away from it
494
- });
495
- installSpinner.stop(`Installed dependencies for ${moduleInfo.name}`);
496
- } catch (error) {
497
- installSpinner.error(`Failed to install dependencies for ${moduleInfo.name}`);
498
- if (!silent) await prompts.log.warn(` ${error.message}`);
499
- }
500
- }
501
- }
502
- }
503
-
504
- return moduleCacheDir;
505
- }
506
-
507
- /**
508
- * Find the source path for an external module
509
- * @param {string} moduleCode - Code of the external module
510
- * @param {Object} options - Options passed to cloneExternalModule
511
- * @returns {string|null} Path to the module source or null if not found
512
- */
513
- async findExternalModuleSource(moduleCode, options = {}) {
514
- const moduleInfo = await this.getModuleByCode(moduleCode);
515
-
516
- if (!moduleInfo || moduleInfo.builtIn) {
517
- return null;
518
- }
519
-
520
- // Normalize to the canonical code — see cloneExternalModule for why.
521
- moduleCode = moduleInfo.code;
522
-
523
- // Marketplace-plugin modules (registry entries flagged `marketplace-plugin`)
524
- // ship a .claude-plugin/marketplace.json and keep their module.yaml inside a
525
- // skill's assets/ rather than in one directory alongside the skills. Resolve
526
- // them through the PluginResolver (the same machinery custom-URL installs
527
- // use) and return the directory that holds module.yaml so config/version/
528
- // directory callers work; install() copies the resolved skill dirs.
529
- if (moduleInfo.marketplacePlugin) {
530
- const pluginMod = await this.resolvePluginModule(moduleCode, options);
531
- if (pluginMod && pluginMod.moduleYamlPath) {
532
- return path.dirname(pluginMod.moduleYamlPath);
533
- }
534
- }
535
-
536
- // Clone the external module repo
537
- const cloneDir = await this.cloneExternalModule(moduleCode, options);
538
-
539
- // The module-definition specifies the path to module.yaml relative to repo root
540
- // We need to return the directory containing module.yaml
541
- const moduleDefinitionPath = moduleInfo.moduleDefinition; // e.g., 'skills/module.yaml'
542
- const configuredPath = path.join(cloneDir, moduleDefinitionPath);
543
-
544
- if (await fs.pathExists(configuredPath)) {
545
- return path.dirname(configuredPath);
546
- }
547
-
548
- // Fallback: search skills/ and src/ (root level and one level deep for subfolders)
549
- for (const dir of ['skills', 'src']) {
550
- const rootCandidate = path.join(cloneDir, dir, 'module.yaml');
551
- if (await fs.pathExists(rootCandidate)) {
552
- return path.dirname(rootCandidate);
553
- }
554
- const dirPath = path.join(cloneDir, dir);
555
- if (await fs.pathExists(dirPath)) {
556
- const entries = await fs.readdir(dirPath, { withFileTypes: true });
557
- for (const entry of entries) {
558
- if (entry.isDirectory()) {
559
- const subCandidate = path.join(dirPath, entry.name, 'module.yaml');
560
- if (await fs.pathExists(subCandidate)) {
561
- return path.dirname(subCandidate);
562
- }
563
- }
564
- }
565
- }
566
- }
567
-
568
- // Check repo root as last fallback
569
- const rootCandidate = path.join(cloneDir, 'module.yaml');
570
- if (await fs.pathExists(rootCandidate)) {
571
- return path.dirname(rootCandidate);
572
- }
573
-
574
- // Nothing found: the cloned ref does not contain a recognizable module structure.
575
- // This happens when a stable tag predates a module restructure (e.g. the repo
576
- // moved files from payload/ to skills/ after the tag was cut). Returning a
577
- // non-existent path silently causes a confusing ENOENT deep inside copyModuleWithFiltering;
578
- // throw a descriptive error here instead so the user knows what happened and how to recover.
579
- const resolution = ExternalModuleManager._resolutions.get(moduleCode);
580
- const versionHint = resolution?.version ? `version ${resolution.version}` : 'the cloned version';
581
- const channelHint =
582
- resolution?.channel === 'stable' ? ` Try reinstalling with \`--next=${moduleCode}\` to use the latest main branch instead.` : '';
583
- throw new Error(
584
- `Module '${moduleCode}' was downloaded but its module definition was not found. ` +
585
- `Expected '${moduleDefinitionPath}' to exist in ${versionHint}, but it is missing. ` +
586
- `The repository may have been restructured after this release was tagged.${channelHint}`,
587
- );
588
- }
589
-
590
- /**
591
- * Resolve a marketplace-plugin registry module to an installable plugin
592
- * definition. Clones the repo (respecting the channel plan), reads its
593
- * .claude-plugin/marketplace.json, and runs the PluginResolver against the
594
- * plugin matching this module. The result (skillPaths + module.yaml +
595
- * module-help.csv) is cached so install() can copy the resolved skill dirs.
596
- *
597
- * @param {string} moduleCode - Code of the external module
598
- * @param {Object} options - Options passed to cloneExternalModule
599
- * @returns {Promise<Object|null>} ResolvedModule from PluginResolver, or null
600
- * when the module is not a marketplace plugin or cannot be resolved.
601
- */
602
- async resolvePluginModule(moduleCode, options = {}) {
603
- const moduleInfo = await this.getModuleByCode(moduleCode);
604
- if (!moduleInfo || moduleInfo.builtIn || !moduleInfo.marketplacePlugin) {
605
- return null;
606
- }
607
-
608
- // Normalize to the canonical code — see cloneExternalModule for why.
609
- moduleCode = moduleInfo.code;
610
-
611
- const cloneDir = await this.cloneExternalModule(moduleCode, options);
612
-
613
- const marketplacePath = path.join(cloneDir, '.claude-plugin', 'marketplace.json');
614
- if (!(await fs.pathExists(marketplacePath))) {
615
- return null;
616
- }
617
-
618
- let marketplace;
619
- try {
620
- marketplace = JSON.parse(await fs.readFile(marketplacePath, 'utf8'));
621
- } catch {
622
- return null;
623
- }
624
-
625
- const plugins = Array.isArray(marketplace.plugins) ? marketplace.plugins : [];
626
- if (plugins.length === 0) {
627
- return null;
628
- }
629
-
630
- // Prefer the plugin whose name matches the registry's plugin_name (or code),
631
- // falling back to any plugin that declares skills.
632
- const preferredName = moduleInfo.pluginName || moduleInfo.code;
633
- const ordered = [...plugins].sort((a, b) => {
634
- const am = a?.name === preferredName ? 0 : 1;
635
- const bm = b?.name === preferredName ? 0 : 1;
636
- return am - bm;
637
- });
638
-
639
- const { PluginResolver } = require('./plugin-resolver');
640
- const resolver = new PluginResolver();
641
-
642
- for (const plugin of ordered) {
643
- if (!plugin || !Array.isArray(plugin.skills) || plugin.skills.length === 0) {
644
- continue;
645
- }
646
- let resolvedMods;
647
- try {
648
- resolvedMods = await resolver.resolve(cloneDir, plugin);
649
- } catch {
650
- continue;
651
- }
652
- if (!resolvedMods || resolvedMods.length === 0) {
653
- continue;
654
- }
655
- // Match the registry code, then the preferred plugin name, then accept a
656
- // lone resolved module.
657
- const match =
658
- resolvedMods.find((mod) => mod.code === moduleCode) ||
659
- resolvedMods.find((mod) => mod.code === preferredName) ||
660
- (resolvedMods.length === 1 ? resolvedMods[0] : null);
661
- if (match) {
662
- match.repoUrl = moduleInfo.url;
663
- ExternalModuleManager._pluginResolutions.set(moduleCode, match);
664
- return match;
665
- }
666
- }
667
-
668
- return null;
669
- }
670
- cachedModules = null;
671
- }
672
-
673
- module.exports = { ExternalModuleManager };