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,38 +0,0 @@
1
- code: core
2
- name: "BMad Core Module"
3
- description: "Shared utilities across modules"
4
-
5
- header: "BMad Core Configuration"
6
- subheader: "Configure the core settings for your BMad installation.\nThese settings will be used across all installed bmad skills, workflows, and agents."
7
-
8
- user_name:
9
- prompt: "What should agents call you? (Use your name or a team name)"
10
- scope: user
11
- default: "BMad"
12
- result: "{value}"
13
-
14
- project_name:
15
- prompt: "What is your project called?"
16
- default: "{directory_name}"
17
- result: "{value}"
18
-
19
- communication_language:
20
- prompt: "What language should agents use when chatting with you?"
21
- scope: user
22
- default: "English"
23
- result: "{value}"
24
-
25
- document_output_language:
26
- prompt: "Preferred document output language?"
27
- default: "English"
28
- result: "{value}"
29
-
30
- output_folder:
31
- prompt: "Where should output files be saved?"
32
- default: "_bmad-output"
33
- result: "{project-root}/{value}"
34
-
35
- # The one directory created at install time. Everything else (module artifact
36
- # folders, project knowledge) is created lazily by the first skill that writes there.
37
- directories:
38
- - "{output_folder}"
@@ -1,25 +0,0 @@
1
- # v6 Deprecation Shims
2
-
3
- Skills in this folder are forwarders kept for backward compatibility with v6 skill IDs.
4
- Each one holds no logic of its own — it forwards to the skill that replaced it, pinning
5
- the legacy output contract so existing callers keep working.
6
-
7
- | Shim | Forwards to |
8
- | --------------------------------- | ---------------------------------------- |
9
- | `bmad-editorial-review` | `bmad-review` (structure + prose lenses) |
10
- | `bmad-editorial-review-prose` | `bmad-review` (prose lens) |
11
- | `bmad-editorial-review-structure` | `bmad-review` (structure lens) |
12
- | `bmad-review-adversarial-general` | `bmad-review` (adversarial lens) |
13
- | `bmad-review-edge-case-hunter` | `bmad-review` (edge-case lens) |
14
- | `bmad-review-verification-gap` | `bmad-review` (verification-gap lens) |
15
-
16
- `bmad-editorial-review` keeps its `customize.toml` so existing team and user
17
- overrides still resolve; the shim forwards those resolved values to `bmad-review`.
18
-
19
- External module repos (gds, loop, tea, bmb, os-utils) still invoke these IDs, so they
20
- ship by default. Removal rides the v7 cut — never a 6.x minor.
21
-
22
- The folder is grouping only: the installer discovers skills recursively and installs each
23
- one under its own `name`, so nesting here does not change any installed path or skill ID.
24
- A future install option will let users include or exclude this folder before it is removed
25
- outright.
@@ -1,8 +0,0 @@
1
- ---
2
- name: bmad-editorial-review
3
- description: 'Deprecated — forwards to bmad-review'
4
- metadata:
5
- lifecycle: shim
6
- ---
7
-
8
- Merged into `bmad-review`. Invoke the `bmad-review` skill on the same content with the `structure` and `prose` lenses — both, structure first, so prose runs on top of the structure findings — unless the caller asked for a structure-only or prose-only review, in which case pass only that lens. Pass through any `also_consider` areas, and forward this skill's resolved `[workflow]` fields as pre-resolved values — but only those that resolved to something, since an empty value here means no legacy override exists and bmad-review's own default should stand: `reader_type`, `style_guide`, `review_guidance`, `output_preferences`, `persistent_facts`, `activation_steps_prepend`, `activation_steps_append`, `on_complete`, and `review_output_path` as the report path. Present the findings in the legacy shape: the two-pass findings table `| Pass | Original Text | Revised Text | Changes |` with the purpose/audience read above it and, when the structure pass ran, the reduction summary below it — and no other lens's output.
@@ -1,31 +0,0 @@
1
- # DO NOT EDIT -- overwritten on every update.
2
- #
3
- # Legacy override surface for bmad-editorial-review, which is deprecated and
4
- # forwards to bmad-review's `structure` and `prose` lenses. These keys exist
5
- # only so overrides written against the old skill keep resolving: the shim
6
- # resolves them here and passes them to bmad-review as pre-resolved values,
7
- # which bmad-review honors verbatim over its own.
8
- #
9
- # Every field is documented in bmad-review's customize.toml, which is where
10
- # new customization belongs. Defaults are empty here so the shim contributes
11
- # nothing of its own — an unset key falls through to bmad-review's default.
12
- #
13
- # Override files (not edited here):
14
- # {project-root}/_bmad/custom/bmad-editorial-review.toml (team)
15
- # {project-root}/_bmad/custom/bmad-editorial-review.user.toml (personal)
16
- #
17
- # Overrides merge per BMad structural rules: scalars win, arrays append.
18
-
19
- [workflow]
20
-
21
- activation_steps_prepend = []
22
- activation_steps_append = []
23
- persistent_facts = []
24
- review_guidance = []
25
- on_complete = ""
26
- output_preferences = ""
27
- reader_type = ""
28
- style_guide = ""
29
-
30
- # Where the findings table lands; forwarded as bmad-review's report path.
31
- review_output_path = ""
@@ -1,8 +0,0 @@
1
- ---
2
- name: bmad-editorial-review-prose
3
- description: 'Deprecated — forwards to bmad-review'
4
- metadata:
5
- lifecycle: shim
6
- ---
7
-
8
- Merged into `bmad-review`. Invoke the `bmad-review` skill on the same content with only the `prose` lens, passing through the same inputs and any `also_consider` areas. Present the findings in the legacy shape: a three-column markdown table `| Original Text | Revised Text | Changes |` — no Pass column, no preamble above the table. If no issues are found, output exactly: `No editorial issues identified`.
@@ -1,8 +0,0 @@
1
- ---
2
- name: bmad-editorial-review-structure
3
- description: 'Deprecated — forwards to bmad-review'
4
- metadata:
5
- lifecycle: shim
6
- ---
7
-
8
- Merged into `bmad-review`. Invoke the `bmad-review` skill on the same content with only the `structure` lens, passing through the same inputs and any `also_consider` areas. Present the findings in the legacy report shape: a `## Document Summary` block (purpose, audience, reader type, structure model, current length), a `## Recommendations` list of numbered `[CUT/MERGE/MOVE/CONDENSE/QUESTION/PRESERVE]` entries each with rationale and word impact, and a closing `## Summary` (total recommendations, estimated reduction) — not the findings table. If no structural issues are found, output exactly: `No substantive changes recommended`.
@@ -1,8 +0,0 @@
1
- ---
2
- name: bmad-review-adversarial-general
3
- description: 'Deprecated — forwards to bmad-review'
4
- metadata:
5
- lifecycle: shim
6
- ---
7
-
8
- Merged into `bmad-review`. Invoke the `bmad-review` skill on the same content with only the `adversarial` lens, passing through any `also_consider` areas. Present the findings as a Markdown list — descriptions only, no severity, priority, or ranking; no JSON block.
@@ -1,8 +0,0 @@
1
- ---
2
- name: bmad-review-edge-case-hunter
3
- description: 'Deprecated — forwards to bmad-review'
4
- metadata:
5
- lifecycle: shim
6
- ---
7
-
8
- Merged into `bmad-review`. Invoke the `bmad-review` skill on the same content with only the `edge-case-hunter` lens, passing through any `also_consider` areas. Output ONLY the raw findings JSON array in the legacy shape: the four standard fields (plus `kind`/`confidence` on deletion findings), no `lens` field, no markdown wrapping, no extra text. `[]` is valid when nothing is found.
@@ -1,8 +0,0 @@
1
- ---
2
- name: bmad-review-verification-gap
3
- description: 'Deprecated — forwards to bmad-review'
4
- metadata:
5
- lifecycle: shim
6
- ---
7
-
8
- Merged into `bmad-review`. Invoke the `bmad-review` skill on the same content with only the `verification-gap` lens. Present the markdown rendering only (no JSON block), listing any `gap_shape: "other"` findings under an `## Other findings` heading. When there are no findings at all, output exactly this single line: `No verification gaps found.`
@@ -1,119 +0,0 @@
1
- """Shared strict TOML loading and structural merge support."""
2
-
3
- from __future__ import annotations
4
-
5
- import tomllib
6
- from pathlib import Path
7
- from typing import Any, Iterable
8
-
9
-
10
- class ConfigError(ValueError):
11
- """Raised when a present configuration layer cannot be used safely."""
12
-
13
-
14
- _KEYED_MERGE_FIELDS = ("code", "id")
15
-
16
-
17
- def load_toml(path: Path, *, required: bool = False) -> dict[str, Any]:
18
- """Load a TOML table, allowing absence only for optional layers."""
19
- if not path.exists():
20
- if required:
21
- raise ConfigError(f"required TOML file not found: {path}")
22
- return {}
23
- if not path.is_file():
24
- raise ConfigError(f"TOML layer is not a file: {path}")
25
- try:
26
- with path.open("rb") as stream:
27
- parsed = tomllib.load(stream)
28
- except tomllib.TOMLDecodeError as error:
29
- raise ConfigError(f"failed to parse {path}: {error}") from error
30
- except OSError as error:
31
- raise ConfigError(f"failed to read {path}: {error}") from error
32
- if not isinstance(parsed, dict):
33
- raise ConfigError(f"TOML layer did not parse to a table: {path}")
34
- return parsed
35
-
36
-
37
- def _detect_keyed_merge_field(items: list[Any]) -> str | None:
38
- if not items or not all(isinstance(item, dict) for item in items):
39
- return None
40
- for candidate in _KEYED_MERGE_FIELDS:
41
- if all(candidate in item for item in items):
42
- for item in items:
43
- value = item[candidate]
44
- if not isinstance(value, str):
45
- raise ConfigError(
46
- f"keyed array identifier `{candidate}` must be a string, "
47
- f"got {type(value).__name__}"
48
- )
49
- if not value:
50
- raise ConfigError(
51
- f"keyed array identifier `{candidate}` must not be empty"
52
- )
53
- return candidate
54
- return None
55
-
56
-
57
- def _merge_arrays(base: list[Any], override: list[Any]) -> list[Any]:
58
- keyed_field = _detect_keyed_merge_field(base + override)
59
- if keyed_field is None:
60
- return list(base) + list(override)
61
-
62
- result: list[Any] = []
63
- index_by_key: dict[str, int] = {}
64
- for item in base:
65
- copied = dict(item)
66
- index_by_key[copied[keyed_field]] = len(result)
67
- result.append(copied)
68
- for item in override:
69
- copied = dict(item)
70
- key = copied[keyed_field]
71
- if key in index_by_key:
72
- result[index_by_key[key]] = copied
73
- else:
74
- index_by_key[key] = len(result)
75
- result.append(copied)
76
- return result
77
-
78
-
79
- def structural_merge(base: Any, override: Any) -> Any:
80
- """Merge tables recursively, keyed table arrays by identity, and append other arrays."""
81
- if isinstance(base, dict) and isinstance(override, dict):
82
- result = dict(base)
83
- for key, value in override.items():
84
- result[key] = structural_merge(result[key], value) if key in result else value
85
- return result
86
- if isinstance(base, list) and isinstance(override, list):
87
- return _merge_arrays(base, override)
88
- return override
89
-
90
-
91
- def merge_layers(layers: Iterable[dict[str, Any]]) -> dict[str, Any]:
92
- merged: dict[str, Any] = {}
93
- for layer in layers:
94
- merged = structural_merge(merged, layer)
95
- return merged
96
-
97
-
98
- def load_central_config(project_root: Path) -> dict[str, Any]:
99
- bmad_dir = project_root / "_bmad"
100
- return merge_layers(
101
- (
102
- load_toml(bmad_dir / "config.toml", required=True),
103
- load_toml(bmad_dir / "config.user.toml"),
104
- load_toml(bmad_dir / "custom" / "config.toml"),
105
- load_toml(bmad_dir / "custom" / "config.user.toml"),
106
- )
107
- )
108
-
109
-
110
- def load_customization(project_root: Path | None, skill_dir: Path) -> dict[str, Any]:
111
- skill_name = skill_dir.name
112
- custom_dir = project_root / "_bmad" / "custom" if project_root else None
113
- return merge_layers(
114
- (
115
- load_toml(skill_dir / "customize.toml", required=True),
116
- load_toml(custom_dir / f"{skill_name}.toml") if custom_dir else {},
117
- load_toml(custom_dir / f"{skill_name}.user.toml") if custom_dir else {},
118
- )
119
- )
@@ -1,228 +0,0 @@
1
- #!/usr/bin/env python3
2
- # /// script
3
- # requires-python = ">=3.8"
4
- # ///
5
- """memlog — an append-only memory log: LLM-optimal working memory for a skill.
6
-
7
- A memlog is the dense, chronological record of everything that mattered in a piece of
8
- work — every item the user generated or accepted — kept minimal like human memory: only
9
- what's important, never bloated. It persists ACROSS sessions, so a fresh session can
10
- load it and continue. It is NOT a deliverable; downstream artifacts (a brief, a PRD, a
11
- deck, a report) are *derived* from it on demand. The host skill supplies the vocabulary
12
- by how it calls `append` — the tool stays neutral.
13
-
14
- It is a FLAT log: there are no sections or grouping. Every entry is one line, recorded
15
- at the END in the order it happened. The chronology itself is the structure — an event
16
- like "started technique X" is just another entry, same as an idea or an insight.
17
-
18
- Three invariants make it trustworthy:
19
-
20
- 1. Append-only, chronological. Entries land at the end, in the order they happen.
21
- Nothing is ever inserted backward, reordered, edited, or removed. There is no
22
- edit or delete subcommand by design; history is never rewritten.
23
- 2. Write-only / blind. Every command is an atomic, context-free write and echoes the
24
- new state as one line of JSON, so the caller never re-reads the file mid-session.
25
- The one time the file is read is on resume — and the caller reads it itself, not
26
- via this script.
27
- 3. No lifecycle status. A memory log has no "complete" flag. Whether the work is done,
28
- blocked, or paused is itself a fact that happened, so it is recorded as an entry
29
- (e.g. `append --type event --text "session complete"`), never as frontmatter the
30
- log would have to mutate. The chronology stays the single source of truth, and a
31
- resume learns the state by reading the last entries — the same way it learns
32
- everything else.
33
-
34
- Atomicity: every write goes to a temp file, is flushed and fsync'd, then atomically
35
- renamed over the target, so a crash never leaves a half-written entry.
36
-
37
- The file shape (.memlog.md):
38
-
39
- ---
40
- topic: Onboarding flow for a budgeting app
41
- goal: lift week-1 retention
42
- updated: 2026-06-07T14:22
43
- ---
44
-
45
- - (note) user picked techniques: SCAMPER, then Six Thinking Hats
46
- - (technique) started SCAMPER
47
- - (idea) skip the signup wall: let people try with sample data first
48
- - (idea) auto-import one bank account so the first screen shows real numbers
49
- - (question) is open-banking consent too heavy for step one?
50
- - (insight) the "scary numbers" risk and the "real numbers" idea are one lever: show real data, pre-categorized
51
- - (direction) optimize for the anxious first-timer, not the power user
52
- - (decision) lead with one pre-categorized account; defer multi-account import
53
- - (event) session complete
54
-
55
- Each entry may carry an optional `--type` — what KIND it is (idea, insight, question,
56
- decision, direction, assumption, gap, note, event, …) — and an optional `--by` naming
57
- who it came from (e.g. `user`, `coach`), for sessions where authorship matters. Both
58
- render into one short inline tag: `(idea)`, `(idea by user)`, `(by coach)`. Omit them
59
- for a plain note. The host skill names the vocabulary; the script does not enforce one.
60
-
61
- Commands:
62
- init (--workspace DIR | --path FILE) [--field k=v ...] create the memlog (errors if it exists)
63
- append (--workspace DIR | --path FILE) --text STR [--type T] [--by W] append one entry at the end
64
- set (--workspace DIR | --path FILE) --key K --value V set/replace a descriptive frontmatter field
65
-
66
- Addressing: `--workspace` is the run folder, and the memlog is always {workspace}/.memlog.md.
67
- `--path` points straight at the memlog file instead, for callers that already hold the path.
68
- """
69
- from __future__ import annotations # keep type-hint syntax lazy so the script runs on 3.8+
70
-
71
- import argparse
72
- import json
73
- import os
74
- import sys
75
- from datetime import datetime
76
- from pathlib import Path
77
-
78
- MEMLOG = ".memlog.md"
79
-
80
-
81
- def now() -> str:
82
- return datetime.now().strftime("%Y-%m-%dT%H:%M")
83
-
84
-
85
- def resolve(args) -> Path:
86
- """The memlog file, from either addressing mode: {workspace}/.memlog.md or an explicit --path."""
87
- return Path(args.path) if args.path else Path(args.workspace) / MEMLOG
88
-
89
-
90
- def split(text: str) -> tuple[dict, str]:
91
- """Return (frontmatter dict in source order, body str). Frontmatter is plain key: value.
92
-
93
- The closing fence is the first line that is *exactly* `---`, so a `---` inside a
94
- field value (topic/goal are free user text) never truncates the frontmatter.
95
- """
96
- lines = text.splitlines()
97
- if not lines or lines[0] != "---":
98
- raise ValueError(".memlog.md has no frontmatter")
99
- end = next((i for i in range(1, len(lines)) if lines[i] == "---"), None)
100
- if end is None:
101
- raise ValueError(".memlog.md frontmatter is not terminated")
102
- meta: dict[str, str] = {}
103
- for line in lines[1:end]:
104
- if ":" in line:
105
- k, v = line.split(":", 1)
106
- meta[k.strip()] = v.strip()
107
- return meta, "\n".join(lines[end + 1:]).lstrip("\n")
108
-
109
-
110
- def render(meta: dict, body: str) -> str:
111
- # Neutralize newlines in values so a multi-line field can't break the fence on re-read.
112
- fm = "\n".join(f"{k}: {' '.join(str(v).splitlines())}" for k, v in meta.items())
113
- return "---\n" + fm + "\n---\n\n" + body.rstrip("\n") + "\n"
114
-
115
-
116
- def touch(meta: dict) -> None:
117
- """Stamp `updated` and keep it last so the field order stays predictable."""
118
- meta.pop("updated", None)
119
- meta["updated"] = now()
120
-
121
-
122
- def write_atomic(path: Path, text: str) -> None:
123
- """Temp + flush + fsync + atomic rename, so a crash never half-writes an entry."""
124
- tmp = path.with_suffix(path.suffix + ".tmp")
125
- with open(tmp, "w", encoding="utf-8") as f:
126
- f.write(text)
127
- f.flush()
128
- os.fsync(f.fileno())
129
- os.replace(tmp, path)
130
-
131
-
132
- def entry_count(body: str) -> int:
133
- return sum(1 for ln in body.splitlines() if ln.startswith("- "))
134
-
135
-
136
- def ack(path: Path, body: str) -> None:
137
- """Echo new state so the caller never re-reads the file to know where it stands."""
138
- print(json.dumps({
139
- "ok": True,
140
- "memlog": str(path),
141
- "entries": entry_count(body),
142
- }))
143
-
144
-
145
- def cmd_init(args) -> int:
146
- path = resolve(args)
147
- if path.exists():
148
- print(f"error: {path} already exists; use append/set to update it", file=sys.stderr)
149
- return 2
150
- path.parent.mkdir(parents=True, exist_ok=True)
151
- meta: dict[str, str] = {}
152
- for pair in args.field or []:
153
- if "=" not in pair:
154
- print(f"error: --field expects key=value, got {pair!r}", file=sys.stderr)
155
- return 2
156
- k, v = pair.split("=", 1)
157
- meta[k.strip()] = v.strip()
158
- touch(meta)
159
- write_atomic(path, render(meta, ""))
160
- ack(path, "")
161
- return 0
162
-
163
-
164
- def cmd_append(args) -> int:
165
- path = resolve(args)
166
- meta, body = split(path.read_text(encoding="utf-8"))
167
- text = " ".join(args.text.split()) # collapse newlines/runs → one-line entry, no prose bloat
168
- label = args.type or ""
169
- if args.by:
170
- label = f"{label} by {args.by}".strip() # attribution: "(idea by user)" / "(by coach)"
171
- tag = f"({label}) " if label else ""
172
- entry = f"- {tag}{text}"
173
- body = (body.rstrip("\n") + "\n" + entry) if body.strip() else entry # always at the end
174
- touch(meta)
175
- write_atomic(path, render(meta, body))
176
- ack(path, body)
177
- return 0
178
-
179
-
180
- def cmd_set(args) -> int:
181
- path = resolve(args)
182
- meta, body = split(path.read_text(encoding="utf-8"))
183
- meta[args.key] = args.value
184
- touch(meta)
185
- write_atomic(path, render(meta, body))
186
- ack(path, body)
187
- return 0
188
-
189
-
190
- def add_target(sp) -> None:
191
- """Every command addresses the memlog the same way: a run folder or an explicit path."""
192
- g = sp.add_mutually_exclusive_group(required=True)
193
- g.add_argument("--workspace", help="run folder; the memlog is {workspace}/.memlog.md")
194
- g.add_argument("--path", help="explicit memlog file path (alternative to --workspace)")
195
-
196
-
197
- def main(argv: list[str] | None = None) -> int:
198
- p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
199
- sub = p.add_subparsers(dest="cmd", required=True)
200
-
201
- pi = sub.add_parser("init", help="create the memlog")
202
- add_target(pi)
203
- pi.add_argument("--field", action="append", metavar="KEY=VALUE", help="frontmatter field (repeatable)")
204
- pi.set_defaults(func=cmd_init)
205
-
206
- pa = sub.add_parser("append", help="append one entry at the end")
207
- add_target(pa)
208
- pa.add_argument("--text", required=True)
209
- pa.add_argument("--type", help="entry kind, rendered as an inline tag")
210
- pa.add_argument("--by", help="who the entry came from (e.g. user, coach); rendered into the tag")
211
- pa.set_defaults(func=cmd_append)
212
-
213
- pset = sub.add_parser("set", help="set a descriptive frontmatter field")
214
- add_target(pset)
215
- pset.add_argument("--key", required=True)
216
- pset.add_argument("--value", required=True)
217
- pset.set_defaults(func=cmd_set)
218
-
219
- args = p.parse_args(argv)
220
- return args.func(args)
221
-
222
-
223
- if __name__ == "__main__":
224
- if sys.platform == "win32":
225
- # Piped output on Windows defaults to a legacy code page, not UTF-8.
226
- sys.stdout.reconfigure(encoding="utf-8")
227
- sys.stderr.reconfigure(encoding="utf-8")
228
- sys.exit(main())