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
@@ -0,0 +1,84 @@
1
+ import { readFile } from 'node:fs/promises'
2
+ import { join } from 'node:path'
3
+ import { parse } from 'yaml'
4
+ import { packageRoot } from './version.js'
5
+
6
+ const PLACEHOLDER = /\{(\w+)\}/g
7
+
8
+ export class MessagesError extends Error {}
9
+
10
+ /**
11
+ * @param {string} [filePath]
12
+ * @returns {Promise<Record<string, any>>}
13
+ */
14
+ export async function loadMessages(filePath = join(packageRoot, 'messages.yaml')) {
15
+ let text
16
+ try {
17
+ text = await readFile(filePath, 'utf8')
18
+ } catch (err) {
19
+ throw new MessagesError(`cannot read ${filePath}: ${errorText(err)}`)
20
+ }
21
+
22
+ let data
23
+ try {
24
+ data = parse(text)
25
+ } catch (err) {
26
+ throw new MessagesError(`invalid YAML in ${filePath}: ${errorText(err)}`)
27
+ }
28
+
29
+ if (!isRecord(data)) throw new MessagesError(`${filePath} must hold a mapping of keys`)
30
+ return data
31
+ }
32
+
33
+ /**
34
+ * @param {string} template
35
+ * @param {Record<string, string | number>} [values]
36
+ * @returns {string}
37
+ */
38
+ export function render(template, values = {}) {
39
+ return template.replace(PLACEHOLDER, (match, key) => {
40
+ const value = values[key]
41
+ if (value === undefined || value === null) throw new MessagesError(`no value for ${match}`)
42
+ return String(value)
43
+ })
44
+ }
45
+
46
+ /**
47
+ * @param {Record<string, any>} messages
48
+ * @param {string} key
49
+ * @param {Record<string, string | number>} [values]
50
+ * @returns {string}
51
+ */
52
+ export function message(messages, key, values) {
53
+ const found = lookup(messages, key)
54
+ if (typeof found !== 'string') throw new MessagesError(`unknown message key: ${key}`)
55
+ return render(found, values)
56
+ }
57
+
58
+ /**
59
+ * @param {Record<string, any>} messages
60
+ * @param {string} key
61
+ * @returns {unknown}
62
+ */
63
+ function lookup(messages, key) {
64
+ /** @type {unknown} */
65
+ let current = messages
66
+ for (const part of key.split('.')) {
67
+ if (!isRecord(current)) return undefined
68
+ current = current[part]
69
+ }
70
+ return current
71
+ }
72
+
73
+ /**
74
+ * @param {unknown} value
75
+ * @returns {value is Record<string, any>}
76
+ */
77
+ function isRecord(value) {
78
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
79
+ }
80
+
81
+ /** @param {unknown} err */
82
+ function errorText(err) {
83
+ return err instanceof Error ? err.message : String(err)
84
+ }
package/src/modules.js ADDED
@@ -0,0 +1,221 @@
1
+ import { readFile } from 'node:fs/promises'
2
+ import { homedir } from 'node:os'
3
+ import { join, resolve } from 'node:path'
4
+ import { parse } from 'yaml'
5
+ import { packageRoot } from './version.js'
6
+
7
+ /** @typedef {{ code: string, name: string, description: string, source: string, record: string, aliases?: string[], always?: boolean, default?: boolean, deprecated?: string, requires?: string[], custom?: boolean, ref?: string }} ModuleDefinition */
8
+
9
+ const SOURCE_PATTERN = /^[\w.-]+\/[\w.-]+(\/[\w.-]+)*$/
10
+ const SOURCE_OVERRIDE = 'BMAD_INSTALLER_SOURCE_OVERRIDE'
11
+
12
+ export class ModulesError extends Error {
13
+ /** @param {string} message */
14
+ constructor(message) {
15
+ super(message)
16
+ this.name = 'ModulesError'
17
+ }
18
+ }
19
+
20
+ export class UnknownModuleError extends ModulesError {
21
+ /**
22
+ * @param {string} code
23
+ * @param {ModuleDefinition[]} modules
24
+ */
25
+ constructor(code, modules) {
26
+ super(`unknown module "${code}"`)
27
+ this.name = 'UnknownModuleError'
28
+ this.code = code
29
+ this.known = modules.filter((module) => !module.always).map((module) => module.code).join(', ')
30
+ }
31
+ }
32
+
33
+ /**
34
+ * @param {unknown} value
35
+ * @param {string} where
36
+ * @param {string} field
37
+ * @returns {string}
38
+ */
39
+ function requireText(value, where, field) {
40
+ if (typeof value !== 'string' || value.trim() === '') {
41
+ throw new ModulesError(`${where}: ${field} must be a non-empty string`)
42
+ }
43
+ return value
44
+ }
45
+
46
+ /**
47
+ * @param {any} entry
48
+ * @param {number} index
49
+ * @param {Set<string>} taken
50
+ * @returns {ModuleDefinition}
51
+ */
52
+ function validateModule(entry, index, taken) {
53
+ const code = requireText(entry?.code, `modules[${index}]`, 'code')
54
+ const where = `module "${code}"`
55
+ const source = requireText(entry.source, where, 'source')
56
+ if (!SOURCE_PATTERN.test(source)) {
57
+ throw new ModulesError(`${where}: source must look like owner/repo or owner/repo/path/to/folder`)
58
+ }
59
+ /** @type {ModuleDefinition} */
60
+ const module = {
61
+ code,
62
+ name: requireText(entry.name, where, 'name'),
63
+ description: requireText(entry.description, where, 'description'),
64
+ source,
65
+ record: requireText(entry.record, where, 'record'),
66
+ }
67
+ for (const claimed of [code, ...(entry.aliases ?? [])]) {
68
+ const text = requireText(claimed, where, 'aliases')
69
+ if (taken.has(text)) throw new ModulesError(`${where}: "${text}" is already used by another module`)
70
+ taken.add(text)
71
+ }
72
+ if (entry.aliases) module.aliases = [...entry.aliases]
73
+ if (entry.always === true) module.always = true
74
+ if (entry.default === true) module.default = true
75
+ if (entry.deprecated !== undefined) module.deprecated = requireText(entry.deprecated, where, 'deprecated')
76
+ if (entry.requires !== undefined) {
77
+ if (!Array.isArray(entry.requires)) throw new ModulesError(`${where}: requires must be a list of module codes`)
78
+ module.requires = entry.requires.map((/** @type {unknown} */ code) => requireText(code, where, 'requires'))
79
+ }
80
+ return module
81
+ }
82
+
83
+ /**
84
+ * @param {string} [filePath]
85
+ * @returns {Promise<ModuleDefinition[]>}
86
+ */
87
+ export async function loadModules(filePath = join(packageRoot, 'modules.yaml')) {
88
+ const document = parse(await readFile(filePath, 'utf8'))
89
+ const entries = document?.modules
90
+ if (!Array.isArray(entries) || entries.length === 0) {
91
+ throw new ModulesError('modules must be a non-empty array')
92
+ }
93
+ /** @type {Set<string>} */
94
+ const taken = new Set()
95
+ const modules = entries.map((entry, index) => validateModule(entry, index, taken))
96
+ for (const module of modules) {
97
+ for (const code of module.requires ?? []) {
98
+ if (!modules.some((other) => other.code === code)) {
99
+ throw new ModulesError(`module "${module.code}": requires names "${code}", which is not a module code`)
100
+ }
101
+ }
102
+ }
103
+ const override = process.env[SOURCE_OVERRIDE]
104
+ if (!override) return modules
105
+ const repo = repoOf((modules.find((module) => module.always) ?? modules[0]).source)
106
+ return modules.map((module) => ({ ...module, source: overrideSource(module.source, override, repo) }))
107
+ }
108
+
109
+ /**
110
+ * @param {string} source
111
+ * @returns {string}
112
+ */
113
+ export function repoOf(source) {
114
+ return source.split('#')[0].split('/').slice(0, 2).join('/')
115
+ }
116
+
117
+ /**
118
+ * Swaps the repository of a module from `repo` for `override` and keeps the module's folder, so a
119
+ * local checkout or a ref such as `owner/repo#dev` stands in for the published one. A `#ref` in
120
+ * the override goes after the folder, where the skills CLI reads it.
121
+ * @param {string} source
122
+ * @param {string} override
123
+ * @param {string} repo
124
+ * @returns {string}
125
+ */
126
+ export function overrideSource(source, override, repo) {
127
+ if (repoOf(source) !== repo) return source
128
+ const [base, ref] = override.split('#')
129
+ const folder = source.split('/').slice(2).join('/')
130
+ return `${base.replace(/\/+$/, '')}${folder ? `/${folder}` : ''}${ref ? `#${ref}` : ''}`
131
+ }
132
+
133
+ /**
134
+ * @param {ModuleDefinition[]} modules
135
+ * @param {string} codeOrAlias
136
+ * @returns {ModuleDefinition | undefined}
137
+ */
138
+ export function findModule(modules, codeOrAlias) {
139
+ return modules.find((module) => module.code === codeOrAlias || (module.aliases ?? []).includes(codeOrAlias))
140
+ }
141
+
142
+ /**
143
+ * A module code never holds a slash; anything that does before its `#ref` is a source the skills
144
+ * CLI can install from: `owner/repo/folder#ref`, a git URL or a local path. A ref may hold one.
145
+ * @param {string} token
146
+ */
147
+ export function isModuleSource(token) {
148
+ const base = token.split('#')[0]
149
+ return base.includes('/') || base.includes('\\') || base === '.' || base === '~'
150
+ }
151
+
152
+ /**
153
+ * A local path is made absolute against the shell's folder, since the skills CLI runs in the project.
154
+ * @param {string} source
155
+ * @param {string} [cwd]
156
+ * @returns {string}
157
+ */
158
+ export function normalizeSource(source, cwd = process.cwd()) {
159
+ if (/^~([\\/]|$)/.test(source)) return join(homedir(), source.slice(1))
160
+ if (/^\.{1,2}([\\/]|$)/.test(source)) return resolve(cwd, source)
161
+ return source
162
+ }
163
+
164
+ /**
165
+ * The source on a branch or tag. A ref already in the source is replaced.
166
+ * @param {string} source
167
+ * @param {string} ref
168
+ * @returns {string}
169
+ */
170
+ export function sourceAtRef(source, ref) {
171
+ return `${source.split('#')[0]}#${ref}`
172
+ }
173
+
174
+ /**
175
+ * Module codes and aliases from modules.yaml, each with an optional `#ref` for a branch or tag,
176
+ * and sources for modules not in it. An alias comes back as its code.
177
+ * @param {string} value
178
+ * @param {ModuleDefinition[]} modules
179
+ * @returns {string[]}
180
+ */
181
+ export function parseModulesFlag(value, modules) {
182
+ /** @type {string[]} */
183
+ const codes = []
184
+ for (const token of value.split(',')) {
185
+ const picked = token.trim()
186
+ if (picked === '') continue
187
+ const code = isModuleSource(picked) ? normalizeSource(picked) : listedCode(picked, modules)
188
+ if (!code) throw new UnknownModuleError(picked, modules)
189
+ if (!codes.includes(code)) codes.push(code)
190
+ }
191
+ return codes
192
+ }
193
+
194
+ /**
195
+ * @param {string} picked
196
+ * @param {ModuleDefinition[]} modules
197
+ * @returns {string | undefined}
198
+ */
199
+ function listedCode(picked, modules) {
200
+ const [name, ref] = picked.split('#')
201
+ const module = findModule(modules, name)
202
+ if (!module) return undefined
203
+ return ref ? `${module.code}#${ref}` : module.code
204
+ }
205
+
206
+ /**
207
+ * A module from outside modules.yaml, named by where it comes from.
208
+ * @param {string} source
209
+ * @returns {ModuleDefinition}
210
+ */
211
+ export function customModule(source) {
212
+ return { code: source, name: source, description: '', source, record: '', custom: true }
213
+ }
214
+
215
+ /**
216
+ * @param {ModuleDefinition[]} modules
217
+ * @returns {string[]}
218
+ */
219
+ export function defaultCodes(modules) {
220
+ return modules.filter((module) => module.default === true).map((module) => module.code)
221
+ }
@@ -0,0 +1,124 @@
1
+ import { determineAgent } from '@vercel/detect-agent'
2
+ import { message } from './messages.js'
3
+
4
+ /** @typedef {import('./run.js').Runner} Runner */
5
+
6
+ const UV_TIMEOUT_MS = 5000
7
+ const NODE_MAJOR_FLOOR = 22
8
+ const SKILLS_CLI_MINOR_FLOOR = 20
9
+ const WSL_PATH_PATTERN = /^\\\\wsl(\.localhost|\$)?\\/
10
+ const WSL_EXEC_PATHS = ['\\wsl$\\', '\\wsl.localhost\\']
11
+ const UV_VERSION_PATTERN = /uv\s+(\d+\.\d+(?:\.\d+)?)/
12
+
13
+ export class PreflightError extends Error {
14
+ name = 'PreflightError'
15
+ }
16
+
17
+ /**
18
+ * @param {string} [version]
19
+ * @returns {'ok' | 'warn' | 'too-old'}
20
+ */
21
+ export function nodeVersionState(version = process.versions.node) {
22
+ const [major, minor] = version.replace(/^v/, '').split('.').map((part) => Number.parseInt(part, 10))
23
+ if (!Number.isFinite(major) || major < NODE_MAJOR_FLOOR) return 'too-old'
24
+ if (major === NODE_MAJOR_FLOOR && (!Number.isFinite(minor) || minor < SKILLS_CLI_MINOR_FLOOR)) return 'warn'
25
+ return 'ok'
26
+ }
27
+
28
+ /**
29
+ * Said only when something failed: a Node below the skills CLI's floor usually still works.
30
+ * @param {Record<string, any>} messages
31
+ * @param {string} [version]
32
+ * @returns {string | null}
33
+ */
34
+ export function nodeFailureHint(messages, version = process.versions.node) {
35
+ return nodeVersionState(version) === 'warn' ? message(messages, 'nodeBelowSkillsFloor', { version }) : null
36
+ }
37
+
38
+ /**
39
+ * @param {{ platform: string, env: NodeJS.ProcessEnv, cwd: string, execPath: string }} [input]
40
+ * @returns {boolean}
41
+ */
42
+ export function wslRunningWindowsNode(input) {
43
+ const { platform, env, cwd, execPath } = input ?? {
44
+ platform: process.platform,
45
+ env: process.env,
46
+ cwd: process.cwd(),
47
+ execPath: process.execPath,
48
+ }
49
+ if (platform !== 'win32') return false
50
+ if (env.WSL_DISTRO_NAME || env.WSL_INTEROP) return true
51
+ if (env.PWD?.startsWith('/')) return true
52
+ if (WSL_PATH_PATTERN.test(cwd)) return true
53
+ return WSL_EXEC_PATHS.some((fragment) => execPath.includes(fragment))
54
+ }
55
+
56
+ /**
57
+ * @param {Runner} runner
58
+ * @returns {Promise<string | null>}
59
+ */
60
+ export async function uvVersion(runner) {
61
+ const result = await runner({ argv: ['uv', '--version'], timeoutMs: UV_TIMEOUT_MS })
62
+ if (result.code !== 0) return null
63
+ const match = UV_VERSION_PATTERN.exec(result.stdout)
64
+ return match ? match[1] : null
65
+ }
66
+
67
+ /** @returns {Promise<string | null>} */
68
+ export async function insideAgent() {
69
+ const result = await determineAgent()
70
+ return result.isAgent ? result.agent.name : null
71
+ }
72
+
73
+ /**
74
+ * @param {NodeJS.ReadStream} [stdin]
75
+ * @param {NodeJS.WriteStream} [stdout]
76
+ * @returns {boolean}
77
+ */
78
+ export function hasTerminal(stdin = process.stdin, stdout = process.stdout) {
79
+ return Boolean(stdin?.isTTY && stdout?.isTTY)
80
+ }
81
+
82
+ /**
83
+ * @param {Record<string, any>} messages
84
+ * @param {string} [platform]
85
+ * @returns {string}
86
+ */
87
+ export function uvInstallCommand(messages, platform = process.platform) {
88
+ const commands = messages.uvInstall ?? {}
89
+ return String(commands[platform] ?? commands.linux ?? '')
90
+ }
91
+
92
+ /**
93
+ * `terminal` and `agent` are injectable so the command tests can drive the interactive path.
94
+ * Missing `uv` does not stop the run; callers decide how to warn and degrade when `uv` is null.
95
+ * @param {{ interactive: boolean, runner: Runner, messages: Record<string, any>, platform?: string, terminal?: () => boolean, agent?: () => Promise<string | null> }} options
96
+ * @returns {Promise<{ uv: string | null }>}
97
+ */
98
+ export async function runPreflight(options) {
99
+ const {
100
+ interactive,
101
+ runner,
102
+ messages,
103
+ platform = process.platform,
104
+ terminal = hasTerminal,
105
+ agent: readAgent = insideAgent,
106
+ } = options
107
+ const version = process.versions.node
108
+ const state = nodeVersionState(version)
109
+ if (state === 'too-old') throw new PreflightError(message(messages, 'nodeTooOld', { version }))
110
+
111
+ const wsl = wslRunningWindowsNode({ platform, env: process.env, cwd: process.cwd(), execPath: process.execPath })
112
+ if (wsl) throw new PreflightError(message(messages, 'wslWindowsNode'))
113
+
114
+ const uv = await uvVersion(runner)
115
+
116
+ if (!interactive) return { uv }
117
+
118
+ if (!terminal()) throw new PreflightError(message(messages, 'needsTerminal'))
119
+
120
+ const agent = await readAgent()
121
+ if (agent) throw new PreflightError(message(messages, 'insideAgent', { agent }))
122
+
123
+ return { uv }
124
+ }
@@ -0,0 +1,68 @@
1
+ import { readFile } from 'node:fs/promises'
2
+ import { isAbsolute, join, posix, resolve } from 'node:path'
3
+ import { repoOf } from './modules.js'
4
+
5
+ /** @typedef {{ source?: string, sourceUrl?: string, sourceType?: string, ref?: string, skillPath?: string }} LockEntry */
6
+
7
+ /**
8
+ * The skills CLI's project lock, `skills-lock.json`: where each skill was installed from.
9
+ * @param {string} directory
10
+ * @returns {Promise<Record<string, LockEntry>>}
11
+ */
12
+ export async function readProjectLock(directory) {
13
+ try {
14
+ const lock = JSON.parse(await readFile(join(directory, 'skills-lock.json'), 'utf8'))
15
+ return lock?.skills && typeof lock.skills === 'object' ? lock.skills : {}
16
+ } catch {
17
+ return {}
18
+ }
19
+ }
20
+
21
+ /**
22
+ * The folder holding a module, from the lock entry of its record: the parent of the record's own
23
+ * folder, on the source and ref it came from. Mirrors the skills CLI's own update source, one
24
+ * folder up. Null when the entry cannot be installed again (a bare shorthand for a generic git host).
25
+ * @param {LockEntry | undefined} entry
26
+ * @param {string} directory
27
+ * @returns {string | null}
28
+ */
29
+ export function moduleSourceFromLock(entry, directory) {
30
+ if (!entry || entry.sourceType === 'well-known' || entry.sourceType === 'node_modules') return null
31
+ const github = !entry.sourceType || entry.sourceType === 'github'
32
+ let source = github ? entry.source : entry.sourceUrl || entry.source
33
+ if (!source) return null
34
+ const bareShorthand = !source.includes(':') && !/^[./]/.test(source)
35
+ if ((entry.sourceType === 'git' || entry.sourceType === 'gitlab') && bareShorthand) return null
36
+ const skillFolder = (entry.skillPath ?? '').replace(/\/?SKILL\.md$/, '')
37
+ const folder = skillFolder ? posix.dirname(skillFolder) : '.'
38
+ if (entry.sourceType === 'local') return join(isAbsolute(source) ? source : resolve(directory, source), ...folder.split('/'))
39
+ const withFolder = github && folder !== '.' ? `${source.replace(/\/+$/, '')}/${folder}` : source
40
+ return entry.ref ? `${withFolder}#${entry.ref}` : withFolder
41
+ }
42
+
43
+ /**
44
+ * The branch or tag a module in modules.yaml was installed from, when the lock entry of its
45
+ * record names one and comes from the module's own repository. Only the ref is taken: the folder
46
+ * stays the one modules.yaml gives, which survives a module moving inside its repository.
47
+ * @param {LockEntry | undefined} entry
48
+ * @param {string} source
49
+ * @returns {string | undefined}
50
+ */
51
+ export function lockedRef(entry, source) {
52
+ if (!entry?.ref || source.includes('#')) return undefined
53
+ return lockedGitHubRepo(entry) === repoOf(source).toLowerCase() ? entry.ref : undefined
54
+ }
55
+
56
+ /**
57
+ * The `owner/repo` on github.com a lock entry came from, in lower case: from a shorthand, or from
58
+ * an https or SSH git URL. Undefined for any other host or source type.
59
+ * @param {LockEntry} entry
60
+ * @returns {string | undefined}
61
+ */
62
+ function lockedGitHubRepo(entry) {
63
+ if (!entry.sourceType || entry.sourceType === 'github') return entry.source?.toLowerCase()
64
+ if (entry.sourceType !== 'git') return undefined
65
+ const url = entry.sourceUrl || entry.source || ''
66
+ const match = /^(?:https:\/\/github\.com\/|git@github\.com:|ssh:\/\/git@github\.com\/)([\w.-]+\/[\w.-]+?)(?:\.git)?\/?$/i.exec(url)
67
+ return match?.[1].toLowerCase()
68
+ }