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,750 +0,0 @@
1
- # /// script
2
- # requires-python = ">=3.10"
3
- # dependencies = ["pytest>=8.0"]
4
- # ///
5
- """Tests for git_evidence.py — measurement over a real temp git repo.
6
-
7
- Run: uv run scripts/tests/test_git_evidence.py
8
- or: uv run --with pytest -m pytest scripts/tests/test_git_evidence.py
9
- """
10
-
11
- import json
12
- import os
13
- import shutil
14
- import subprocess
15
- import sys
16
- import unicodedata
17
- from pathlib import Path
18
-
19
- import pytest
20
-
21
- SCRIPT = Path(__file__).resolve().parents[1] / "git_evidence.py"
22
-
23
- # The fixture commit identity, shared by both git helpers below.
24
- _IDENT = {
25
- "GIT_AUTHOR_NAME": "T",
26
- "GIT_AUTHOR_EMAIL": "t@t",
27
- "GIT_COMMITTER_NAME": "T",
28
- "GIT_COMMITTER_EMAIL": "t@t",
29
- }
30
-
31
-
32
- def _git_env(repo):
33
- """The environment every fixture git runs under, layered outward.
34
-
35
- Inherit the real environment (PATH above all: git lives in /opt/homebrew,
36
- /usr/local, or a nix store as readily as /usr/bin, and an env holding only
37
- GIT_* vars sends execvp to os.defpath), then strip every ambient GIT_* var
38
- -- GIT_DIR, GIT_WORK_TREE and GIT_CONFIG_COUNT would each silently redirect
39
- or reconfigure the fixture -- and pin identity plus every source git reads
40
- for settings, so nothing on the developer's machine can reach the fixture:
41
-
42
- - gitconfig (commit.gpgsign, core.autocrlf, core.hooksPath,
43
- init.defaultBranch). GIT_CONFIG_NOSYSTEM/GIT_CONFIG_GLOBAL cover
44
- git >= 2.32; HOME and XDG_CONFIG_HOME cover older git, and are set to the
45
- repo's parent directory -- always a per-test directory under pytest's
46
- tmp_path -- so nothing is ever planted inside the working tree.
47
- - gitattributes, a separate source GIT_CONFIG_NOSYSTEM does not cover: a
48
- system `* -diff` rule would make numstat call every path binary and take
49
- the churn assertions down with it. GIT_ATTR_NOSYSTEM shuts it out.
50
- - the locale. LC_ALL/LANG are pinned to C, matching _run/_proc's existing
51
- pin, so fixture git's text output cannot vary with the developer's
52
- locale. Inheriting the environment is what makes this pin necessary:
53
- the old four-variable env had no locale in it to inherit.
54
- """
55
- env = {k: v for k, v in os.environ.items() if not k.startswith("GIT_")}
56
- env.update(_IDENT)
57
- env["GIT_CONFIG_NOSYSTEM"] = "1"
58
- env["GIT_ATTR_NOSYSTEM"] = "1"
59
- env["GIT_CONFIG_GLOBAL"] = os.devnull
60
- env["HOME"] = env["XDG_CONFIG_HOME"] = str(Path(repo).parent)
61
- env["LC_ALL"] = env["LANG"] = "C"
62
- return env
63
-
64
-
65
- def _json(proc):
66
- """Parse the JSON-only stdout contract, surfacing a crash instead of hiding
67
- it behind a JSONDecodeError."""
68
- assert proc.stdout, f"empty stdout; stderr was: {proc.stderr}"
69
- assert "Traceback" not in proc.stderr, proc.stderr
70
- return json.loads(proc.stdout)
71
-
72
-
73
- def _run(*args):
74
- # LC_ALL=C keeps git's error strings in English so assertions on them
75
- # are stable across locales.
76
- proc = subprocess.run(
77
- ["uv", "run", str(SCRIPT), *args],
78
- capture_output=True,
79
- text=True,
80
- env={**os.environ, "LC_ALL": "C", "LANG": "C"},
81
- )
82
- return proc.returncode, _json(proc)
83
-
84
-
85
- def _proc(*args, env=None):
86
- """Run the script and return the raw process, so a test can assert on the
87
- exit code and stderr together — and so `env` can carry an overlay (a fake
88
- `git` earlier on PATH) that `_run` has no way to pass."""
89
- overlay = {"LC_ALL": "C", "LANG": "C"}
90
- if env:
91
- overlay.update(env)
92
- return subprocess.run(
93
- ["uv", "run", str(SCRIPT), *args],
94
- capture_output=True,
95
- text=True,
96
- env={**os.environ, **overlay},
97
- )
98
-
99
-
100
- def _git(repo, *args):
101
- subprocess.run(
102
- ["git", "-C", str(repo), *args],
103
- check=True,
104
- capture_output=True,
105
- env=_git_env(repo),
106
- )
107
-
108
-
109
- def _git_unchecked(repo, *args):
110
- """`git` that tolerates a non-zero exit — the conflicting merge in
111
- `_merge_repo` is supposed to fail, and the hand resolution comes after it.
112
- Same environment as `_git`, which runs with check=True."""
113
- return subprocess.run(
114
- ["git", "-C", str(repo), *args],
115
- capture_output=True,
116
- text=True,
117
- env=_git_env(repo),
118
- )
119
-
120
-
121
- def _make_repo(tmp_path):
122
- repo = tmp_path / "repo"
123
- repo.mkdir()
124
- _git(repo, "init", "-q")
125
- (repo / "a.py").write_text("one\ntwo\n")
126
- _git(repo, "add", "-A")
127
- _git(repo, "commit", "-qm", "epic-1-1 initial a")
128
- (repo / "a.py").write_text("one\ntwo\nthree\nfour\n")
129
- (repo / "b.py").write_text("x\n")
130
- _git(repo, "add", "-A")
131
- _git(repo, "commit", "-qm", "epic-1-2 grow a, add b")
132
- return repo
133
-
134
-
135
- def test_no_range_returns_empty(tmp_path):
136
- repo = _make_repo(tmp_path)
137
- code, out = _run("--repo", str(repo))
138
- assert code == 0
139
- assert out["range"] is None
140
- assert out["commits"] == [] and out["files"] == []
141
-
142
-
143
- def test_measures_commits_and_files_with_attribution(tmp_path):
144
- repo = _make_repo(tmp_path)
145
- code, out = _run(
146
- "--repo", str(repo), "--range", "HEAD~1..HEAD", "--stories", "1-2,1-1"
147
- )
148
- assert code == 0
149
- assert out["range"] == "HEAD~1..HEAD"
150
- assert out["commit_count"] == 1
151
- # The single commit in range is the second one; attributed to story "1-2".
152
- assert out["commits"][0]["stories"] == ["1-2"]
153
- files = {f["path"]: f for f in out["files"]}
154
- # a.py grew by two lines, b.py added one — measured, not judged.
155
- assert files["a.py"]["added"] == 2 and files["a.py"]["net"] == 2
156
- assert files["b.py"]["added"] == 1
157
-
158
-
159
- def test_story_attribution_respects_word_boundary(tmp_path):
160
- # Story id "1-2" must NOT match a commit subject mentioning "11-2".
161
- repo = tmp_path / "repo"
162
- repo.mkdir()
163
- _git(repo, "init", "-q")
164
- (repo / "f.py").write_text("a\n")
165
- _git(repo, "add", "-A")
166
- _git(repo, "commit", "-qm", "base")
167
- (repo / "f.py").write_text("a\nb\n")
168
- _git(repo, "add", "-A")
169
- _git(repo, "commit", "-qm", "epic-11-2 unrelated story")
170
- code, out = _run("--repo", str(repo), "--range", "HEAD~1..HEAD", "--stories", "1-2")
171
- assert code == 0
172
- assert out["commits"][0]["stories"] == []
173
-
174
-
175
- def test_bad_range_errors_as_json(tmp_path):
176
- repo = _make_repo(tmp_path)
177
- code, out = _run("--repo", str(repo), "--range", "nope..alsonope")
178
- assert code == 1
179
- assert out["ok"] is False and out["error"]
180
-
181
-
182
- def test_single_rev_range_rejected(tmp_path):
183
- # A single rev is not a range: git would log ALL history up to it and the
184
- # script would report the whole repo as the epic's evidence.
185
- repo = _make_repo(tmp_path)
186
- code, out = _run("--repo", str(repo), "--range", "HEAD")
187
- assert code == 2
188
- assert out["ok"] is False and "invalid --range" in out["error"]
189
-
190
-
191
- def test_pathspec_range_rejected(tmp_path):
192
- # A path that exists must not be silently consumed as a pathspec.
193
- repo = _make_repo(tmp_path)
194
- code, out = _run("--repo", str(repo), "--range", "a.py")
195
- assert code == 2
196
- assert out["ok"] is False and "invalid --range" in out["error"]
197
-
198
-
199
- def test_range_shaped_pathspec_forced_to_rev_parse(tmp_path):
200
- # A committed file literally named "a..b" passes the REV..REV shape check;
201
- # without the trailing "--" in the git argv, git silently logs that FILE's
202
- # history with exit 0. The "--" forces rev interpretation, so this must
203
- # error instead of measuring the decoy.
204
- repo = _make_repo(tmp_path)
205
- (repo / "a..b").write_text("decoy\n")
206
- _git(repo, "add", "-A")
207
- _git(repo, "commit", "-qm", "add decoy file named like a range")
208
- code, out = _run("--repo", str(repo), "--range", "a..b")
209
- assert code == 1
210
- assert out["ok"] is False and "bad revision" in out["error"]
211
-
212
-
213
- def test_option_like_range_rejected(tmp_path):
214
- # A range starting with "-" must never reach git, where it would be
215
- # consumed as an option (e.g. --output=... writes an arbitrary file).
216
- repo = _make_repo(tmp_path)
217
- code, out = _run("--repo", str(repo), "--range=--output=evil.txt")
218
- assert code == 2
219
- assert out["ok"] is False and "invalid --range" in out["error"]
220
- assert not (repo / "evil.txt").exists()
221
-
222
-
223
- def test_degenerate_range_shapes_rejected(tmp_path):
224
- # Shapes that contain ".." but are not REV..REV: git would silently
225
- # default an empty endpoint to HEAD ("..", "a..", "..HEAD"), a leading
226
- # dash must never reach git even when dots are present ("-3..HEAD"),
227
- # unstripped values must not slip past the dash guard, and a three-dot
228
- # range is a symmetric difference — git would measure commits reachable
229
- # from either endpoint but not both, a different evidence set entirely.
230
- repo = _make_repo(tmp_path)
231
- for bad in (
232
- "..",
233
- "a..",
234
- "..HEAD",
235
- "-3..HEAD",
236
- " HEAD~1..HEAD",
237
- "HEAD~1...HEAD",
238
- "a...b",
239
- ):
240
- code, out = _run("--repo", str(repo), f"--range={bad}")
241
- assert code == 2, f"accepted {bad!r}"
242
- assert out["ok"] is False and "invalid --range" in out["error"], bad
243
-
244
-
245
- def test_malformed_args_emit_json_not_usage(tmp_path):
246
- # An unknown flag must still land on the JSON contract, not argparse's
247
- # plain usage text on stderr.
248
- code, out = _run("--bogus-flag")
249
- assert code != 0
250
- assert out["ok"] is False and out["error"]
251
-
252
-
253
- def test_help_flags_emit_json_not_usage():
254
- # argparse's built-in help action bypasses the error() override entirely --
255
- # it prints usage text on stdout and exits 0, which breaks the JSON-only
256
- # contract for a machine consumer. add_help=False demotes -h to an ordinary
257
- # unrecognized argument, which error() already handles.
258
- for flag in ("-h", "--help"):
259
- proc = _proc(flag)
260
- # Exit 2 specifically: the module docstring reserves 2 for argument
261
- # errors and 1 for git/I-O failures, so collapsing them must fail here.
262
- assert proc.returncode == 2, flag
263
- assert "usage:" not in proc.stdout, flag
264
- out = _json(proc)
265
- assert out["ok"] is False and out["error"], flag
266
-
267
-
268
- # --- helpers for the fixtures below -----------------------------------------
269
-
270
-
271
- def _rev(repo, ref):
272
- return _git_unchecked(repo, "rev-parse", ref).stdout.strip()
273
-
274
-
275
- def _fake_git(tmp_path, body):
276
- """Write a `git` shim and return the PATH overlay that puts it ahead of the
277
- real binary for the script's own subprocesses (never for the fixtures,
278
- which build their repos through `_git`'s own environment)."""
279
- bindir = tmp_path / "fakebin"
280
- bindir.mkdir()
281
- shim = bindir / "git"
282
- shim.write_text(body)
283
- os.chmod(shim, 0o755)
284
- return {"PATH": f"{bindir}{os.pathsep}{os.environ['PATH']}"}
285
-
286
-
287
- def _merge_repo(tmp_path):
288
- """Two story branches merged into the mainline; the second merge conflicts
289
- and is resolved by hand, adding a line neither branch had. Returns
290
- (repo, base_sha) — `base_sha..HEAD` is the epic range."""
291
- repo = tmp_path / "repo"
292
- repo.mkdir()
293
- _git(repo, "init", "-q", "-b", "main")
294
- (repo / "s.py").write_text("l1\nl2\nl3\n")
295
- _git(repo, "add", "-A")
296
- _git(repo, "commit", "-qm", "base")
297
- base = _rev(repo, "HEAD")
298
-
299
- _git(repo, "checkout", "-q", "-b", "s1")
300
- (repo / "s.py").write_text("l1\nA\nl3\n")
301
- _git(repo, "commit", "-qam", "epic-1-2 story one")
302
- _git(repo, "checkout", "-q", "main")
303
- _git(repo, "merge", "-q", "--no-ff", "s1", "-m", "merge story 1-2")
304
-
305
- _git(repo, "checkout", "-q", "-b", "s2", base)
306
- (repo / "s.py").write_text("l1\nB\nl3\n")
307
- _git(repo, "commit", "-qam", "epic-1-3 story two")
308
- _git(repo, "checkout", "-q", "main")
309
- conflicted = _git_unchecked(repo, "merge", "--no-ff", "s2", "-m", "merge story 1-3")
310
- assert conflicted.returncode != 0, "fixture expected a merge conflict"
311
- (repo / "s.py").write_text("l1\nAB\nl3\nl4\n") # hand resolution
312
- _git(repo, "add", "-A")
313
- _git(repo, "commit", "-qm", "merge story 1-3")
314
- return repo, base
315
-
316
-
317
- def test_rename_yields_two_openable_paths(tmp_path):
318
- # git's default rename detection emits "src/{mod.py => renamed.py}" — an
319
- # unopenable pseudo-path that also splits one file's churn across keys.
320
- # --no-renames makes the rename an honest delete + add.
321
- repo = tmp_path / "repo"
322
- repo.mkdir()
323
- _git(repo, "init", "-q", "-b", "main")
324
- (repo / "src").mkdir()
325
- (repo / "src" / "mod.py").write_text("l1\nl2\nl3\nl4\nl5\nl6\n")
326
- _git(repo, "add", "-A")
327
- _git(repo, "commit", "-qm", "base")
328
- base = _rev(repo, "HEAD")
329
- _git(repo, "mv", "src/mod.py", "src/renamed.py")
330
- _git(repo, "commit", "-qm", "rename mod")
331
- (repo / "src" / "renamed.py").write_text("l1\nl2\nl3\nl4\nl5\nl6\nl7\n")
332
- _git(repo, "commit", "-qam", "add a line after the rename")
333
-
334
- out = _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD"))
335
- files = {f["path"]: f for f in out["files"]}
336
- assert not any("=>" in path for path in files), sorted(files)
337
- assert files["src/mod.py"]["added"] == 0
338
- assert files["src/mod.py"]["deleted"] == 6
339
- assert files["src/renamed.py"]["added"] == 7
340
- assert files["src/renamed.py"]["deleted"] == 0
341
-
342
-
343
- def _accented_repo(tmp_path):
344
- repo = tmp_path / "repo"
345
- repo.mkdir()
346
- _git(repo, "init", "-q", "-b", "main")
347
- (repo / "src").mkdir()
348
- (repo / "src" / "café.py").write_text("ca\n")
349
- _git(repo, "add", "-A")
350
- _git(repo, "commit", "-qm", "base")
351
- base = _rev(repo, "HEAD")
352
- (repo / "src" / "café.py").write_text("ca\ncb\n")
353
- _git(repo, "commit", "-qam", "touch the accented file")
354
- return repo, base
355
-
356
-
357
- def _assert_accented_path(repo, out):
358
- paths = [f["path"] for f in out["files"]]
359
- assert len(paths) == 1
360
- assert "\\" not in paths[0] and '"' not in paths[0], paths
361
- assert unicodedata.normalize("NFC", paths[0]) == "src/café.py"
362
- # The reported path is a real path: it opens under --repo.
363
- assert (repo / paths[0]).read_text() == "ca\ncb\n"
364
-
365
-
366
- def test_non_ascii_path_is_a_real_string(tmp_path):
367
- # Without core.quotePath=false git emits "src/caf\303\251.py" — quoted and
368
- # octal-escaped, so the documented "open the ranked files" step cannot.
369
- repo, base = _accented_repo(tmp_path)
370
- _assert_accented_path(
371
- repo, _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD"))
372
- )
373
-
374
-
375
- def test_non_ascii_path_survives_a_non_utf8_locale(tmp_path):
376
- # Pins the explicit encoding="utf-8" on the subprocess. Modern CPython's
377
- # UTF-8 mode hides its absence even under LC_ALL=C, so the pin only bites
378
- # with UTF-8 mode and C-locale coercion both off — where the interpreter
379
- # default is US-ASCII and git's UTF-8 path bytes fail to decode, taking the
380
- # whole measurement down with them.
381
- repo, base = _accented_repo(tmp_path)
382
- out = _json(
383
- _proc(
384
- "--repo",
385
- str(repo),
386
- "--range",
387
- f"{base}..HEAD",
388
- env={"PYTHONUTF8": "0", "PYTHONCOERCECLOCALE": "0"},
389
- )
390
- )
391
- _assert_accented_path(repo, out)
392
-
393
-
394
- def test_merge_churn_is_measured_and_counted(tmp_path):
395
- repo, base = _merge_repo(tmp_path)
396
- out = _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD"))
397
- assert out["commit_count"] == 4
398
- assert out["merge_count"] == 2
399
- assert out["merges_measured"] == 2
400
- # Both merges' first-parent churn: 1/1 for the clean merge, 2/1 for the
401
- # hand-resolved one (the resolution added a line neither branch had).
402
- merge_files = {f["path"]: f for f in out["merge_files"]}
403
- assert merge_files["s.py"]["added"] == 3
404
- assert merge_files["s.py"]["deleted"] == 2
405
- assert merge_files["s.py"]["net"] == 1
406
- assert merge_files["s.py"]["commit_count"] == 2
407
-
408
-
409
- def test_merge_commits_listed_but_excluded_from_files(tmp_path):
410
- repo, base = _merge_repo(tmp_path)
411
- out = _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD"))
412
- by_subject = {c["subject"]: c for c in out["commits"]}
413
- assert by_subject["merge story 1-2"]["is_merge"] is True
414
- assert by_subject["merge story 1-3"]["is_merge"] is True
415
- assert by_subject["epic-1-2 story one"]["is_merge"] is False
416
- # `files` is the two story commits only — 1/1 each. Folding the merges in
417
- # would double count: their diff restates the churn they merged.
418
- files = {f["path"]: f for f in out["files"]}
419
- assert files["s.py"]["added"] == 2
420
- assert files["s.py"]["deleted"] == 2
421
- assert files["s.py"]["commit_count"] == 2
422
-
423
-
424
- def test_story_attribution_survives_merges(tmp_path):
425
- repo, base = _merge_repo(tmp_path)
426
- out = _json(
427
- _proc(
428
- "--repo", str(repo), "--range", f"{base}..HEAD", "--stories", "1-2,1-3"
429
- )
430
- )
431
- by_subject = {c["subject"]: c for c in out["commits"]}
432
- assert by_subject["epic-1-2 story one"]["stories"] == ["1-2"]
433
- assert by_subject["epic-1-3 story two"]["stories"] == ["1-3"]
434
-
435
-
436
- def test_off_spine_merge_is_counted_but_not_measured(tmp_path):
437
- # A back-merge of the mainline into a story branch is a merge in the range,
438
- # but its first-parent diff would restate unrelated mainline content as
439
- # epic churn. It stays in merge_count and out of merges_measured, so the
440
- # gap between the two says plainly that a merge went unmeasured.
441
- repo = tmp_path / "repo"
442
- repo.mkdir()
443
- _git(repo, "init", "-q", "-b", "main")
444
- (repo / "f.txt").write_text("base\n")
445
- _git(repo, "add", "-A")
446
- _git(repo, "commit", "-qm", "base")
447
- base = _rev(repo, "HEAD")
448
- (repo / "f.txt").write_text("base\nmain1\n")
449
- _git(repo, "commit", "-qam", "mainline work")
450
-
451
- _git(repo, "checkout", "-q", "-b", "s1", base)
452
- (repo / "s1.txt").write_text("s1\n")
453
- _git(repo, "add", "-A")
454
- _git(repo, "commit", "-qm", "epic-1-2 story one")
455
- _git(repo, "merge", "-q", "--no-ff", "main", "-m", "back-merge main into s1")
456
- _git(repo, "checkout", "-q", "main")
457
- _git(repo, "merge", "-q", "--no-ff", "s1", "-m", "merge story 1-2")
458
-
459
- out = _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD"))
460
- assert out["merge_count"] == 2
461
- assert out["merges_measured"] == 1
462
- merge_files = {f["path"]: f for f in out["merge_files"]}
463
- assert set(merge_files) == {"s1.txt"}
464
-
465
-
466
- def test_merge_pass_survives_a_hostile_log_diffmerges_config(tmp_path):
467
- # `-m` means "whatever log.diffMerges says", so a user or repo config of
468
- # `off` makes the merge pass emit no file rows: merge_files comes back
469
- # empty beside a non-zero merges_measured and reads as "the merges changed
470
- # nothing". The command-line -c pin beats the config.
471
- repo, base = _merge_repo(tmp_path)
472
- _git(repo, "config", "log.diffMerges", "off")
473
- out = _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD"))
474
- assert out["merges_measured"] == 2
475
- merge_files = {f["path"]: f for f in out["merge_files"]}
476
- assert merge_files["s.py"]["added"] == 3
477
- assert merge_files["s.py"]["deleted"] == 2
478
-
479
-
480
- def test_distinct_non_utf8_paths_stay_distinct(tmp_path):
481
- # errors="replace" maps every invalid byte to the same U+FFFD, collapsing
482
- # two different files into one `files` key with their churn summed —
483
- # measurement corruption with nothing in the output admitting to it.
484
- overlay = _fake_git(
485
- tmp_path,
486
- "#!/bin/sh\n"
487
- "printf 'aaaa\\037\\037subj\\n\\n1\\t0\\tsrc/caf\\351.py\\n"
488
- "2\\t0\\tsrc/caf\\377.py\\n'\n",
489
- )
490
- out = _json(_proc("--repo", str(tmp_path), "--range", "a..b", env=overlay))
491
- files = {f["path"]: f for f in out["files"]}
492
- assert len(files) == 2, files
493
- assert sorted(f["added"] for f in files.values()) == [1, 2]
494
-
495
-
496
- def test_repeated_merge_headers_are_counted_once(tmp_path):
497
- # Pins the dedupe guard in _parse_log. git before 2.31 does not honour
498
- # --first-parent for `-m`'s diff format, so a merge's header repeats once
499
- # per parent with a diff block under each. Without the guard that doubles
500
- # the merge churn and pushes merges_measured above merge_count, inverting
501
- # the invariant the reference documents. Inert on modern git, so it needs
502
- # pre-2.31-shaped output to be exercised at all.
503
- real_git = shutil.which("git")
504
- assert real_git, "git must be on PATH"
505
- repo, base = _merge_repo(tmp_path)
506
- overlay = _fake_git(
507
- tmp_path,
508
- "#!/bin/sh\n"
509
- 'for a in "$@"; do\n'
510
- ' if [ "$a" = "--min-parents=2" ]; then\n'
511
- " printf 'aaaa\\037p1 p2\\037merge story 1-3\\n\\n2\\t1\\ts.py\\n"
512
- "aaaa\\037p1 p2\\037merge story 1-3\\n\\n5\\t4\\ts.py\\n'\n"
513
- " exit 0\n"
514
- " fi\n"
515
- "done\n"
516
- f'exec "{real_git}" "$@"\n',
517
- )
518
- out = _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD", env=overlay))
519
- # One merge sha, however many blocks git printed for it.
520
- assert out["merges_measured"] == 1
521
- assert out["merges_measured"] <= out["merge_count"]
522
- merge_files = {f["path"]: f for f in out["merge_files"]}
523
- # The first block is the first-parent diff on every git version; the
524
- # repeat must not be added on top of it.
525
- assert merge_files["s.py"]["added"] == 2
526
- assert merge_files["s.py"]["deleted"] == 1
527
- assert merge_files["s.py"]["commit_count"] == 1
528
-
529
-
530
- def test_valid_range_with_no_commits_keeps_the_full_shape(tmp_path):
531
- # A mis-specified epic range is a valid, empty range. It must still answer
532
- # with every documented key rather than a differently-shaped stub.
533
- repo = _make_repo(tmp_path)
534
- proc = _proc("--repo", str(repo), "--range", "HEAD..HEAD")
535
- out = _json(proc)
536
- assert proc.returncode == 0
537
- assert set(out) == {
538
- "range",
539
- "commit_count",
540
- "merge_count",
541
- "merges_measured",
542
- "commits",
543
- "files",
544
- "merge_files",
545
- "stories_supplied",
546
- }
547
- assert out["commit_count"] == 0
548
- assert out["merge_count"] == 0
549
- assert out["merges_measured"] == 0
550
- assert out["commits"] == [] and out["files"] == [] and out["merge_files"] == []
551
-
552
-
553
- def test_linear_history_reports_no_merges(tmp_path):
554
- repo = _make_repo(tmp_path)
555
- out = _json(_proc("--repo", str(repo), "--range", "HEAD~1..HEAD"))
556
- assert out["merge_count"] == 0
557
- assert out["merges_measured"] == 0
558
- assert out["merge_files"] == []
559
-
560
-
561
- def _recording_git(tmp_path, calls):
562
- """A `git` shim that records each invocation as one \\x1f-delimited record
563
- (one field per argument, so argument boundaries survive) and then execs the
564
- real git."""
565
- real_git = shutil.which("git")
566
- assert real_git, "git must be on PATH"
567
- return _fake_git(
568
- tmp_path,
569
- "#!/bin/sh\n"
570
- f"( printf '%s\\037' \"$@\"; printf '\\n' ) >> \"{calls}\"\n"
571
- f'exec "{real_git}" "$@"\n',
572
- )
573
-
574
-
575
- def _numstat_invocations(calls):
576
- """The recorded `git log --numstat` invocations, each as an argument list."""
577
- out = []
578
- for line in calls.read_text().splitlines():
579
- argv = [field for field in line.split("\x1f") if field]
580
- if "--numstat" in argv:
581
- out.append(argv)
582
- return out
583
-
584
-
585
- def test_second_pass_runs_only_when_the_range_has_merges(tmp_path):
586
- # The merge pass is skipped outright on linear history, so the common case
587
- # still costs exactly one `git log` — and the two passes must differ in
588
- # exactly the arguments the design depends on.
589
- calls = tmp_path / "calls.log"
590
- overlay = _recording_git(tmp_path, calls)
591
- merge_args = {"-m", "--first-parent", "--min-parents=2"}
592
-
593
- (tmp_path / "linear").mkdir()
594
- (tmp_path / "merged").mkdir()
595
-
596
- linear = _make_repo(tmp_path / "linear")
597
- _json(_proc("--repo", str(linear), "--range", "HEAD~1..HEAD", env=overlay))
598
- logs = _numstat_invocations(calls)
599
- assert len(logs) == 1, logs
600
-
601
- calls.write_text("")
602
- merged, base = _merge_repo(tmp_path / "merged")
603
- _json(_proc("--repo", str(merged), "--range", f"{base}..HEAD", env=overlay))
604
- logs = _numstat_invocations(calls)
605
- assert len(logs) == 2, logs
606
- # Pass 1 keeps full topology: none of the merge-pass arguments may reach it,
607
- # or the story-branch commits drop out of the listing and attribution dies.
608
- assert merge_args.isdisjoint(logs[0]), logs[0]
609
- assert merge_args.issubset(logs[1]), logs[1]
610
-
611
-
612
- def test_multi_story_subject_attributes_to_every_match(tmp_path):
613
- # First-match-wins silently dropped the second story from the attribution.
614
- repo = tmp_path / "repo"
615
- repo.mkdir()
616
- _git(repo, "init", "-q", "-b", "main")
617
- (repo / "f.py").write_text("a\n")
618
- _git(repo, "add", "-A")
619
- _git(repo, "commit", "-qm", "base")
620
- (repo / "f.py").write_text("a\nb\n")
621
- _git(repo, "commit", "-qam", "fix seam between 1-2 and 1-3")
622
-
623
- out = _json(
624
- _proc(
625
- "--repo", str(repo), "--range", "HEAD~1..HEAD", "--stories", "1-3,1-2"
626
- )
627
- )
628
- # Every match, in --stories order — not whichever id was passed first.
629
- assert out["commits"][0]["stories"] == ["1-3", "1-2"]
630
-
631
- # A repeated id must not list the commit twice: any per-story total built
632
- # from `stories` would count it twice.
633
- repeated = _json(
634
- _proc(
635
- "--repo", str(repo), "--range", "HEAD~1..HEAD", "--stories", "1-3,1-2,1-3"
636
- )
637
- )
638
- assert repeated["commits"][0]["stories"] == ["1-3", "1-2"]
639
- assert repeated["stories_supplied"] == ["1-3", "1-2"]
640
-
641
-
642
- def test_subject_naming_no_story_gets_an_empty_list(tmp_path):
643
- repo = tmp_path / "repo"
644
- repo.mkdir()
645
- _git(repo, "init", "-q", "-b", "main")
646
- (repo / "f.py").write_text("a\n")
647
- _git(repo, "add", "-A")
648
- _git(repo, "commit", "-qm", "base")
649
- (repo / "f.py").write_text("a\nb\n")
650
- _git(repo, "commit", "-qam", "chore: tidy imports")
651
-
652
- out = _json(
653
- _proc(
654
- "--repo", str(repo), "--range", "HEAD~1..HEAD", "--stories", "1-2,1-3"
655
- )
656
- )
657
- assert out["commits"][0]["stories"] == []
658
-
659
-
660
- def test_git_failure_with_empty_stderr_reports_the_exit_code(tmp_path):
661
- # A quiet git failure (signal kill, empty stderr) must not leave the caller
662
- # with `"error": ""` and nothing to report.
663
- overlay = _fake_git(tmp_path, "#!/bin/sh\nexit 3\n")
664
- proc = _proc("--repo", str(tmp_path), "--range", "HEAD~1..HEAD", env=overlay)
665
- out = _json(proc)
666
- assert proc.returncode == 1
667
- assert out["ok"] is False
668
- assert out["error"] == "git exited 3"
669
-
670
-
671
- def _binary_repo(tmp_path):
672
- """A binary-only path plus a path that is binary twice and text once."""
673
- repo = tmp_path / "repo"
674
- repo.mkdir()
675
- _git(repo, "init", "-q", "-b", "main")
676
- (repo / "keep.txt").write_text("keep\n")
677
- _git(repo, "add", "-A")
678
- _git(repo, "commit", "-qm", "base")
679
- base = _rev(repo, "HEAD")
680
-
681
- (repo / "src").mkdir()
682
- (repo / "src" / "x.py").write_bytes(b"\x00\x01bin\n")
683
- (repo / "blob.bin").write_bytes(b"\x00\x01blob\n")
684
- _git(repo, "add", "-A")
685
- _git(repo, "commit", "-qm", "add binary content")
686
- (repo / "src" / "x.py").write_text("one\ntwo\n") # binary -> text: still binary
687
- _git(repo, "commit", "-qam", "x.py becomes text")
688
- (repo / "src" / "x.py").write_text("one\ntwo\nthree\n") # text -> text: measured
689
- _git(repo, "commit", "-qam", "grow x.py")
690
- (repo / "blob.bin").write_bytes(b"\x00\x02blob\n")
691
- _git(repo, "commit", "-qam", "churn the blob")
692
- return repo, base
693
-
694
-
695
- def test_binary_revisions_no_longer_erase_measured_text_churn(tmp_path):
696
- repo, base = _binary_repo(tmp_path)
697
- out = _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD"))
698
- x = {f["path"]: f for f in out["files"]}["src/x.py"]
699
- assert x["added"] == 1 and x["deleted"] == 0 and x["net"] == 1
700
- assert x["binary_revisions"] == 2
701
- assert x["commit_count"] == 3
702
-
703
-
704
- def test_binary_only_path_reports_zero_sums_and_its_revision_count(tmp_path):
705
- repo, base = _binary_repo(tmp_path)
706
- out = _json(_proc("--repo", str(repo), "--range", f"{base}..HEAD"))
707
- blob = {f["path"]: f for f in out["files"]}["blob.bin"]
708
- assert blob["added"] == 0 and blob["deleted"] == 0 and blob["net"] == 0
709
- assert blob["binary_revisions"] == 2
710
- assert blob["commit_count"] == 2
711
-
712
-
713
- def test_success_shape_carries_every_documented_key(tmp_path):
714
- repo = _make_repo(tmp_path)
715
- out = _json(_proc("--repo", str(repo), "--range", "HEAD~1..HEAD"))
716
- assert set(out) >= {
717
- "range",
718
- "commit_count",
719
- "merge_count",
720
- "merges_measured",
721
- "commits",
722
- "files",
723
- "merge_files",
724
- "stories_supplied",
725
- }
726
- assert set(out["commits"][0]) == {"sha", "subject", "stories", "is_merge"}
727
- assert set(out["files"][0]) == {
728
- "path",
729
- "added",
730
- "deleted",
731
- "net",
732
- "commit_count",
733
- "binary_revisions",
734
- }
735
-
736
-
737
- def test_explicit_repo_ignores_ambient_git_dir(tmp_path):
738
- repo = _make_repo(tmp_path)
739
- proc = _proc(
740
- "--repo",
741
- str(repo),
742
- "--range",
743
- "HEAD~1..HEAD",
744
- env={"GIT_DIR": str(tmp_path / "wrong-git-dir")},
745
- )
746
- assert _json(proc)["commit_count"] == 1
747
-
748
-
749
- if __name__ == "__main__":
750
- sys.exit(pytest.main([__file__, "-q"]))