bmad-method 6.0.0-alpha.12 → 6.0.0-alpha.13

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 (491) hide show
  1. package/.github/workflows/bundle-latest.yaml +79 -27
  2. package/CHANGELOG.md +159 -1
  3. package/README.md +3 -1
  4. package/custom/src/agents/commit-poet/commit-poet.agent.yaml +129 -0
  5. package/custom/src/agents/commit-poet/installation-guide.md +36 -0
  6. package/custom/src/agents/toolsmith/installation-guide.md +36 -0
  7. package/custom/src/agents/toolsmith/toolsmith-sidecar/instructions.md +70 -0
  8. package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/bundlers.md +111 -0
  9. package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/deploy.md +70 -0
  10. package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/docs.md +114 -0
  11. package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/installers.md +134 -0
  12. package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/modules.md +161 -0
  13. package/custom/src/agents/toolsmith/toolsmith-sidecar/knowledge/tests.md +103 -0
  14. package/custom/src/agents/toolsmith/toolsmith-sidecar/memories.md +17 -0
  15. package/custom/src/agents/toolsmith/toolsmith.agent.yaml +108 -0
  16. package/docs/custom-agent-installation.md +31 -17
  17. package/docs/ide-info/rovo-dev.md +388 -0
  18. package/docs/index.md +6 -81
  19. package/docs/installers-bundlers/installers-modules-platforms-reference.md +1 -1
  20. package/package.json +1 -1
  21. package/src/core/agents/bmad-master.agent.yaml +1 -1
  22. package/src/core/agents/bmad-web-orchestrator.agent.xml +1 -1
  23. package/src/core/tasks/advanced-elicitation-methods.csv +51 -21
  24. package/src/core/tasks/advanced-elicitation.xml +18 -8
  25. package/src/core/tasks/workflow.xml +36 -71
  26. package/src/core/workflows/brainstorming/brain-methods.csv +62 -36
  27. package/src/core/workflows/brainstorming/steps/step-01-session-setup.md +196 -0
  28. package/src/core/workflows/brainstorming/steps/step-01b-continue.md +121 -0
  29. package/src/core/workflows/brainstorming/steps/step-02a-user-selected.md +224 -0
  30. package/src/core/workflows/brainstorming/steps/step-02b-ai-recommended.md +236 -0
  31. package/src/core/workflows/brainstorming/steps/step-02c-random-selection.md +208 -0
  32. package/src/core/workflows/brainstorming/steps/step-02d-progressive-flow.md +263 -0
  33. package/src/core/workflows/brainstorming/steps/step-03-technique-execution.md +339 -0
  34. package/src/core/workflows/brainstorming/steps/step-04-idea-organization.md +302 -0
  35. package/src/core/workflows/brainstorming/template.md +13 -104
  36. package/src/core/workflows/brainstorming/workflow.md +51 -0
  37. package/src/core/workflows/party-mode/steps/step-01-agent-loading.md +138 -0
  38. package/src/core/workflows/party-mode/steps/step-02-discussion-orchestration.md +203 -0
  39. package/src/core/workflows/party-mode/steps/step-03-graceful-exit.md +159 -0
  40. package/src/core/workflows/party-mode/workflow.md +207 -0
  41. package/src/modules/bmb/README.md +153 -86
  42. package/src/modules/bmb/_module-installer/install-config.yaml +3 -3
  43. package/src/modules/bmb/agents/bmad-builder.agent.yaml +45 -31
  44. package/src/modules/bmb/docs/{agent-menu-patterns.md → agents/agent-menu-patterns.md} +1 -1
  45. package/src/modules/bmb/docs/agents/kb.csv +0 -0
  46. package/src/modules/bmb/docs/{module-agent-architecture.md → agents/module-agent-architecture.md} +1 -1
  47. package/src/modules/bmb/docs/{simple-agent-architecture.md → agents/simple-agent-architecture.md} +1 -1
  48. package/src/modules/bmb/docs/workflows/architecture.md +220 -0
  49. package/src/modules/bmb/docs/workflows/common-workflow-tools.csv +19 -0
  50. package/src/modules/bmb/docs/workflows/csv-data-file-standards.md +206 -0
  51. package/src/modules/bmb/docs/workflows/index.md +45 -0
  52. package/src/modules/bmb/docs/workflows/intent-vs-prescriptive-spectrum.md +220 -0
  53. package/src/modules/bmb/docs/workflows/kb.csv +0 -0
  54. package/src/modules/bmb/docs/workflows/step-template.md +283 -0
  55. package/src/modules/bmb/docs/workflows/terms.md +97 -0
  56. package/src/modules/bmb/docs/workflows/workflow-template.md +152 -0
  57. package/src/modules/bmb/reference/agents/module-examples/README.md +1 -1
  58. package/src/modules/bmb/reference/agents/module-examples/security-engineer.agent.yaml +2 -2
  59. package/src/modules/bmb/reference/agents/module-examples/trend-analyst.agent.yaml +1 -1
  60. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/data/dietary-restrictions.csv +18 -0
  61. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/data/macro-calculator.csv +16 -0
  62. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/data/recipe-database.csv +28 -0
  63. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/steps/step-01-init.md +177 -0
  64. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/steps/step-01b-continue.md +150 -0
  65. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/steps/step-02-profile.md +164 -0
  66. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/steps/step-03-assessment.md +152 -0
  67. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/steps/step-04-strategy.md +182 -0
  68. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/steps/step-05-shopping.md +167 -0
  69. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/steps/step-06-prep-schedule.md +194 -0
  70. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/templates/assessment-section.md +25 -0
  71. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/templates/nutrition-plan.md +68 -0
  72. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/templates/prep-schedule-section.md +29 -0
  73. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/templates/profile-section.md +47 -0
  74. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/templates/shopping-section.md +37 -0
  75. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/templates/strategy-section.md +18 -0
  76. package/src/modules/bmb/reference/workflows/meal-prep-nutrition/workflow.md +58 -0
  77. package/src/modules/bmb/workflows/create-agent/data/info-and-installation-guide.md +17 -0
  78. package/src/modules/bmb/workflows/create-agent/data/reference/README.md +3 -0
  79. package/src/modules/bmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/README.md +242 -0
  80. package/src/modules/bmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/breakthroughs.md +24 -0
  81. package/src/modules/bmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/instructions.md +108 -0
  82. package/src/modules/bmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/memories.md +46 -0
  83. package/src/modules/bmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper-sidecar/mood-patterns.md +39 -0
  84. package/src/modules/bmb/workflows/create-agent/data/reference/agents/expert-examples/journal-keeper/journal-keeper.agent.yaml +152 -0
  85. package/src/modules/bmb/workflows/create-agent/data/reference/agents/module-examples/README.md +50 -0
  86. package/src/modules/bmb/workflows/create-agent/data/reference/agents/module-examples/security-engineer.agent.yaml +53 -0
  87. package/src/modules/bmb/workflows/create-agent/data/reference/agents/module-examples/trend-analyst.agent.yaml +57 -0
  88. package/src/modules/bmb/workflows/create-agent/data/reference/agents/simple-examples/README.md +223 -0
  89. package/src/modules/bmb/workflows/create-agent/data/reference/agents/simple-examples/commit-poet.agent.yaml +126 -0
  90. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/data/dietary-restrictions.csv +18 -0
  91. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/data/macro-calculator.csv +16 -0
  92. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/data/recipe-database.csv +28 -0
  93. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-01-init.md +177 -0
  94. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-01b-continue.md +150 -0
  95. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-02-profile.md +164 -0
  96. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-03-assessment.md +152 -0
  97. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-04-strategy.md +182 -0
  98. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-05-shopping.md +167 -0
  99. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/steps/step-06-prep-schedule.md +194 -0
  100. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/assessment-section.md +25 -0
  101. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/nutrition-plan.md +68 -0
  102. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/prep-schedule-section.md +29 -0
  103. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/profile-section.md +47 -0
  104. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/shopping-section.md +37 -0
  105. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/templates/strategy-section.md +18 -0
  106. package/src/modules/bmb/workflows/create-agent/data/reference/workflows/meal-prep-nutrition/workflow.md +58 -0
  107. package/src/modules/bmb/workflows/create-agent/data/validation-complete.md +305 -0
  108. package/src/modules/bmb/workflows/create-agent/steps/step-01-brainstorm.md +145 -0
  109. package/src/modules/bmb/workflows/create-agent/steps/step-02-discover.md +210 -0
  110. package/src/modules/bmb/workflows/create-agent/steps/step-03-persona.md +260 -0
  111. package/src/modules/bmb/workflows/create-agent/steps/step-04-commands.md +237 -0
  112. package/src/modules/bmb/workflows/create-agent/steps/step-05-name.md +231 -0
  113. package/src/modules/bmb/workflows/create-agent/steps/step-06-build.md +224 -0
  114. package/src/modules/bmb/workflows/create-agent/steps/step-07-validate.md +234 -0
  115. package/src/modules/bmb/workflows/create-agent/steps/step-08-setup.md +179 -0
  116. package/src/modules/bmb/workflows/create-agent/steps/step-09-customize.md +197 -0
  117. package/src/modules/bmb/workflows/create-agent/steps/step-10-build-tools.md +180 -0
  118. package/src/modules/bmb/workflows/create-agent/steps/step-11-celebrate.md +222 -0
  119. package/src/modules/bmb/workflows/create-agent/templates/agent_commands.md +21 -0
  120. package/src/modules/bmb/workflows/create-agent/templates/agent_persona.md +25 -0
  121. package/src/modules/bmb/workflows/create-agent/templates/agent_purpose_and_type.md +23 -0
  122. package/src/modules/bmb/workflows/create-agent/workflow.md +91 -0
  123. package/src/modules/bmb/workflows/create-workflow/steps/step-01-init.md +168 -0
  124. package/src/modules/bmb/workflows/create-workflow/steps/step-02-gather.md +233 -0
  125. package/src/modules/bmb/workflows/create-workflow/steps/step-03-tools-overview.md +127 -0
  126. package/src/modules/bmb/workflows/create-workflow/steps/step-04-core-tools.md +145 -0
  127. package/src/modules/bmb/workflows/create-workflow/steps/step-05-memory-requirements.md +136 -0
  128. package/src/modules/bmb/workflows/create-workflow/steps/step-06-external-tools.md +154 -0
  129. package/src/modules/bmb/workflows/create-workflow/steps/step-07-installation-guidance.md +159 -0
  130. package/src/modules/bmb/workflows/create-workflow/steps/step-08-tools-summary.md +167 -0
  131. package/src/modules/bmb/workflows/create-workflow/steps/step-09-design.md +239 -0
  132. package/src/modules/bmb/workflows/create-workflow/steps/step-10-plan-review.md +215 -0
  133. package/src/modules/bmb/workflows/create-workflow/steps/step-11-build.md +262 -0
  134. package/src/modules/bmb/workflows/create-workflow/steps/step-12-review.md +270 -0
  135. package/src/modules/bmb/workflows/create-workflow/templates/build-summary.md +36 -0
  136. package/src/modules/bmb/workflows/create-workflow/templates/completion-section.md +39 -0
  137. package/src/modules/bmb/workflows/create-workflow/templates/content-template.md +21 -0
  138. package/src/modules/bmb/workflows/create-workflow/templates/design-section.md +53 -0
  139. package/src/modules/bmb/workflows/create-workflow/templates/project-info.md +18 -0
  140. package/src/modules/bmb/workflows/create-workflow/templates/requirements-section.md +47 -0
  141. package/src/modules/bmb/workflows/create-workflow/templates/review-section.md +56 -0
  142. package/src/modules/bmb/workflows/create-workflow/templates/step-file.md +139 -0
  143. package/src/modules/bmb/workflows/create-workflow/templates/workflow-plan.md +54 -0
  144. package/src/modules/bmb/workflows/create-workflow/templates/workflow.md +58 -0
  145. package/src/modules/bmb/workflows/create-workflow/workflow.md +58 -0
  146. package/src/modules/bmb/workflows/edit-agent/steps/step-01-discover-intent.md +134 -0
  147. package/src/modules/bmb/workflows/edit-agent/steps/step-02-analyze-agent.md +202 -0
  148. package/src/modules/bmb/workflows/edit-agent/steps/step-03-propose-changes.md +157 -0
  149. package/src/modules/bmb/workflows/edit-agent/steps/step-04-apply-changes.md +150 -0
  150. package/src/modules/bmb/workflows/edit-agent/steps/step-05-validate.md +150 -0
  151. package/src/modules/bmb/workflows/edit-agent/workflow.md +58 -0
  152. package/src/modules/bmb/workflows/edit-workflow/steps/step-01-analyze.md +221 -0
  153. package/src/modules/bmb/workflows/edit-workflow/steps/step-02-discover.md +253 -0
  154. package/src/modules/bmb/workflows/edit-workflow/steps/step-03-improve.md +217 -0
  155. package/src/modules/bmb/workflows/edit-workflow/steps/step-04-validate.md +193 -0
  156. package/src/modules/bmb/workflows/edit-workflow/steps/step-05-compliance-check.md +245 -0
  157. package/src/modules/bmb/workflows/edit-workflow/templates/completion-summary.md +75 -0
  158. package/src/modules/bmb/workflows/edit-workflow/templates/improvement-goals.md +68 -0
  159. package/src/modules/bmb/workflows/edit-workflow/templates/improvement-log.md +40 -0
  160. package/src/modules/bmb/workflows/edit-workflow/templates/validation-results.md +51 -0
  161. package/src/modules/bmb/workflows/edit-workflow/templates/workflow-analysis.md +56 -0
  162. package/src/modules/bmb/workflows/edit-workflow/workflow.md +58 -0
  163. package/src/modules/bmb/workflows/workflow-compliance-check/steps/step-01-validate-goal.md +152 -0
  164. package/src/modules/bmb/workflows/workflow-compliance-check/steps/step-02-workflow-validation.md +243 -0
  165. package/src/modules/bmb/workflows/workflow-compliance-check/steps/step-03-step-validation.md +274 -0
  166. package/src/modules/bmb/workflows/workflow-compliance-check/steps/step-04-file-validation.md +295 -0
  167. package/src/modules/bmb/workflows/workflow-compliance-check/steps/step-05-intent-spectrum-validation.md +264 -0
  168. package/src/modules/bmb/workflows/workflow-compliance-check/steps/step-06-web-subprocess-validation.md +360 -0
  169. package/src/modules/bmb/workflows/workflow-compliance-check/steps/step-07-holistic-analysis.md +258 -0
  170. package/src/modules/bmb/workflows/workflow-compliance-check/steps/step-08-generate-report.md +301 -0
  171. package/src/modules/bmb/workflows/workflow-compliance-check/templates/compliance-report.md +140 -0
  172. package/src/modules/bmb/workflows/workflow-compliance-check/workflow.md +58 -0
  173. package/src/modules/bmgd/agents/game-architect.agent.yaml +1 -1
  174. package/src/modules/bmgd/agents/game-designer.agent.yaml +1 -1
  175. package/src/modules/bmgd/agents/game-dev.agent.yaml +1 -1
  176. package/src/modules/bmgd/agents/game-scrum-master.agent.yaml +1 -1
  177. package/src/modules/bmm/_module-installer/install-config.yaml +9 -15
  178. package/src/modules/bmm/agents/analyst.agent.yaml +14 -14
  179. package/src/modules/bmm/agents/architect.agent.yaml +12 -10
  180. package/src/modules/bmm/agents/dev.agent.yaml +20 -16
  181. package/src/modules/bmm/agents/pm.agent.yaml +13 -31
  182. package/src/modules/bmm/agents/quick-flow-solo-dev.agent.yaml +36 -0
  183. package/src/modules/bmm/agents/sm.agent.yaml +13 -31
  184. package/src/modules/bmm/agents/tea.agent.yaml +10 -7
  185. package/src/modules/bmm/agents/tech-writer.agent.yaml +7 -20
  186. package/src/modules/bmm/agents/ux-designer.agent.yaml +12 -10
  187. package/src/modules/bmm/data/README.md +29 -0
  188. package/src/modules/bmm/data/project-context-template.md +40 -0
  189. package/src/modules/bmm/docs/README.md +21 -9
  190. package/src/modules/bmm/docs/agents-guide.md +69 -23
  191. package/src/modules/bmm/docs/bmad-quick-flow.md +528 -0
  192. package/src/modules/bmm/docs/brownfield-guide.md +9 -10
  193. package/src/modules/bmm/docs/enterprise-agentic-development.md +1 -1
  194. package/src/modules/bmm/docs/glossary.md +5 -5
  195. package/src/modules/bmm/docs/images/workflow-method-greenfield.excalidraw +909 -1654
  196. package/src/modules/bmm/docs/images/workflow-method-greenfield.svg +2 -2
  197. package/src/modules/bmm/docs/quick-flow-solo-dev.md +337 -0
  198. package/src/modules/bmm/docs/scale-adaptive-system.md +5 -5
  199. package/src/modules/bmm/docs/test-architecture.md +84 -18
  200. package/src/modules/bmm/docs/workflows-analysis.md +36 -140
  201. package/src/modules/bmm/docs/workflows-implementation.md +32 -157
  202. package/src/modules/bmm/docs/workflows-planning.md +51 -212
  203. package/src/modules/bmm/docs/workflows-solutioning.md +24 -69
  204. package/src/modules/bmm/teams/default-party.csv +15 -14
  205. package/src/modules/bmm/teams/team-fullstack.yaml +0 -1
  206. package/src/modules/bmm/testarch/knowledge/api-request.md +303 -0
  207. package/src/modules/bmm/testarch/knowledge/auth-session.md +356 -0
  208. package/src/modules/bmm/testarch/knowledge/burn-in.md +273 -0
  209. package/src/modules/bmm/testarch/knowledge/file-utils.md +260 -0
  210. package/src/modules/bmm/testarch/knowledge/fixtures-composition.md +382 -0
  211. package/src/modules/bmm/testarch/knowledge/intercept-network-call.md +280 -0
  212. package/src/modules/bmm/testarch/knowledge/log.md +294 -0
  213. package/src/modules/bmm/testarch/knowledge/network-error-monitor.md +272 -0
  214. package/src/modules/bmm/testarch/knowledge/network-recorder.md +265 -0
  215. package/src/modules/bmm/testarch/knowledge/overview.md +284 -0
  216. package/src/modules/bmm/testarch/knowledge/recurse.md +296 -0
  217. package/src/modules/bmm/testarch/tea-index.csv +11 -0
  218. package/src/modules/bmm/workflows/1-analysis/product-brief/product-brief.template.md +8 -0
  219. package/src/modules/bmm/workflows/1-analysis/product-brief/steps/step-01-init.md +192 -0
  220. package/src/modules/bmm/workflows/1-analysis/product-brief/steps/step-01b-continue.md +167 -0
  221. package/src/modules/bmm/workflows/1-analysis/product-brief/steps/step-02-vision.md +203 -0
  222. package/src/modules/bmm/workflows/1-analysis/product-brief/steps/step-03-users.md +206 -0
  223. package/src/modules/bmm/workflows/1-analysis/product-brief/steps/step-04-metrics.md +209 -0
  224. package/src/modules/bmm/workflows/1-analysis/product-brief/steps/step-05-scope.md +223 -0
  225. package/src/modules/bmm/workflows/1-analysis/product-brief/steps/step-06-complete.md +199 -0
  226. package/src/modules/bmm/workflows/1-analysis/product-brief/workflow.md +58 -0
  227. package/src/modules/bmm/workflows/1-analysis/research/domain-steps/step-01-init.md +136 -0
  228. package/src/modules/bmm/workflows/1-analysis/research/domain-steps/step-02-domain-analysis.md +228 -0
  229. package/src/modules/bmm/workflows/1-analysis/research/domain-steps/step-03-competitive-landscape.md +237 -0
  230. package/src/modules/bmm/workflows/1-analysis/research/domain-steps/step-04-regulatory-focus.md +205 -0
  231. package/src/modules/bmm/workflows/1-analysis/research/domain-steps/step-05-technical-trends.md +233 -0
  232. package/src/modules/bmm/workflows/1-analysis/research/domain-steps/step-06-research-synthesis.md +443 -0
  233. package/src/modules/bmm/workflows/1-analysis/research/market-steps/step-01-init.md +182 -0
  234. package/src/modules/bmm/workflows/1-analysis/research/market-steps/step-02-customer-behavior.md +235 -0
  235. package/src/modules/bmm/workflows/1-analysis/research/market-steps/step-02-customer-insights.md +198 -0
  236. package/src/modules/bmm/workflows/1-analysis/research/market-steps/step-03-customer-pain-points.md +247 -0
  237. package/src/modules/bmm/workflows/1-analysis/research/market-steps/step-04-customer-decisions.md +257 -0
  238. package/src/modules/bmm/workflows/1-analysis/research/market-steps/step-05-competitive-analysis.md +175 -0
  239. package/src/modules/bmm/workflows/1-analysis/research/market-steps/step-06-research-completion.md +475 -0
  240. package/src/modules/bmm/workflows/1-analysis/research/research.template.md +16 -0
  241. package/src/modules/bmm/workflows/1-analysis/research/technical-steps/step-01-init.md +136 -0
  242. package/src/modules/bmm/workflows/1-analysis/research/technical-steps/step-02-technical-overview.md +237 -0
  243. package/src/modules/bmm/workflows/1-analysis/research/technical-steps/step-03-integration-patterns.md +246 -0
  244. package/src/modules/bmm/workflows/1-analysis/research/technical-steps/step-04-architectural-patterns.md +200 -0
  245. package/src/modules/bmm/workflows/1-analysis/research/technical-steps/step-05-implementation-research.md +237 -0
  246. package/src/modules/bmm/workflows/1-analysis/research/technical-steps/step-06-research-synthesis.md +486 -0
  247. package/src/modules/bmm/workflows/1-analysis/research/workflow.md +198 -0
  248. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-01-init.md +159 -0
  249. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-01b-continue.md +126 -0
  250. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-02-discovery.md +209 -0
  251. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-03-core-experience.md +215 -0
  252. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-04-emotional-response.md +218 -0
  253. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-05-inspiration.md +233 -0
  254. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-06-design-system.md +251 -0
  255. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-07-defining-experience.md +253 -0
  256. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-08-visual-foundation.md +223 -0
  257. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-09-design-directions.md +223 -0
  258. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-10-user-journeys.md +240 -0
  259. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-11-component-strategy.md +247 -0
  260. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-12-ux-patterns.md +236 -0
  261. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-13-responsive-accessibility.md +263 -0
  262. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-14-complete.md +226 -0
  263. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/ux-design-template.md +6 -138
  264. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/workflow.md +53 -0
  265. package/src/modules/bmm/workflows/2-plan-workflows/prd/prd-template.md +5 -200
  266. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-01-init.md +161 -0
  267. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-01b-continue.md +123 -0
  268. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-02-discovery.md +275 -0
  269. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-03-success.md +271 -0
  270. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-04-journeys.md +272 -0
  271. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-05-domain.md +249 -0
  272. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-06-innovation.md +240 -0
  273. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-07-project-type.md +236 -0
  274. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-08-scoping.md +280 -0
  275. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-09-functional.md +251 -0
  276. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-10-nonfunctional.md +275 -0
  277. package/src/modules/bmm/workflows/2-plan-workflows/prd/steps/step-11-complete.md +210 -0
  278. package/src/modules/bmm/workflows/2-plan-workflows/prd/workflow.md +61 -0
  279. package/src/modules/bmm/workflows/3-solutioning/architecture/architecture-decision-template.md +13 -0
  280. package/src/modules/bmm/workflows/3-solutioning/architecture/data/domain-complexity.csv +11 -0
  281. package/src/modules/bmm/workflows/3-solutioning/architecture/data/project-types.csv +7 -0
  282. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-01-init.md +194 -0
  283. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-01b-continue.md +163 -0
  284. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-02-context.md +223 -0
  285. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-03-starter.md +330 -0
  286. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-04-decisions.md +317 -0
  287. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-05-patterns.md +358 -0
  288. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-06-structure.md +378 -0
  289. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-07-validation.md +358 -0
  290. package/src/modules/bmm/workflows/3-solutioning/architecture/steps/step-08-complete.md +351 -0
  291. package/src/modules/bmm/workflows/3-solutioning/architecture/workflow.md +48 -0
  292. package/src/modules/bmm/workflows/3-solutioning/create-epics-and-stories/instructions.md +247 -476
  293. package/src/modules/bmm/workflows/3-solutioning/create-epics-and-stories/workflow.yaml +8 -18
  294. package/src/modules/bmm/workflows/4-implementation/code-review/instructions.xml +176 -0
  295. package/src/modules/bmm/workflows/4-implementation/code-review/workflow.yaml +4 -11
  296. package/src/modules/bmm/workflows/4-implementation/create-story/checklist.md +332 -214
  297. package/src/modules/bmm/workflows/4-implementation/create-story/instructions.xml +324 -0
  298. package/src/modules/bmm/workflows/4-implementation/create-story/workflow.yaml +21 -34
  299. package/src/modules/bmm/workflows/4-implementation/dev-story/checklist.md +65 -23
  300. package/src/modules/bmm/workflows/4-implementation/dev-story/instructions.xml +406 -0
  301. package/src/modules/bmm/workflows/4-implementation/dev-story/workflow.yaml +6 -37
  302. package/src/modules/bmm/workflows/4-implementation/sprint-planning/sprint-status-template.yaml +4 -3
  303. package/src/modules/bmm/workflows/4-implementation/sprint-planning/workflow.yaml +2 -0
  304. package/src/modules/bmm/workflows/bmad-quick-flow/create-tech-spec/instructions.md +115 -0
  305. package/src/modules/bmm/workflows/bmad-quick-flow/create-tech-spec/workflow.yaml +26 -0
  306. package/src/modules/bmm/workflows/bmad-quick-flow/quick-dev/checklist.md +25 -0
  307. package/src/modules/bmm/workflows/bmad-quick-flow/quick-dev/instructions.md +105 -0
  308. package/src/modules/bmm/workflows/bmad-quick-flow/quick-dev/workflow.yaml +29 -0
  309. package/src/modules/bmm/workflows/generate-project-context/project-context-template.md +20 -0
  310. package/src/modules/bmm/workflows/generate-project-context/steps/step-01-discover.md +193 -0
  311. package/src/modules/bmm/workflows/generate-project-context/steps/step-02-generate.md +317 -0
  312. package/src/modules/bmm/workflows/generate-project-context/steps/step-03-complete.md +277 -0
  313. package/src/modules/bmm/workflows/generate-project-context/workflow.md +48 -0
  314. package/src/modules/bmm/workflows/testarch/atdd/instructions.md +23 -3
  315. package/src/modules/bmm/workflows/testarch/automate/instructions.md +23 -2
  316. package/src/modules/bmm/workflows/testarch/ci/instructions.md +18 -1
  317. package/src/modules/bmm/workflows/testarch/framework/instructions.md +27 -1
  318. package/src/modules/bmm/workflows/testarch/test-design/instructions.md +8 -2
  319. package/src/modules/bmm/workflows/testarch/test-review/instructions.md +28 -8
  320. package/src/modules/bmm/workflows/workflow-status/init/instructions.md +66 -54
  321. package/src/modules/bmm/workflows/workflow-status/instructions.md +11 -4
  322. package/src/modules/bmm/workflows/workflow-status/paths/enterprise-brownfield.yaml +3 -2
  323. package/src/modules/bmm/workflows/workflow-status/paths/enterprise-greenfield.yaml +3 -2
  324. package/src/modules/bmm/workflows/workflow-status/paths/method-brownfield.yaml +3 -2
  325. package/src/modules/bmm/workflows/workflow-status/paths/method-greenfield.yaml +3 -2
  326. package/src/modules/cis/agents/README.md +1 -1
  327. package/src/modules/cis/agents/brainstorming-coach.agent.yaml +3 -2
  328. package/src/modules/cis/agents/creative-problem-solver.agent.yaml +2 -1
  329. package/src/modules/cis/agents/design-thinking-coach.agent.yaml +2 -1
  330. package/src/modules/cis/agents/innovation-strategist.agent.yaml +2 -1
  331. package/src/modules/cis/agents/presentation-master.agent.yaml +3 -2
  332. package/src/modules/cis/agents/storyteller.agent.yaml +2 -1
  333. package/src/modules/cis/teams/default-party.csv +6 -5
  334. package/src/utility/models/agent-activation-ide.xml +4 -4
  335. package/src/utility/models/agent-activation-web.xml +1 -11
  336. package/src/utility/models/fragments/activation-rules.xml +5 -6
  337. package/src/utility/models/fragments/handler-exec.xml +6 -5
  338. package/src/utility/models/fragments/handler-multi.xml +14 -0
  339. package/test/README.md +1 -1
  340. package/test/fixtures/agent-schema/valid/menu-commands/all-command-types.agent.yaml +1 -3
  341. package/tools/cli/README.md +1 -0
  342. package/tools/cli/bundlers/web-bundler.js +3 -14
  343. package/tools/cli/commands/agent-install.js +8 -8
  344. package/tools/cli/commands/cleanup.js +141 -0
  345. package/tools/cli/commands/install.js +48 -3
  346. package/tools/cli/installers/lib/core/config-collector.js +24 -0
  347. package/tools/cli/installers/lib/core/installer.js +612 -43
  348. package/tools/cli/installers/lib/ide/antigravity.js +51 -7
  349. package/tools/cli/installers/lib/ide/auggie.js +53 -0
  350. package/tools/cli/installers/lib/ide/claude-code.js +1 -6
  351. package/tools/cli/installers/lib/ide/cline.js +49 -0
  352. package/tools/cli/installers/lib/ide/codex.js +2 -2
  353. package/tools/cli/installers/lib/ide/crush.js +47 -0
  354. package/tools/cli/installers/lib/ide/gemini.js +47 -0
  355. package/tools/cli/installers/lib/ide/github-copilot.js +59 -48
  356. package/tools/cli/installers/lib/ide/iflow.js +47 -0
  357. package/tools/cli/installers/lib/ide/kilo.js +74 -0
  358. package/tools/cli/installers/lib/ide/qwen.js +54 -0
  359. package/tools/cli/installers/lib/ide/roo.js +71 -0
  360. package/tools/cli/installers/lib/ide/rovo-dev.js +290 -0
  361. package/tools/cli/installers/lib/ide/trae.js +47 -0
  362. package/tools/cli/lib/agent/compiler.js +156 -22
  363. package/tools/cli/lib/agent/installer.js +13 -3
  364. package/tools/cli/lib/agent-analyzer.js +46 -18
  365. package/tools/cli/lib/ui.js +204 -9
  366. package/tools/cli/lib/yaml-xml-builder.js +123 -24
  367. package/tools/platform-codes.yaml +12 -0
  368. package/tools/schema/agent.js +169 -20
  369. package/src/core/tasks/adv-elicit-methods.csv +0 -39
  370. package/src/core/workflows/brainstorming/README.md +0 -261
  371. package/src/core/workflows/brainstorming/instructions.md +0 -315
  372. package/src/core/workflows/brainstorming/workflow.yaml +0 -38
  373. package/src/core/workflows/party-mode/instructions.md +0 -183
  374. package/src/core/workflows/party-mode/workflow.yaml +0 -28
  375. package/src/modules/bmb/workflows/audit-workflow/checklist.md +0 -142
  376. package/src/modules/bmb/workflows/audit-workflow/instructions.md +0 -341
  377. package/src/modules/bmb/workflows/audit-workflow/template.md +0 -118
  378. package/src/modules/bmb/workflows/audit-workflow/workflow.yaml +0 -25
  379. package/src/modules/bmb/workflows/convert-legacy/README.md +0 -262
  380. package/src/modules/bmb/workflows/convert-legacy/checklist.md +0 -205
  381. package/src/modules/bmb/workflows/convert-legacy/instructions.md +0 -377
  382. package/src/modules/bmb/workflows/convert-legacy/workflow.yaml +0 -30
  383. package/src/modules/bmb/workflows/create-agent/instructions.md +0 -519
  384. package/src/modules/bmb/workflows/create-agent/workflow.yaml +0 -55
  385. package/src/modules/bmb/workflows/create-workflow/README.md +0 -277
  386. package/src/modules/bmb/workflows/create-workflow/brainstorm-context.md +0 -197
  387. package/src/modules/bmb/workflows/create-workflow/checklist.md +0 -94
  388. package/src/modules/bmb/workflows/create-workflow/instructions.md +0 -725
  389. package/src/modules/bmb/workflows/create-workflow/workflow-creation-guide.md +0 -1327
  390. package/src/modules/bmb/workflows/create-workflow/workflow-template/checklist.md +0 -24
  391. package/src/modules/bmb/workflows/create-workflow/workflow-template/instructions.md +0 -15
  392. package/src/modules/bmb/workflows/create-workflow/workflow-template/template.md +0 -9
  393. package/src/modules/bmb/workflows/create-workflow/workflow-template/workflow.yaml +0 -61
  394. package/src/modules/bmb/workflows/create-workflow/workflow.yaml +0 -41
  395. package/src/modules/bmb/workflows/edit-agent/README.md +0 -239
  396. package/src/modules/bmb/workflows/edit-agent/instructions.md +0 -654
  397. package/src/modules/bmb/workflows/edit-agent/workflow.yaml +0 -49
  398. package/src/modules/bmb/workflows/edit-workflow/README.md +0 -119
  399. package/src/modules/bmb/workflows/edit-workflow/checklist.md +0 -70
  400. package/src/modules/bmb/workflows/edit-workflow/instructions.md +0 -342
  401. package/src/modules/bmb/workflows/edit-workflow/workflow.yaml +0 -27
  402. package/src/modules/bmm/_module-installer/assets/bmm-kb.md +0 -1
  403. package/src/modules/bmm/_module-installer/assets/technical-decisions.md +0 -30
  404. package/src/modules/bmm/docs/quick-spec-flow.md +0 -652
  405. package/src/modules/bmm/workflows/1-analysis/brainstorm-project/instructions.md +0 -112
  406. package/src/modules/bmm/workflows/1-analysis/brainstorm-project/project-context.md +0 -25
  407. package/src/modules/bmm/workflows/1-analysis/brainstorm-project/workflow.yaml +0 -39
  408. package/src/modules/bmm/workflows/1-analysis/domain-research/instructions.md +0 -425
  409. package/src/modules/bmm/workflows/1-analysis/domain-research/template.md +0 -180
  410. package/src/modules/bmm/workflows/1-analysis/domain-research/workflow.yaml +0 -56
  411. package/src/modules/bmm/workflows/1-analysis/product-brief/checklist.md +0 -115
  412. package/src/modules/bmm/workflows/1-analysis/product-brief/instructions.md +0 -524
  413. package/src/modules/bmm/workflows/1-analysis/product-brief/template.md +0 -181
  414. package/src/modules/bmm/workflows/1-analysis/product-brief/workflow.yaml +0 -61
  415. package/src/modules/bmm/workflows/1-analysis/research/checklist-deep-prompt.md +0 -144
  416. package/src/modules/bmm/workflows/1-analysis/research/checklist-technical.md +0 -249
  417. package/src/modules/bmm/workflows/1-analysis/research/checklist.md +0 -299
  418. package/src/modules/bmm/workflows/1-analysis/research/claude-code/injections.yaml +0 -114
  419. package/src/modules/bmm/workflows/1-analysis/research/instructions-deep-prompt.md +0 -438
  420. package/src/modules/bmm/workflows/1-analysis/research/instructions-market.md +0 -675
  421. package/src/modules/bmm/workflows/1-analysis/research/instructions-router.md +0 -134
  422. package/src/modules/bmm/workflows/1-analysis/research/instructions-technical.md +0 -534
  423. package/src/modules/bmm/workflows/1-analysis/research/template-deep-prompt.md +0 -94
  424. package/src/modules/bmm/workflows/1-analysis/research/template-market.md +0 -347
  425. package/src/modules/bmm/workflows/1-analysis/research/template-technical.md +0 -245
  426. package/src/modules/bmm/workflows/1-analysis/research/workflow.yaml +0 -62
  427. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/checklist.md +0 -310
  428. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/instructions.md +0 -1308
  429. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/workflow.yaml +0 -93
  430. package/src/modules/bmm/workflows/2-plan-workflows/prd/checklist.md +0 -346
  431. package/src/modules/bmm/workflows/2-plan-workflows/prd/instructions.md +0 -703
  432. package/src/modules/bmm/workflows/2-plan-workflows/prd/workflow.yaml +0 -78
  433. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/checklist.md +0 -217
  434. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/epics-template.md +0 -74
  435. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/instructions-generate-stories.md +0 -436
  436. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/instructions.md +0 -980
  437. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/tech-spec-template.md +0 -181
  438. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/user-story-template.md +0 -90
  439. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/workflow.yaml +0 -60
  440. package/src/modules/bmm/workflows/3-solutioning/architecture/architecture-patterns.yaml +0 -321
  441. package/src/modules/bmm/workflows/3-solutioning/architecture/architecture-template.md +0 -103
  442. package/src/modules/bmm/workflows/3-solutioning/architecture/checklist.md +0 -240
  443. package/src/modules/bmm/workflows/3-solutioning/architecture/decision-catalog.yaml +0 -222
  444. package/src/modules/bmm/workflows/3-solutioning/architecture/instructions.md +0 -768
  445. package/src/modules/bmm/workflows/3-solutioning/architecture/pattern-categories.csv +0 -13
  446. package/src/modules/bmm/workflows/3-solutioning/architecture/workflow.yaml +0 -100
  447. package/src/modules/bmm/workflows/4-implementation/code-review/backlog_template.md +0 -12
  448. package/src/modules/bmm/workflows/4-implementation/code-review/checklist.md +0 -22
  449. package/src/modules/bmm/workflows/4-implementation/code-review/instructions.md +0 -398
  450. package/src/modules/bmm/workflows/4-implementation/create-story/instructions.md +0 -256
  451. package/src/modules/bmm/workflows/4-implementation/dev-story/instructions.md +0 -267
  452. package/src/modules/bmm/workflows/4-implementation/epic-tech-context/checklist.md +0 -17
  453. package/src/modules/bmm/workflows/4-implementation/epic-tech-context/instructions.md +0 -164
  454. package/src/modules/bmm/workflows/4-implementation/epic-tech-context/template.md +0 -76
  455. package/src/modules/bmm/workflows/4-implementation/epic-tech-context/workflow.yaml +0 -58
  456. package/src/modules/bmm/workflows/4-implementation/story-context/checklist.md +0 -16
  457. package/src/modules/bmm/workflows/4-implementation/story-context/context-template.xml +0 -34
  458. package/src/modules/bmm/workflows/4-implementation/story-context/instructions.md +0 -209
  459. package/src/modules/bmm/workflows/4-implementation/story-context/workflow.yaml +0 -63
  460. package/src/modules/bmm/workflows/4-implementation/story-done/instructions.md +0 -111
  461. package/src/modules/bmm/workflows/4-implementation/story-done/workflow.yaml +0 -28
  462. package/src/modules/bmm/workflows/4-implementation/story-ready/instructions.md +0 -117
  463. package/src/modules/bmm/workflows/4-implementation/story-ready/workflow.yaml +0 -25
  464. package/src/modules/bmm/workflows/workflow-status/paths/quick-flow-brownfield.yaml +0 -58
  465. package/src/modules/bmm/workflows/workflow-status/paths/quick-flow-greenfield.yaml +0 -47
  466. /package/src/modules/bmb/docs/{agent-compilation.md → agents/agent-compilation.md} +0 -0
  467. /package/src/modules/bmb/docs/{expert-agent-architecture.md → agents/expert-agent-architecture.md} +0 -0
  468. /package/src/modules/bmb/docs/{index.md → agents/index.md} +0 -0
  469. /package/src/modules/bmb/docs/{understanding-agent-types.md → agents/understanding-agent-types.md} +0 -0
  470. /package/src/modules/bmb/reference/{readme.md → README.md} +0 -0
  471. /package/src/modules/bmb/workflows/create-agent/{agent-validation-checklist.md → data/agent-validation-checklist.md} +0 -0
  472. /package/src/modules/bmb/workflows/create-agent/{brainstorm-context.md → data/brainstorm-context.md} +0 -0
  473. /package/src/modules/bmb/workflows/create-agent/{communication-presets.csv → data/communication-presets.csv} +0 -0
  474. /package/src/modules/bmb/{workflows → workflows-legacy}/create-module/README.md +0 -0
  475. /package/src/modules/bmb/{workflows → workflows-legacy}/create-module/brainstorm-context.md +0 -0
  476. /package/src/modules/bmb/{workflows → workflows-legacy}/create-module/checklist.md +0 -0
  477. /package/src/modules/bmb/{workflows → workflows-legacy}/create-module/installer-templates/install-config.yaml +0 -0
  478. /package/src/modules/bmb/{workflows → workflows-legacy}/create-module/installer-templates/installer.js +0 -0
  479. /package/src/modules/bmb/{workflows → workflows-legacy}/create-module/instructions.md +0 -0
  480. /package/src/modules/bmb/{workflows → workflows-legacy}/create-module/module-structure.md +0 -0
  481. /package/src/modules/bmb/{workflows → workflows-legacy}/create-module/workflow.yaml +0 -0
  482. /package/src/modules/bmb/{workflows → workflows-legacy}/edit-module/README.md +0 -0
  483. /package/src/modules/bmb/{workflows → workflows-legacy}/edit-module/checklist.md +0 -0
  484. /package/src/modules/bmb/{workflows → workflows-legacy}/edit-module/instructions.md +0 -0
  485. /package/src/modules/bmb/{workflows → workflows-legacy}/edit-module/workflow.yaml +0 -0
  486. /package/src/modules/bmb/{workflows → workflows-legacy}/module-brief/README.md +0 -0
  487. /package/src/modules/bmb/{workflows → workflows-legacy}/module-brief/checklist.md +0 -0
  488. /package/src/modules/bmb/{workflows → workflows-legacy}/module-brief/instructions.md +0 -0
  489. /package/src/modules/bmb/{workflows → workflows-legacy}/module-brief/template.md +0 -0
  490. /package/src/modules/bmb/{workflows → workflows-legacy}/module-brief/workflow.yaml +0 -0
  491. /package/src/modules/bmm/{workflows/techdoc → data}/documentation-standards.md +0 -0
@@ -1,3 +1,23 @@
1
+ /**
2
+ * File: tools/cli/installers/lib/core/installer.js
3
+ *
4
+ * BMAD Method - Business Model Agile Development Method
5
+ * Repository: https://github.com/paulpreibisch/BMAD-METHOD
6
+ *
7
+ * Copyright (c) 2025 Paul Preibisch
8
+ * Licensed under the Apache License, Version 2.0
9
+ *
10
+ * ---
11
+ *
12
+ * @fileoverview Core BMAD installation orchestrator with AgentVibes injection point support
13
+ * @context Manages complete BMAD installation flow including core agents, modules, IDE configs, and optional TTS integration
14
+ * @architecture Orchestrator pattern - coordinates Detector, ModuleManager, IdeManager, and file operations to build complete BMAD installation
15
+ * @dependencies fs-extra, ora, chalk, detector.js, module-manager.js, ide-manager.js, config.js
16
+ * @entrypoints Called by install.js command via installer.install(config)
17
+ * @patterns Injection point processing (AgentVibes), placeholder replacement ({bmad_folder}), module dependency resolution
18
+ * @related GitHub AgentVibes#34 (injection points), ui.js (user prompts), copyFileWithPlaceholderReplacement()
19
+ */
20
+
1
21
  const path = require('node:path');
2
22
  const fs = require('fs-extra');
3
23
  const chalk = require('chalk');
@@ -69,10 +89,41 @@ class Installer {
69
89
  }
70
90
 
71
91
  /**
72
- * Copy a file and replace {bmad_folder} placeholder with actual folder name
73
- * @param {string} sourcePath - Source file path
74
- * @param {string} targetPath - Target file path
75
- * @param {string} bmadFolderName - The bmad folder name to use for replacement
92
+ * @function copyFileWithPlaceholderReplacement
93
+ * @intent Copy files from BMAD source to installation directory with dynamic content transformation
94
+ * @why Enables installation-time customization: {bmad_folder} replacement + optional AgentVibes TTS injection
95
+ * @param {string} sourcePath - Absolute path to source file in BMAD repository
96
+ * @param {string} targetPath - Absolute path to destination file in user's project
97
+ * @param {string} bmadFolderName - User's chosen bmad folder name (default: 'bmad')
98
+ * @returns {Promise<void>} Resolves when file copy and transformation complete
99
+ * @sideeffects Writes transformed file to targetPath, creates parent directories if needed
100
+ * @edgecases Binary files bypass transformation, falls back to raw copy if UTF-8 read fails
101
+ * @calledby installCore(), installModule(), IDE installers during file vendoring
102
+ * @calls processTTSInjectionPoints(), fs.readFile(), fs.writeFile(), fs.copy()
103
+ *
104
+ * AI NOTE: This is the core transformation pipeline for ALL BMAD installation file copies.
105
+ * It performs two transformations in sequence:
106
+ * 1. {bmad_folder} → user's custom folder name (e.g., ".bmad" or "bmad")
107
+ * 2. <!-- TTS_INJECTION:* --> → TTS bash calls (if enabled) OR stripped (if disabled)
108
+ *
109
+ * The injection point processing enables loose coupling between BMAD and TTS providers:
110
+ * - BMAD source contains injection markers (not actual TTS code)
111
+ * - At install-time, markers are replaced OR removed based on user preference
112
+ * - Result: Clean installs for users without TTS, working TTS for users with it
113
+ *
114
+ * PATTERN: Adding New Injection Points
115
+ * =====================================
116
+ * 1. Add HTML comment marker in BMAD source file:
117
+ * <!-- TTS_INJECTION:feature-name -->
118
+ *
119
+ * 2. Add replacement logic in processTTSInjectionPoints():
120
+ * if (enableAgentVibes) {
121
+ * content = content.replace(/<!-- TTS_INJECTION:feature-name -->/g, 'actual code');
122
+ * } else {
123
+ * content = content.replace(/<!-- TTS_INJECTION:feature-name -->\n?/g, '');
124
+ * }
125
+ *
126
+ * 3. Document marker in instructions.md (if applicable)
76
127
  */
77
128
  async copyFileWithPlaceholderReplacement(sourcePath, targetPath, bmadFolderName) {
78
129
  // List of text file extensions that should have placeholder replacement
@@ -90,6 +141,9 @@ class Installer {
90
141
  content = content.replaceAll('{bmad_folder}', bmadFolderName);
91
142
  }
92
143
 
144
+ // Process AgentVibes injection points
145
+ content = this.processTTSInjectionPoints(content);
146
+
93
147
  // Write to target with replaced content
94
148
  await fs.ensureDir(path.dirname(targetPath));
95
149
  await fs.writeFile(targetPath, content, 'utf8');
@@ -103,6 +157,106 @@ class Installer {
103
157
  }
104
158
  }
105
159
 
160
+ /**
161
+ * @function processTTSInjectionPoints
162
+ * @intent Transform TTS injection markers based on user's installation choice
163
+ * @why Enables optional TTS integration without tight coupling between BMAD and TTS providers
164
+ * @param {string} content - Raw file content containing potential injection markers
165
+ * @returns {string} Transformed content with markers replaced (if enabled) or stripped (if disabled)
166
+ * @sideeffects None - pure transformation function
167
+ * @edgecases Returns content unchanged if no markers present, safe to call on all files
168
+ * @calledby copyFileWithPlaceholderReplacement() during every file copy operation
169
+ * @calls String.replace() with regex patterns for each injection point type
170
+ *
171
+ * AI NOTE: This implements the injection point pattern for TTS integration.
172
+ * Key architectural decisions:
173
+ *
174
+ * 1. **Why Injection Points vs Direct Integration?**
175
+ * - BMAD and TTS providers are separate projects with different maintainers
176
+ * - Users may install BMAD without TTS support (and vice versa)
177
+ * - Hard-coding TTS calls would break BMAD for non-TTS users
178
+ * - Injection points allow conditional feature inclusion at install-time
179
+ *
180
+ * 2. **How It Works:**
181
+ * - BMAD source contains markers: <!-- TTS_INJECTION:feature-name -->
182
+ * - During installation, user is prompted: "Enable AgentVibes TTS?"
183
+ * - If YES: markers → replaced with actual bash TTS calls
184
+ * - If NO: markers → stripped cleanly from installed files
185
+ *
186
+ * 3. **State Management:**
187
+ * - this.enableAgentVibes set in install() method from config.enableAgentVibes
188
+ * - config.enableAgentVibes comes from ui.promptAgentVibes() user choice
189
+ * - Flag persists for entire installation, all files get same treatment
190
+ *
191
+ * CURRENT INJECTION POINTS:
192
+ * ==========================
193
+ * - party-mode: Injects TTS calls after each agent speaks in party mode
194
+ * Location: src/core/workflows/party-mode/instructions.md
195
+ * Marker: <!-- TTS_INJECTION:party-mode -->
196
+ * Replacement: Bash call to .claude/hooks/bmad-speak.sh with agent name and dialogue
197
+ *
198
+ * - agent-tts: Injects TTS rule for individual agent conversations
199
+ * Location: src/modules/bmm/agents/*.md (all agent files)
200
+ * Marker: <!-- TTS_INJECTION:agent-tts -->
201
+ * Replacement: Rule instructing agent to call bmad-speak.sh with agent ID and response
202
+ *
203
+ * ADDING NEW INJECTION POINTS:
204
+ * =============================
205
+ * 1. Add new case in this function:
206
+ * content = content.replace(
207
+ * /<!-- TTS_INJECTION:new-feature -->/g,
208
+ * `code to inject when enabled`
209
+ * );
210
+ *
211
+ * 2. Add marker to BMAD source file at injection location
212
+ *
213
+ * 3. Test both enabled and disabled flows
214
+ *
215
+ * RELATED:
216
+ * ========
217
+ * - GitHub Issue: paulpreibisch/AgentVibes#36
218
+ * - User Prompt: tools/cli/lib/ui.js::promptAgentVibes()
219
+ * - Marker Locations:
220
+ * - src/core/workflows/party-mode/instructions.md:101
221
+ * - src/modules/bmm/agents/*.md (rules sections)
222
+ * - TTS Hook: .claude/hooks/bmad-speak.sh (in AgentVibes repo)
223
+ */
224
+ processTTSInjectionPoints(content) {
225
+ // Check if AgentVibes is enabled (set during installation configuration)
226
+ const enableAgentVibes = this.enableAgentVibes || false;
227
+
228
+ if (enableAgentVibes) {
229
+ // Replace party-mode injection marker with actual TTS call
230
+ // Use single quotes to prevent shell expansion of special chars like !
231
+ content = content.replaceAll(
232
+ '<!-- TTS_INJECTION:party-mode -->',
233
+ `<critical>IMPORTANT: Always use PROJECT hooks (.claude/hooks/), NEVER global hooks (~/.claude/hooks/)</critical>
234
+
235
+ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
236
+ - Use Bash tool: \`.claude/hooks/bmad-speak.sh '[Agent Name]' '[dialogue]'\`
237
+ - This speaks the dialogue with the agent's unique voice
238
+ - Run in background (&) to not block next agent`,
239
+ );
240
+
241
+ // Replace agent-tts injection marker with TTS rule for individual agents
242
+ content = content.replaceAll(
243
+ '<!-- TTS_INJECTION:agent-tts -->',
244
+ `- When responding to user messages, speak your responses using TTS:
245
+ Call: \`.claude/hooks/bmad-speak.sh '{agent-id}' '{response-text}'\` after each response
246
+ Replace {agent-id} with YOUR agent ID from <agent id="..."> tag at top of this file
247
+ Replace {response-text} with the text you just output to the user
248
+ IMPORTANT: Use single quotes as shown - do NOT escape special characters like ! or $ inside single quotes
249
+ Run in background (&) to avoid blocking`,
250
+ );
251
+ } else {
252
+ // Strip injection markers cleanly when AgentVibes is disabled
253
+ content = content.replaceAll(/<!-- TTS_INJECTION:party-mode -->\n?/g, '');
254
+ content = content.replaceAll(/<!-- TTS_INJECTION:agent-tts -->\n?/g, '');
255
+ }
256
+
257
+ return content;
258
+ }
259
+
106
260
  /**
107
261
  * Collect Tool/IDE configurations after module configuration
108
262
  * @param {string} projectDir - Project directory
@@ -166,7 +320,9 @@ class Installer {
166
320
 
167
321
  for (const ide of newlySelectedIdes) {
168
322
  // List of IDEs that have interactive prompts
169
- const needsPrompts = ['claude-code', 'github-copilot', 'roo', 'cline', 'auggie', 'codex', 'qwen', 'gemini'].includes(ide);
323
+ const needsPrompts = ['claude-code', 'github-copilot', 'roo', 'cline', 'auggie', 'codex', 'qwen', 'gemini', 'rovo-dev'].includes(
324
+ ide,
325
+ );
170
326
 
171
327
  if (needsPrompts) {
172
328
  // Get IDE handler and collect configuration
@@ -269,6 +425,9 @@ class Installer {
269
425
  const bmadFolderName = moduleConfigs.core && moduleConfigs.core.bmad_folder ? moduleConfigs.core.bmad_folder : 'bmad';
270
426
  this.bmadFolderName = bmadFolderName; // Store for use in other methods
271
427
 
428
+ // Store AgentVibes configuration for injection point processing
429
+ this.enableAgentVibes = config.enableAgentVibes || false;
430
+
272
431
  // Set bmad folder name on module manager and IDE manager for placeholder replacement
273
432
  this.moduleManager.setBmadFolderName(bmadFolderName);
274
433
  this.ideManager.setBmadFolderName(bmadFolderName);
@@ -859,7 +1018,31 @@ class Installer {
859
1018
  customFiles: customFiles.length > 0 ? customFiles : undefined,
860
1019
  });
861
1020
 
862
- return { success: true, path: bmadDir, modules: config.modules, ides: config.ides };
1021
+ // Offer cleanup for legacy files (only for updates, not fresh installs, and only if not skipped)
1022
+ if (!config.skipCleanup && config._isUpdate) {
1023
+ try {
1024
+ const cleanupResult = await this.performCleanup(bmadDir, false);
1025
+ if (cleanupResult.deleted > 0) {
1026
+ console.log(chalk.green(`\n✓ Cleaned up ${cleanupResult.deleted} legacy file${cleanupResult.deleted > 1 ? 's' : ''}`));
1027
+ }
1028
+ if (cleanupResult.retained > 0) {
1029
+ console.log(chalk.dim(`Run 'bmad cleanup' anytime to manage retained files`));
1030
+ }
1031
+ } catch (cleanupError) {
1032
+ // Don't fail the installation for cleanup errors
1033
+ console.log(chalk.yellow(`\n⚠️ Cleanup warning: ${cleanupError.message}`));
1034
+ console.log(chalk.dim('Run "bmad cleanup" to manually clean up legacy files'));
1035
+ }
1036
+ }
1037
+
1038
+ return {
1039
+ success: true,
1040
+ path: bmadDir,
1041
+ modules: config.modules,
1042
+ ides: config.ides,
1043
+ needsAgentVibes: this.enableAgentVibes && !config.agentVibesInstalled,
1044
+ projectDir: projectDir,
1045
+ };
863
1046
  } catch (error) {
864
1047
  spinner.fail('Installation failed');
865
1048
  throw error;
@@ -1619,14 +1802,19 @@ class Installer {
1619
1802
  }
1620
1803
  }
1621
1804
 
1622
- // Regenerate manifests after compilation
1623
- spinner.start('Regenerating manifests...');
1624
- const installedModules = entries
1625
- .filter((e) => e.isDirectory() && e.name !== '_cfg' && e.name !== 'docs' && e.name !== 'agents' && e.name !== 'core')
1626
- .map((e) => e.name);
1627
- const manifestGen = new ManifestGenerator();
1805
+ // Reinstall custom agents from _cfg/custom/agents/ sources
1806
+ spinner.start('Rebuilding custom agents...');
1807
+ const customAgentResults = await this.reinstallCustomAgents(projectDir, bmadDir);
1808
+ if (customAgentResults.count > 0) {
1809
+ spinner.succeed(`Rebuilt ${customAgentResults.count} custom agent${customAgentResults.count > 1 ? 's' : ''}`);
1810
+ agentCount += customAgentResults.count;
1811
+ } else {
1812
+ spinner.succeed('No custom agents found to rebuild');
1813
+ }
1628
1814
 
1629
- // Get existing IDE list from manifest
1815
+ // Skip full manifest regeneration during compileAgents to preserve custom agents
1816
+ // Custom agents are already added to manifests during individual installation
1817
+ // Only regenerate YAML manifest for IDE updates if needed
1630
1818
  const existingManifestPath = path.join(bmadDir, '_cfg', 'manifest.yaml');
1631
1819
  let existingIdes = [];
1632
1820
  if (await fs.pathExists(existingManifestPath)) {
@@ -1636,11 +1824,6 @@ class Installer {
1636
1824
  existingIdes = manifest.ides || [];
1637
1825
  }
1638
1826
 
1639
- await manifestGen.generateManifests(bmadDir, installedModules, [], {
1640
- ides: existingIdes,
1641
- });
1642
- spinner.succeed('Manifests regenerated');
1643
-
1644
1827
  // Update IDE configurations using the existing IDE list from manifest
1645
1828
  if (existingIdes && existingIdes.length > 0) {
1646
1829
  spinner.start('Updating IDE configurations...');
@@ -1773,7 +1956,7 @@ class Installer {
1773
1956
 
1774
1957
  if (existingBmadFolderName === newBmadFolderName) {
1775
1958
  // Normal quick update - start the spinner
1776
- spinner.start('Updating BMAD installation...');
1959
+ console.log(chalk.cyan('Updating BMAD installation...'));
1777
1960
  } else {
1778
1961
  // Folder name has changed - stop spinner and let install() handle it
1779
1962
  spinner.stop();
@@ -2255,45 +2438,58 @@ class Installer {
2255
2438
  }
2256
2439
 
2257
2440
  /**
2258
- * Reinstall custom agents from _cfg/custom/agents/ sources
2441
+ * Reinstall custom agents from backup and source locations
2259
2442
  * This preserves custom agents across quick updates/reinstalls
2260
2443
  * @param {string} projectDir - Project directory
2261
2444
  * @param {string} bmadDir - BMAD installation directory
2262
2445
  * @returns {Object} Result with count and agent names
2263
2446
  */
2264
2447
  async reinstallCustomAgents(projectDir, bmadDir) {
2265
- const customAgentsCfgDir = path.join(bmadDir, '_cfg', 'custom', 'agents');
2448
+ const {
2449
+ discoverAgents,
2450
+ loadAgentConfig,
2451
+ extractManifestData,
2452
+ addToManifest,
2453
+ createIdeSlashCommands,
2454
+ updateManifestYaml,
2455
+ } = require('../../../lib/agent/installer');
2456
+ const { compileAgent } = require('../../../lib/agent/compiler');
2457
+
2266
2458
  const results = { count: 0, agents: [] };
2267
2459
 
2268
- if (!(await fs.pathExists(customAgentsCfgDir))) {
2460
+ // Check multiple locations for custom agents
2461
+ const sourceLocations = [
2462
+ path.join(bmadDir, '_cfg', 'custom', 'agents'), // Backup location
2463
+ path.join(bmadDir, 'custom', 'src', 'agents'), // BMAD folder source location
2464
+ path.join(projectDir, 'custom', 'src', 'agents'), // Project root source location
2465
+ ];
2466
+
2467
+ let foundAgents = [];
2468
+ let processedAgents = new Set(); // Track to avoid duplicates
2469
+
2470
+ // Discover agents from all locations
2471
+ for (const location of sourceLocations) {
2472
+ if (await fs.pathExists(location)) {
2473
+ const agents = discoverAgents(location);
2474
+ // Only add agents we haven't processed yet
2475
+ const newAgents = agents.filter((agent) => !processedAgents.has(agent.name));
2476
+ foundAgents.push(...newAgents);
2477
+ for (const agent of newAgents) processedAgents.add(agent.name);
2478
+ }
2479
+ }
2480
+
2481
+ if (foundAgents.length === 0) {
2269
2482
  return results;
2270
2483
  }
2271
2484
 
2272
2485
  try {
2273
- const {
2274
- discoverAgents,
2275
- loadAgentConfig,
2276
- extractManifestData,
2277
- addToManifest,
2278
- createIdeSlashCommands,
2279
- updateManifestYaml,
2280
- } = require('../../../lib/agent/installer');
2281
- const { compileAgent } = require('../../../lib/agent/compiler');
2282
-
2283
- // Discover custom agents in _cfg/custom/agents/
2284
- const agents = discoverAgents(customAgentsCfgDir);
2285
-
2286
- if (agents.length === 0) {
2287
- return results;
2288
- }
2289
-
2290
2486
  const customAgentsDir = path.join(bmadDir, 'custom', 'agents');
2291
2487
  await fs.ensureDir(customAgentsDir);
2292
2488
 
2293
2489
  const manifestFile = path.join(bmadDir, '_cfg', 'agent-manifest.csv');
2294
2490
  const manifestYamlFile = path.join(bmadDir, '_cfg', 'manifest.yaml');
2295
2491
 
2296
- for (const agent of agents) {
2492
+ for (const agent of foundAgents) {
2297
2493
  try {
2298
2494
  const agentConfig = loadAgentConfig(agent.yamlFile);
2299
2495
  const finalAgentName = agent.name; // Already named correctly from save
@@ -2328,6 +2524,16 @@ class Installer {
2328
2524
  // Write compiled agent
2329
2525
  await fs.writeFile(compiledPath, xml, 'utf8');
2330
2526
 
2527
+ // Backup source YAML to _cfg/custom/agents if not already there
2528
+ const cfgAgentsBackupDir = path.join(bmadDir, '_cfg', 'custom', 'agents');
2529
+ await fs.ensureDir(cfgAgentsBackupDir);
2530
+ const backupYamlPath = path.join(cfgAgentsBackupDir, `${finalAgentName}.agent.yaml`);
2531
+
2532
+ // Only backup if source is not already in backup location
2533
+ if (agent.yamlFile !== backupYamlPath) {
2534
+ await fs.copy(agent.yamlFile, backupYamlPath);
2535
+ }
2536
+
2331
2537
  // Copy sidecar files if expert agent
2332
2538
  if (agent.hasSidecar && agent.type === 'expert') {
2333
2539
  const { copySidecarFiles } = require('../../../lib/agent/installer');
@@ -2336,9 +2542,16 @@ class Installer {
2336
2542
 
2337
2543
  // Update manifest CSV
2338
2544
  if (await fs.pathExists(manifestFile)) {
2339
- const manifestData = extractManifestData(xml, { ...metadata, name: finalAgentName }, relativePath, 'custom');
2340
- manifestData.name = finalAgentName;
2341
- manifestData.displayName = metadata.name || finalAgentName;
2545
+ // Preserve YAML metadata for persona name, but override id for filename
2546
+ const manifestMetadata = {
2547
+ ...metadata,
2548
+ id: relativePath, // Use the compiled agent path for id
2549
+ name: metadata.name || finalAgentName, // Use YAML metadata.name (persona name) or fallback
2550
+ title: metadata.title, // Use YAML title
2551
+ icon: metadata.icon, // Use YAML icon
2552
+ };
2553
+ const manifestData = extractManifestData(xml, manifestMetadata, relativePath, 'custom');
2554
+ manifestData.name = finalAgentName; // Use filename for the name field
2342
2555
  manifestData.path = relativePath;
2343
2556
  addToManifest(manifestFile, manifestData);
2344
2557
  }
@@ -2382,6 +2595,362 @@ class Installer {
2382
2595
  }
2383
2596
  }
2384
2597
  }
2598
+
2599
+ /**
2600
+ * Scan for legacy/obsolete files in BMAD installation
2601
+ * @param {string} bmadDir - BMAD installation directory
2602
+ * @returns {Object} Categorized files for cleanup
2603
+ */
2604
+ async scanForLegacyFiles(bmadDir) {
2605
+ const legacyFiles = {
2606
+ backup: [],
2607
+ documentation: [],
2608
+ deprecated_task: [],
2609
+ unknown: [],
2610
+ };
2611
+
2612
+ try {
2613
+ // Load files manifest to understand what should exist
2614
+ const manifestPath = path.join(bmadDir, 'files-manifest.csv');
2615
+ const manifestFiles = new Set();
2616
+
2617
+ if (await fs.pathExists(manifestPath)) {
2618
+ const manifestContent = await fs.readFile(manifestPath, 'utf8');
2619
+ const lines = manifestContent.split('\n').slice(1); // Skip header
2620
+ for (const line of lines) {
2621
+ if (line.trim()) {
2622
+ const relativePath = line.split(',')[0];
2623
+ if (relativePath) {
2624
+ manifestFiles.add(relativePath);
2625
+ }
2626
+ }
2627
+ }
2628
+ }
2629
+
2630
+ // Scan all files recursively
2631
+ const allFiles = await this.getAllFiles(bmadDir);
2632
+
2633
+ for (const filePath of allFiles) {
2634
+ const relativePath = path.relative(bmadDir, filePath);
2635
+
2636
+ // Skip expected files
2637
+ if (this.isExpectedFile(relativePath, manifestFiles)) {
2638
+ continue;
2639
+ }
2640
+
2641
+ // Categorize legacy files
2642
+ if (relativePath.endsWith('.bak')) {
2643
+ legacyFiles.backup.push({
2644
+ path: filePath,
2645
+ relativePath: relativePath,
2646
+ size: (await fs.stat(filePath)).size,
2647
+ mtime: (await fs.stat(filePath)).mtime,
2648
+ });
2649
+ } else if (this.isDocumentationFile(relativePath)) {
2650
+ legacyFiles.documentation.push({
2651
+ path: filePath,
2652
+ relativePath: relativePath,
2653
+ size: (await fs.stat(filePath)).size,
2654
+ mtime: (await fs.stat(filePath)).mtime,
2655
+ });
2656
+ } else if (this.isDeprecatedTaskFile(relativePath)) {
2657
+ const suggestedAlternative = this.suggestAlternative(relativePath);
2658
+ legacyFiles.deprecated_task.push({
2659
+ path: filePath,
2660
+ relativePath: relativePath,
2661
+ size: (await fs.stat(filePath)).size,
2662
+ mtime: (await fs.stat(filePath)).mtime,
2663
+ suggestedAlternative,
2664
+ });
2665
+ } else {
2666
+ legacyFiles.unknown.push({
2667
+ path: filePath,
2668
+ relativePath: relativePath,
2669
+ size: (await fs.stat(filePath)).size,
2670
+ mtime: (await fs.stat(filePath)).mtime,
2671
+ });
2672
+ }
2673
+ }
2674
+ } catch (error) {
2675
+ console.warn(`Warning: Could not scan for legacy files: ${error.message}`);
2676
+ }
2677
+
2678
+ return legacyFiles;
2679
+ }
2680
+
2681
+ /**
2682
+ * Get all files in directory recursively
2683
+ * @param {string} dir - Directory to scan
2684
+ * @returns {Array} Array of file paths
2685
+ */
2686
+ async getAllFiles(dir) {
2687
+ const files = [];
2688
+
2689
+ async function scan(currentDir) {
2690
+ const entries = await fs.readdir(currentDir);
2691
+
2692
+ for (const entry of entries) {
2693
+ const fullPath = path.join(currentDir, entry);
2694
+ const stat = await fs.stat(fullPath);
2695
+
2696
+ if (stat.isDirectory()) {
2697
+ // Skip certain directories
2698
+ if (!['node_modules', '.git', 'dist', 'build'].includes(entry)) {
2699
+ await scan(fullPath);
2700
+ }
2701
+ } else {
2702
+ files.push(fullPath);
2703
+ }
2704
+ }
2705
+ }
2706
+
2707
+ await scan(dir);
2708
+ return files;
2709
+ }
2710
+
2711
+ /**
2712
+ * Check if file is expected in installation
2713
+ * @param {string} relativePath - Relative path from BMAD dir
2714
+ * @param {Set} manifestFiles - Files from manifest
2715
+ * @returns {boolean} True if expected file
2716
+ */
2717
+ isExpectedFile(relativePath, manifestFiles) {
2718
+ // Core files in manifest
2719
+ if (manifestFiles.has(relativePath)) {
2720
+ return true;
2721
+ }
2722
+
2723
+ // Configuration files
2724
+ if (relativePath.startsWith('_cfg/') || relativePath === 'config.yaml') {
2725
+ return true;
2726
+ }
2727
+
2728
+ // Custom files
2729
+ if (relativePath.startsWith('custom/') || relativePath === 'manifest.yaml') {
2730
+ return true;
2731
+ }
2732
+
2733
+ // Generated files
2734
+ if (relativePath === 'manifest.csv' || relativePath === 'files-manifest.csv') {
2735
+ return true;
2736
+ }
2737
+
2738
+ // IDE-specific files
2739
+ const ides = ['vscode', 'cursor', 'windsurf', 'claude-code', 'github-copilot', 'zsh', 'bash', 'fish'];
2740
+ if (ides.some((ide) => relativePath.includes(ide))) {
2741
+ return true;
2742
+ }
2743
+
2744
+ // BMAD MODULE STRUCTURES - recognize valid module content
2745
+ const modulePrefixes = ['bmb/', 'bmm/', 'cis/', 'core/', 'bmgd/'];
2746
+ const validExtensions = ['.yaml', '.yml', '.json', '.csv', '.md', '.xml', '.svg', '.png', '.jpg', '.gif', '.excalidraw', '.js'];
2747
+
2748
+ // Check if this file is in a recognized module directory
2749
+ for (const modulePrefix of modulePrefixes) {
2750
+ if (relativePath.startsWith(modulePrefix)) {
2751
+ // Check if it has a valid extension
2752
+ const hasValidExtension = validExtensions.some((ext) => relativePath.endsWith(ext));
2753
+ if (hasValidExtension) {
2754
+ return true;
2755
+ }
2756
+ }
2757
+ }
2758
+
2759
+ // Special case for core module resources
2760
+ if (relativePath.startsWith('core/resources/')) {
2761
+ return true;
2762
+ }
2763
+
2764
+ // Special case for docs directory
2765
+ if (relativePath.startsWith('docs/')) {
2766
+ return true;
2767
+ }
2768
+
2769
+ return false;
2770
+ }
2771
+
2772
+ /**
2773
+ * Check if file is documentation
2774
+ * @param {string} relativePath - Relative path
2775
+ * @returns {boolean} True if documentation
2776
+ */
2777
+ isDocumentationFile(relativePath) {
2778
+ const docExtensions = ['.md', '.txt', '.pdf'];
2779
+ const docPatterns = ['docs/', 'README', 'CHANGELOG', 'LICENSE'];
2780
+
2781
+ return docExtensions.some((ext) => relativePath.endsWith(ext)) || docPatterns.some((pattern) => relativePath.includes(pattern));
2782
+ }
2783
+
2784
+ /**
2785
+ * Check if file is deprecated task file
2786
+ * @param {string} relativePath - Relative path
2787
+ * @returns {boolean} True if deprecated
2788
+ */
2789
+ isDeprecatedTaskFile(relativePath) {
2790
+ // Known deprecated files
2791
+ const deprecatedFiles = ['adv-elicit-methods.csv', 'game-resources.json', 'ux-workflow.json'];
2792
+
2793
+ return deprecatedFiles.some((dep) => relativePath.includes(dep));
2794
+ }
2795
+
2796
+ /**
2797
+ * Suggest alternative for deprecated file
2798
+ * @param {string} relativePath - Deprecated file path
2799
+ * @returns {string} Suggested alternative
2800
+ */
2801
+ suggestAlternative(relativePath) {
2802
+ const alternatives = {
2803
+ 'adv-elicit-methods.csv': 'Use the new structured workflows in src/modules/',
2804
+ 'game-resources.json': 'Resources are now integrated into modules',
2805
+ 'ux-workflow.json': 'UX workflows are now in src/modules/bmm/workflows/',
2806
+ };
2807
+
2808
+ for (const [deprecated, alternative] of Object.entries(alternatives)) {
2809
+ if (relativePath.includes(deprecated)) {
2810
+ return alternative;
2811
+ }
2812
+ }
2813
+
2814
+ return 'Check src/modules/ for new alternatives';
2815
+ }
2816
+
2817
+ /**
2818
+ * Perform interactive cleanup of legacy files
2819
+ * @param {string} bmadDir - BMAD installation directory
2820
+ * @param {boolean} skipInteractive - Skip interactive prompts
2821
+ * @returns {Object} Cleanup results
2822
+ */
2823
+ async performCleanup(bmadDir, skipInteractive = false) {
2824
+ const inquirer = require('inquirer');
2825
+ const yaml = require('js-yaml');
2826
+
2827
+ // Load user retention preferences
2828
+ const retentionPath = path.join(bmadDir, '_cfg', 'user-retained-files.yaml');
2829
+ let retentionData = { retainedFiles: [], history: [] };
2830
+
2831
+ if (await fs.pathExists(retentionPath)) {
2832
+ const retentionContent = await fs.readFile(retentionPath, 'utf8');
2833
+ retentionData = yaml.load(retentionContent) || retentionData;
2834
+ }
2835
+
2836
+ // Scan for legacy files
2837
+ const legacyFiles = await this.scanForLegacyFiles(bmadDir);
2838
+ const allLegacyFiles = [...legacyFiles.backup, ...legacyFiles.documentation, ...legacyFiles.deprecated_task, ...legacyFiles.unknown];
2839
+
2840
+ if (allLegacyFiles.length === 0) {
2841
+ return { deleted: 0, retained: 0, message: 'No legacy files found' };
2842
+ }
2843
+
2844
+ let deletedCount = 0;
2845
+ let retainedCount = 0;
2846
+ const filesToDelete = [];
2847
+
2848
+ if (skipInteractive) {
2849
+ // Auto-delete all non-retained files
2850
+ for (const file of allLegacyFiles) {
2851
+ if (!retentionData.retainedFiles.includes(file.relativePath)) {
2852
+ filesToDelete.push(file);
2853
+ }
2854
+ }
2855
+ } else {
2856
+ // Interactive cleanup
2857
+ console.log(chalk.cyan('\n🧹 Legacy File Cleanup\n'));
2858
+ console.log(chalk.dim('The following obsolete files were found:\n'));
2859
+
2860
+ // Group files by category
2861
+ const categories = [];
2862
+ if (legacyFiles.backup.length > 0) {
2863
+ categories.push({ name: 'Backup Files (.bak)', files: legacyFiles.backup });
2864
+ }
2865
+ if (legacyFiles.documentation.length > 0) {
2866
+ categories.push({ name: 'Documentation', files: legacyFiles.documentation });
2867
+ }
2868
+ if (legacyFiles.deprecated_task.length > 0) {
2869
+ categories.push({ name: 'Deprecated Task Files', files: legacyFiles.deprecated_task });
2870
+ }
2871
+ if (legacyFiles.unknown.length > 0) {
2872
+ categories.push({ name: 'Unknown Files', files: legacyFiles.unknown });
2873
+ }
2874
+
2875
+ for (const category of categories) {
2876
+ console.log(chalk.yellow(`${category.name}:`));
2877
+ for (const file of category.files) {
2878
+ const size = (file.size / 1024).toFixed(1);
2879
+ const date = file.mtime.toLocaleDateString();
2880
+ let line = ` - ${file.relativePath} (${size}KB, ${date})`;
2881
+ if (file.suggestedAlternative) {
2882
+ line += chalk.dim(` → ${file.suggestedAlternative}`);
2883
+ }
2884
+ console.log(chalk.dim(line));
2885
+ }
2886
+ console.log();
2887
+ }
2888
+
2889
+ const prompt = await inquirer.prompt([
2890
+ {
2891
+ type: 'confirm',
2892
+ name: 'proceed',
2893
+ message: 'Would you like to review these files for cleanup?',
2894
+ default: true,
2895
+ },
2896
+ ]);
2897
+
2898
+ if (!prompt.proceed) {
2899
+ return { deleted: 0, retained: allLegacyFiles.length, message: 'Cleanup cancelled by user' };
2900
+ }
2901
+
2902
+ // Show selection interface
2903
+ const selectionPrompt = await inquirer.prompt([
2904
+ {
2905
+ type: 'checkbox',
2906
+ name: 'filesToDelete',
2907
+ message: 'Select files to delete (use SPACEBAR to select, ENTER to continue):',
2908
+ choices: allLegacyFiles.map((file) => {
2909
+ const isRetained = retentionData.retainedFiles.includes(file.relativePath);
2910
+ const description = `${file.relativePath} (${(file.size / 1024).toFixed(1)}KB)`;
2911
+ return {
2912
+ name: description,
2913
+ value: file,
2914
+ checked: !isRetained && !file.relativePath.includes('.bak'),
2915
+ };
2916
+ }),
2917
+ pageSize: Math.min(allLegacyFiles.length, 15),
2918
+ },
2919
+ ]);
2920
+
2921
+ filesToDelete.push(...selectionPrompt.filesToDelete);
2922
+ }
2923
+
2924
+ // Delete selected files
2925
+ for (const file of filesToDelete) {
2926
+ try {
2927
+ await fs.remove(file.path);
2928
+ deletedCount++;
2929
+ } catch (error) {
2930
+ console.warn(`Warning: Could not delete ${file.relativePath}: ${error.message}`);
2931
+ }
2932
+ }
2933
+
2934
+ // Count retained files
2935
+ retainedCount = allLegacyFiles.length - deletedCount;
2936
+
2937
+ // Update retention data
2938
+ const newlyRetained = allLegacyFiles.filter((f) => !filesToDelete.includes(f)).map((f) => f.relativePath);
2939
+
2940
+ retentionData.retainedFiles = [...new Set([...retentionData.retainedFiles, ...newlyRetained])];
2941
+ retentionData.history.push({
2942
+ date: new Date().toISOString(),
2943
+ deleted: deletedCount,
2944
+ retained: retainedCount,
2945
+ files: filesToDelete.map((f) => f.relativePath),
2946
+ });
2947
+
2948
+ // Save retention data
2949
+ await fs.ensureDir(path.dirname(retentionPath));
2950
+ await fs.writeFile(retentionPath, yaml.dump(retentionData), 'utf8');
2951
+
2952
+ return { deleted: deletedCount, retained: retainedCount };
2953
+ }
2385
2954
  }
2386
2955
 
2387
2956
  module.exports = { Installer };