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
@@ -1,401 +0,0 @@
1
- #!/usr/bin/env python3
2
- # /// script
3
- # requires-python = ">=3.11"
4
- # ///
5
- """Render a skill's Markdown sources into an immutable project snapshot."""
6
-
7
- from __future__ import annotations
8
-
9
- import argparse
10
- import hashlib
11
- import json
12
- import os
13
- import re
14
- import shutil
15
- import sys
16
- import tempfile
17
- from pathlib import Path
18
- from typing import Any
19
-
20
- # Installed scripts are consumer files, not a location for interpreter caches.
21
- sys.dont_write_bytecode = True
22
-
23
- from config_utils import ConfigError, load_central_config, load_customization, load_toml
24
-
25
-
26
- class RenderError(ValueError):
27
- """Raised when rendering cannot safely publish a snapshot."""
28
-
29
-
30
- _CONFIG_TOKEN = re.compile(r"\{\{config\.([A-Za-z0-9_.-]+)\}\}")
31
- _SHORT_CONFIG_TOKEN = re.compile(r"\{\{\.([A-Za-z0-9_]+)\}\}")
32
- _CUSTOM_TOKEN = re.compile(r"\{workflow\.([A-Za-z0-9_.-]+)\}")
33
- _SNAPSHOT_TOKEN = re.compile(r"\[\[bmad-snapshot:([A-Za-z0-9_./-]+\.md)\]\]")
34
-
35
-
36
- def _hash_bytes(content: bytes) -> str:
37
- return hashlib.sha256(content).hexdigest()
38
-
39
-
40
- def _canonical_json(value: Any) -> bytes:
41
- return json.dumps(
42
- value, ensure_ascii=False, sort_keys=True, separators=(",", ":")
43
- ).encode("utf-8")
44
-
45
-
46
- def _lookup(data: dict[str, Any], dotted_path: str, label: str) -> Any:
47
- current: Any = data
48
- for part in dotted_path.split("."):
49
- if not isinstance(current, dict) or part not in current:
50
- raise RenderError(f"missing {label} `{dotted_path}`")
51
- current = current[part]
52
- return current
53
-
54
-
55
- def _require_string(value: Any, label: str, *, allow_empty: bool = False) -> str:
56
- if not isinstance(value, str):
57
- raise RenderError(f"{label} must be a string, got {type(value).__name__}")
58
- if not allow_empty and not value.strip():
59
- raise RenderError(f"{label} must not be empty")
60
- return value
61
-
62
-
63
- def _require_string_list(value: Any, label: str) -> list[str]:
64
- if not isinstance(value, list):
65
- raise RenderError(f"{label} must be a list, got {type(value).__name__}")
66
- result = []
67
- for index, item in enumerate(value):
68
- result.append(_require_string(item, f"{label}[{index}]"))
69
- return result
70
-
71
-
72
- def _require_review_layers(value: Any, label: str) -> list[dict[str, str]]:
73
- if not isinstance(value, list):
74
- raise RenderError(f"{label} must be a list of tables")
75
- result: list[dict[str, str]] = []
76
- seen: set[str] = set()
77
- for index, item in enumerate(value):
78
- item_label = f"{label}[{index}]"
79
- if not isinstance(item, dict):
80
- raise RenderError(f"{item_label} must be a table")
81
- identifier = _require_string(item.get("id"), f"{item_label}.id")
82
- if identifier in seen:
83
- raise RenderError(f"duplicate review layer id `{identifier}`")
84
- seen.add(identifier)
85
- layer = {
86
- "id": identifier,
87
- "name": _require_string(item.get("name", identifier), f"{item_label}.name"),
88
- "instruction": _require_string(
89
- item.get("instruction"), f"{item_label}.instruction", allow_empty=True
90
- ),
91
- }
92
- if "when" in item:
93
- layer["when"] = _require_string(item["when"], f"{item_label}.when")
94
- result.append(layer)
95
- return result
96
-
97
-
98
- def _load_sources(skill_dir: Path) -> dict[str, str]:
99
- sources: dict[str, str] = {}
100
- for candidate in sorted(skill_dir.rglob("*.md")):
101
- if candidate.name == "SKILL.md":
102
- continue
103
- name = candidate.relative_to(skill_dir).as_posix()
104
- path = candidate.resolve(strict=True)
105
- if not path.is_relative_to(skill_dir):
106
- raise RenderError(f"render source escapes skill directory: {name}")
107
- if not path.is_file():
108
- raise RenderError(f"render source is missing or not a file: {path}")
109
- try:
110
- sources[name] = path.read_text(encoding="utf-8")
111
- except (OSError, UnicodeError) as error:
112
- raise RenderError(f"failed to read render source {path}: {error}") from error
113
- if "workflow.md" not in sources:
114
- raise RenderError(f"render entry is missing: {skill_dir / 'workflow.md'}")
115
- return sources
116
-
117
-
118
- def _resolve_config_value(value: Any, label: str, project_root: Path) -> str:
119
- text = _require_string(value, label)
120
- if "{project-root}" not in text:
121
- return text
122
- resolved = text.replace("{project-root}", str(project_root))
123
- if not Path(resolved).is_absolute():
124
- raise RenderError(f"{label} must resolve to an absolute path: {resolved}")
125
- return resolved
126
-
127
-
128
- def _find_config_values(data: Any, key: str, prefix: str = "") -> list[tuple[str, Any]]:
129
- matches: list[tuple[str, Any]] = []
130
- if not isinstance(data, dict):
131
- return matches
132
- for name, value in data.items():
133
- path = f"{prefix}.{name}" if prefix else name
134
- if name == key and not isinstance(value, (dict, list)):
135
- matches.append((path, value))
136
- matches.extend(_find_config_values(value, key, path))
137
- return matches
138
-
139
-
140
- def _resolve_short_config(
141
- central: dict[str, Any], key: str, project_root: Path
142
- ) -> tuple[str, str]:
143
- matches = _find_config_values(central, key)
144
- if not matches:
145
- raise RenderError(f"missing config value `{key}`")
146
- if len(matches) > 1:
147
- paths = ", ".join(path for path, _ in matches)
148
- raise RenderError(f"ambiguous config value `{key}` found at: {paths}")
149
- path, value = matches[0]
150
- return path, _resolve_config_value(value, f"config.{path}", project_root)
151
-
152
-
153
- def _format_markdown_list(items: list[str]) -> str:
154
- if not items:
155
- return "_None._"
156
- rendered = []
157
- for item in items:
158
- lines = item.splitlines() or [""]
159
- rendered.append("- " + lines[0])
160
- rendered.extend(" " + line for line in lines[1:])
161
- return "\n".join(rendered)
162
-
163
-
164
- def _format_review_layers(layers: list[dict[str, str]]) -> str:
165
- active = [layer for layer in layers if layer["instruction"].strip()]
166
- if not active:
167
- return "No active review layers. HALT with blocking condition `no active review layers`."
168
- sections = []
169
- for layer in active:
170
- section = [f"#### {layer['name']} (`{layer['id']}`)"]
171
- if layer.get("when"):
172
- section.extend(["", f"Run only when: {layer['when']}"])
173
- section.extend(["", layer["instruction"].strip()])
174
- sections.append("\n".join(section))
175
- return "\n\n".join(sections)
176
-
177
-
178
- def _resolve_customization_value(value: Any, default: Any, label: str) -> tuple[Any, str]:
179
- if isinstance(default, str):
180
- allow_empty = not default.strip() or label == "customization.workflow.open_spec"
181
- resolved = _require_string(value, label, allow_empty=allow_empty)
182
- return resolved, resolved
183
- if isinstance(default, list):
184
- if default and all(isinstance(item, dict) for item in default):
185
- resolved = _require_review_layers(value, label)
186
- return resolved, _format_review_layers(resolved)
187
- resolved = _require_string_list(value, label)
188
- return resolved, _format_markdown_list(resolved)
189
- raise RenderError(f"{label} has unsupported default type {type(default).__name__}")
190
-
191
-
192
- def _resolve_replacements(
193
- sources: dict[str, str],
194
- central: dict[str, Any],
195
- customization: dict[str, Any],
196
- defaults: dict[str, Any] | None,
197
- project_root: Path,
198
- ) -> tuple[dict[str, str], dict[str, Any]]:
199
- replacements: dict[str, str] = {}
200
- input_values: dict[str, Any] = {}
201
- for content in sources.values():
202
- for match in _SHORT_CONFIG_TOKEN.finditer(content):
203
- token, key = match.group(0), match.group(1)
204
- path, resolved = _resolve_short_config(central, key, project_root)
205
- source = f"config.{path}"
206
- replacements[token] = resolved
207
- input_values[source] = resolved
208
- for match in _CONFIG_TOKEN.finditer(content):
209
- token, path = match.group(0), match.group(1)
210
- source = f"config.{path}"
211
- resolved = _resolve_config_value(
212
- _lookup(central, path, "config value"), source, project_root
213
- )
214
- replacements[token] = resolved
215
- input_values[source] = resolved
216
- for match in _CUSTOM_TOKEN.finditer(content):
217
- if defaults is None:
218
- raise RenderError("customization tokens require customize.toml")
219
- token, relative_path = match.group(0), match.group(1)
220
- path = f"workflow.{relative_path}"
221
- source = f"customization.{path}"
222
- resolved, rendered = _resolve_customization_value(
223
- _lookup(customization, path, "customization value"),
224
- _lookup(defaults, path, "customization default"),
225
- source,
226
- )
227
- replacements[token] = rendered
228
- input_values[source] = resolved
229
- return replacements, input_values
230
-
231
-
232
- def _render_sources(
233
- sources: dict[str, str], replacements: dict[str, str], destination: Path
234
- ) -> dict[str, str]:
235
- """Resolve only tokens authored in installed sources in one opaque pass."""
236
- # Workflow customization may reference installed skill files; bind those
237
- # references to the immutable generation before inserting the prose.
238
- replacements = {
239
- token: value.replace("{skill-root}", str(destination))
240
- if token.startswith("{workflow.")
241
- else value
242
- for token, value in replacements.items()
243
- }
244
- source_names = set(sources)
245
- patterns = [
246
- *(re.escape(token) for token in sorted(replacements, key=len, reverse=True)),
247
- _SNAPSHOT_TOKEN.pattern,
248
- ]
249
- token_pattern = re.compile("|".join(patterns))
250
-
251
- def replace(match: re.Match[str]) -> str:
252
- token = match.group(0)
253
- if token in replacements:
254
- return replacements[token]
255
- snapshot = _SNAPSHOT_TOKEN.fullmatch(token)
256
- if snapshot is None:
257
- raise RenderError(f"unsupported render token: {token}")
258
- target = snapshot.group(1)
259
- if target not in source_names:
260
- raise RenderError(f"snapshot reference targets undeclared source: {target}")
261
- return str(destination / target)
262
-
263
- rendered: dict[str, str] = {}
264
- for name, content in sources.items():
265
- # Inserted paths and customization prose are never scanned as source tokens.
266
- rendered[name] = token_pattern.sub(replace, content)
267
- return rendered
268
-
269
-
270
- def _verify_existing(destination: Path, manifest: dict[str, Any]) -> None:
271
- manifest_path = destination / "manifest.json"
272
- try:
273
- existing = json.loads(manifest_path.read_text(encoding="utf-8"))
274
- except (OSError, UnicodeError, json.JSONDecodeError) as error:
275
- raise RenderError(f"corrupt existing generation {destination}: {error}") from error
276
- if existing != manifest:
277
- raise RenderError(f"generation collision or corruption at {destination}")
278
- expected_files = set(manifest["outputs"]) | {"manifest.json"}
279
- actual_files = {
280
- path.relative_to(destination).as_posix()
281
- for path in destination.rglob("*")
282
- if path.is_file()
283
- }
284
- if actual_files != expected_files:
285
- raise RenderError(f"generation contains unexpected or missing files: {destination}")
286
- for name, expected_hash in manifest["outputs"].items():
287
- try:
288
- actual_hash = _hash_bytes((destination / name).read_bytes())
289
- except OSError as error:
290
- raise RenderError(f"failed to verify {destination / name}: {error}") from error
291
- if actual_hash != expected_hash:
292
- raise RenderError(f"generation output hash mismatch: {destination / name}")
293
-
294
-
295
- def _publish(destination: Path, outputs: dict[str, bytes], manifest: dict[str, Any]) -> None:
296
- destination.parent.mkdir(parents=True, exist_ok=True)
297
- if destination.exists():
298
- _verify_existing(destination, manifest)
299
- return
300
- staging = Path(tempfile.mkdtemp(prefix=".staging-", dir=destination.parent))
301
- try:
302
- for name, content in outputs.items():
303
- path = staging / name
304
- path.parent.mkdir(parents=True, exist_ok=True)
305
- path.write_bytes(content)
306
- (staging / "manifest.json").write_bytes(
307
- json.dumps(manifest, ensure_ascii=False, indent=2, sort_keys=True).encode("utf-8")
308
- + b"\n"
309
- )
310
- try:
311
- os.rename(staging, destination)
312
- except OSError:
313
- if destination.exists():
314
- _verify_existing(destination, manifest)
315
- else:
316
- raise
317
- finally:
318
- if staging.exists():
319
- shutil.rmtree(staging, ignore_errors=True)
320
-
321
-
322
- def render(project_root: Path, skill_dir: Path) -> Path:
323
- project_root = project_root.resolve(strict=True)
324
- skill_dir = skill_dir.resolve(strict=True)
325
- if not (project_root / "_bmad").is_dir():
326
- raise RenderError(f"project root does not contain _bmad/: {project_root}")
327
-
328
- sources = _load_sources(skill_dir)
329
- central = load_central_config(project_root)
330
- has_customization = any(
331
- _CUSTOM_TOKEN.search(content) for content in sources.values()
332
- )
333
- defaults = (
334
- load_toml(skill_dir / "customize.toml", required=True)
335
- if has_customization
336
- else None
337
- )
338
- customization = (
339
- load_customization(project_root, skill_dir) if has_customization else {}
340
- )
341
- replacements, input_values = _resolve_replacements(
342
- sources, central, customization, defaults, project_root
343
- )
344
- source_hashes = {
345
- name: _hash_bytes(content.encode("utf-8")) for name, content in sources.items()
346
- }
347
- root_hash = _hash_bytes(str(project_root).encode("utf-8"))[:12]
348
- slug = re.sub(r"[^a-z0-9]+", "-", project_root.name.lower()).strip("-") or "project"
349
- slug = slug[:80].rstrip("-") or "project"
350
- renderer_hash = _hash_bytes(Path(__file__).read_bytes())
351
- identity = {
352
- "project_root": str(project_root),
353
- "renderer_sha256": renderer_hash,
354
- "resolved_values": input_values,
355
- "source_sha256": source_hashes,
356
- }
357
- generation_hash = _hash_bytes(_canonical_json(identity))[:20]
358
- destination = (
359
- project_root
360
- / "_bmad"
361
- / "render"
362
- / skill_dir.name
363
- / f"{slug}-{root_hash}"
364
- / generation_hash
365
- )
366
- rendered = _render_sources(sources, replacements, destination)
367
- outputs = {name: content.encode("utf-8") for name, content in rendered.items()}
368
- output_hashes = {name: _hash_bytes(content) for name, content in outputs.items()}
369
- manifest = {
370
- "schema_version": 1,
371
- "skill": skill_dir.name,
372
- "project_root": str(project_root),
373
- "project_slug": slug,
374
- "root_hash": root_hash,
375
- "generation_hash": generation_hash,
376
- "inputs": identity,
377
- "outputs": output_hashes,
378
- }
379
- _publish(destination, outputs, manifest)
380
- return destination / "workflow.md"
381
-
382
-
383
- def main() -> int:
384
- parser = argparse.ArgumentParser(description=__doc__)
385
- parser.add_argument("--project-root", required=True)
386
- parser.add_argument("--skill", required=True)
387
- args = parser.parse_args()
388
- reconfigure = getattr(sys.stdout, "reconfigure", None)
389
- if reconfigure is not None:
390
- reconfigure(encoding="utf-8")
391
- try:
392
- entry = render(Path(args.project_root), Path(args.skill))
393
- except (ConfigError, RenderError, OSError, UnicodeError, ValueError) as error:
394
- sys.stdout.write(f"HALT: {error}\n")
395
- return 1
396
- sys.stdout.write(f"read and follow {entry}\n")
397
- return 0
398
-
399
-
400
- if __name__ == "__main__":
401
- raise SystemExit(main())
@@ -1,82 +0,0 @@
1
- #!/usr/bin/env python3
2
- # /// script
3
- # requires-python = ">=3.11"
4
- # ///
5
- """Resolve BMad's four central TOML layers to JSON."""
6
-
7
- import argparse
8
- import json
9
- import sys
10
- from pathlib import Path
11
-
12
- # Installed scripts are consumer files, not a location for interpreter caches.
13
- sys.dont_write_bytecode = True
14
-
15
- try:
16
- from config_utils import ConfigError, load_central_config
17
- except ModuleNotFoundError as error:
18
- if error.name != "tomllib":
19
- raise
20
- sys.stderr.write("error: Python 3.11+ is required (stdlib `tomllib` not found).\n")
21
- raise SystemExit(3) from None
22
-
23
-
24
- _MISSING = object()
25
-
26
-
27
- def extract_key(data, dotted_key: str):
28
- current = data
29
- for part in dotted_key.split("."):
30
- if isinstance(current, dict) and part in current:
31
- current = current[part]
32
- else:
33
- return _MISSING
34
- return current
35
-
36
-
37
- def write_json_stdout(output) -> None:
38
- """Pin stdout to UTF-8 — a Windows cp1252 default cannot encode emoji icons."""
39
- reconfigure = getattr(sys.stdout, "reconfigure", None)
40
- if reconfigure is not None:
41
- reconfigure(encoding="utf-8")
42
- sys.stdout.write(json.dumps(output, indent=2, ensure_ascii=False) + "\n")
43
-
44
-
45
- def main() -> int:
46
- parser = argparse.ArgumentParser(
47
- description="Resolve BMad central config using four-layer TOML merge."
48
- )
49
- parser.add_argument(
50
- "--project-root",
51
- "-p",
52
- required=True,
53
- help="Absolute project root containing _bmad/",
54
- )
55
- parser.add_argument(
56
- "--key",
57
- "-k",
58
- action="append",
59
- default=[],
60
- help="Dotted field path to resolve (repeatable). Omit for full dump.",
61
- )
62
- args = parser.parse_args()
63
-
64
- try:
65
- merged = load_central_config(Path(args.project_root).resolve())
66
- except ConfigError as error:
67
- sys.stderr.write(f"error: {error}\n")
68
- return 1
69
-
70
- output = merged
71
- if args.key:
72
- output = {}
73
- for key in args.key:
74
- value = extract_key(merged, key)
75
- if value is not _MISSING:
76
- output[key] = value
77
- write_json_stdout(output)
78
- return 0
79
-
80
-
81
- if __name__ == "__main__":
82
- raise SystemExit(main())
@@ -1,164 +0,0 @@
1
- #!/usr/bin/env python3
2
- # /// script
3
- # requires-python = ">=3.11"
4
- # ///
5
- """Resolve a skill's default, team, and user TOML customization layers."""
6
-
7
- import argparse
8
- import json
9
- import sys
10
- from pathlib import Path
11
-
12
- # Installed scripts are consumer files, not a location for interpreter caches.
13
- sys.dont_write_bytecode = True
14
-
15
- try:
16
- from config_utils import ConfigError, load_customization
17
- except ModuleNotFoundError as error:
18
- if error.name != "tomllib":
19
- raise
20
- sys.stderr.write("error: Python 3.11+ is required (stdlib `tomllib` not found).\n")
21
- raise SystemExit(3) from None
22
-
23
-
24
- _MISSING = object()
25
-
26
-
27
- def find_project_root(start: Path) -> Path | None:
28
- """Nearest ancestor holding `_bmad/`, falling back to the nearest holding `.git`.
29
-
30
- `_bmad/` outranks `.git` at every depth: a submodule or nested repo carries
31
- `.git` without being the BMad project, so treating the two as equal stops the
32
- walk short of the root that owns `_bmad/custom/`.
33
- """
34
- git_root: Path | None = None
35
- current = start.resolve()
36
- while True:
37
- if (current / "_bmad").is_dir():
38
- return current
39
- if git_root is None and (current / ".git").exists():
40
- git_root = current
41
- if current.parent == current:
42
- return git_root
43
- current = current.parent
44
-
45
-
46
- def script_project_root() -> Path | None:
47
- """Project root implied by this script's own install path.
48
-
49
- Skills invoke `{project-root}/_bmad/scripts/resolve_customization.py`, so when
50
- this file sits at that path its grandparent is a project root the caller already
51
- resolved.
52
- """
53
- parents = Path(__file__).resolve().parents
54
- if len(parents) >= 3 and parents[0].name == "scripts" and parents[1].name == "_bmad":
55
- return parents[2]
56
- return None
57
-
58
-
59
- def candidate_project_roots(skill_dir: Path) -> list[Path]:
60
- """Plausible project roots, most trustworthy first.
61
-
62
- The working directory leads because the project is where the user is working,
63
- not where the skill happens to be installed — a home-installed skill walks up to
64
- `~`, and any `~/_bmad` there would otherwise mask the real project's overrides.
65
- """
66
- ordered: list[Path] = []
67
- for root in (
68
- find_project_root(Path.cwd()),
69
- script_project_root(),
70
- find_project_root(skill_dir),
71
- ):
72
- if root is not None and root not in ordered:
73
- ordered.append(root)
74
- return ordered
75
-
76
-
77
- def has_override(root: Path, skill_name: str) -> bool:
78
- custom_dir = root / "_bmad" / "custom"
79
- return any(
80
- (custom_dir / name).is_file()
81
- for name in (f"{skill_name}.toml", f"{skill_name}.user.toml")
82
- )
83
-
84
-
85
- def warn_on_masked_override(chosen: Path, rejected: list[Path], skill_name: str) -> None:
86
- """Break the silence when a real override exists under a root we did not pick."""
87
- if has_override(chosen, skill_name):
88
- return
89
- for root in rejected:
90
- if has_override(root, skill_name):
91
- sys.stderr.write(
92
- f"note: resolved project root {chosen} has no customization for "
93
- f"`{skill_name}`, but {root} does. Using {chosen}; pass "
94
- f"--project-root to select the other explicitly.\n"
95
- )
96
- return
97
-
98
-
99
- def extract_key(data, dotted_key: str):
100
- current = data
101
- for part in dotted_key.split("."):
102
- if isinstance(current, dict) and part in current:
103
- current = current[part]
104
- else:
105
- return _MISSING
106
- return current
107
-
108
-
109
- def write_json_stdout(output) -> None:
110
- reconfigure = getattr(sys.stdout, "reconfigure", None)
111
- if reconfigure is not None:
112
- reconfigure(encoding="utf-8")
113
- sys.stdout.write(json.dumps(output, indent=2, ensure_ascii=False) + "\n")
114
-
115
-
116
- def main() -> int:
117
- parser = argparse.ArgumentParser(
118
- description="Resolve skill customization using three-layer TOML merge."
119
- )
120
- parser.add_argument(
121
- "--skill", "-s", required=True, help="Absolute path to the skill directory"
122
- )
123
- parser.add_argument(
124
- "--project-root",
125
- "-p",
126
- help="Explicit project root containing _bmad/ (recommended)",
127
- )
128
- parser.add_argument(
129
- "--key",
130
- "-k",
131
- action="append",
132
- default=[],
133
- help="Dotted field path to resolve (repeatable). Omit for full dump.",
134
- )
135
- args = parser.parse_args()
136
-
137
- skill_dir = Path(args.skill).resolve()
138
- if args.project_root:
139
- project_root = Path(args.project_root).resolve()
140
- else:
141
- candidates = candidate_project_roots(skill_dir)
142
- project_root = candidates[0] if candidates else None
143
- if project_root is not None:
144
- warn_on_masked_override(project_root, candidates[1:], skill_dir.name)
145
-
146
- try:
147
- merged = load_customization(project_root, skill_dir)
148
- except ConfigError as error:
149
- sys.stderr.write(f"error: {error}\n")
150
- return 1
151
-
152
- output = merged
153
- if args.key:
154
- output = {}
155
- for key in args.key:
156
- value = extract_key(merged, key)
157
- if value is not _MISSING:
158
- output[key] = value
159
- write_json_stdout(output)
160
- return 0
161
-
162
-
163
- if __name__ == "__main__":
164
- raise SystemExit(main())