bmad-method 4.27.5 → 5.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 (274) hide show
  1. package/.bmad-core/agent-teams/team-all.yml +16 -0
  2. package/.bmad-core/agent-teams/team-fullstack.yml +26 -0
  3. package/.bmad-core/agent-teams/team-no-ui.yml +15 -0
  4. package/{bmad-core → .bmad-core}/agents/analyst.md +23 -30
  5. package/.bmad-core/agents/architect.md +66 -0
  6. package/.bmad-core/agents/bmad-master.md +104 -0
  7. package/.bmad-core/agents/bmad-orchestrator.md +81 -0
  8. package/.bmad-core/agents/dev.md +70 -0
  9. package/{bmad-core → .bmad-core}/agents/pm.md +24 -25
  10. package/{bmad-core → .bmad-core}/agents/po.md +24 -28
  11. package/.bmad-core/agents/qa.md +52 -0
  12. package/.bmad-core/agents/sm.md +55 -0
  13. package/.bmad-core/agents/ux-expert.md +66 -0
  14. package/{bmad-core → .bmad-core}/checklists/change-checklist.md +2 -2
  15. package/{bmad-core → .bmad-core}/checklists/story-draft-checklist.md +1 -1
  16. package/.bmad-core/data/bmad-kb.md +47 -0
  17. package/.bmad-core/schemas/agent-team-schema.yml +153 -0
  18. package/.bmad-core/tasks/advanced-elicitation.md +92 -0
  19. package/.bmad-core/tasks/brainstorming-techniques.md +238 -0
  20. package/.bmad-core/tasks/core-dump.md +74 -0
  21. package/{expansion-packs/bmad-creator-tools → .bmad-core}/tasks/create-agent.md +11 -9
  22. package/.bmad-core/tasks/create-doc.md +74 -0
  23. package/.bmad-core/tasks/create-expansion-pack.md +425 -0
  24. package/.bmad-core/tasks/create-next-story.md +206 -0
  25. package/.bmad-core/tasks/create-team.md +229 -0
  26. package/{bmad-core → .bmad-core}/tasks/doc-migration-task.md +9 -9
  27. package/{common → .bmad-core}/tasks/execute-checklist.md +6 -2
  28. package/.bmad-core/tasks/generate-ai-frontend-prompt.md +58 -0
  29. package/{bmad-core → .bmad-core}/tasks/index-docs.md +7 -3
  30. package/{bmad-core → .bmad-core}/tasks/shard-doc.md +7 -25
  31. package/.bmad-core/templates/agent-tmpl.md +58 -0
  32. package/.bmad-core/templates/architecture-tmpl.md +771 -0
  33. package/.bmad-core/templates/brownfield-architecture-tmpl.md +542 -0
  34. package/.bmad-core/templates/brownfield-prd-tmpl.md +240 -0
  35. package/.bmad-core/templates/competitor-analysis-tmpl.md +289 -0
  36. package/.bmad-core/templates/expansion-pack-plan-tmpl.md +91 -0
  37. package/.bmad-core/templates/front-end-architecture-tmpl.md +173 -0
  38. package/.bmad-core/templates/front-end-spec-tmpl.md +411 -0
  39. package/.bmad-core/templates/fullstack-architecture-tmpl.md +1016 -0
  40. package/.bmad-core/templates/market-research-tmpl.md +261 -0
  41. package/.bmad-core/templates/prd-tmpl.md +200 -0
  42. package/.bmad-core/templates/project-brief-tmpl.md +228 -0
  43. package/.bmad-core/templates/simple-project-prd-tmpl.md +461 -0
  44. package/.bmad-core/templates/story-tmpl.md +61 -0
  45. package/.bmad-core/templates/web-agent-startup-instructions-template.md +39 -0
  46. package/.bmad-core/utils/agent-switcher.ide.md +112 -0
  47. package/.bmad-core/utils/template-format.md +26 -0
  48. package/.bmad-core/utils/workflow-management.md +224 -0
  49. package/.bmad-core/web-bundles/agents/analyst.txt +1684 -0
  50. package/.bmad-core/web-bundles/agents/architect.txt +3584 -0
  51. package/.bmad-core/web-bundles/agents/bmad-master.txt +9491 -0
  52. package/.bmad-core/web-bundles/agents/bmad-orchestrator.txt +1466 -0
  53. package/{dist → .bmad-core/web-bundles}/agents/dev.txt +71 -179
  54. package/{dist → .bmad-core/web-bundles}/agents/pm.txt +1058 -624
  55. package/{dist → .bmad-core/web-bundles}/agents/po.txt +138 -337
  56. package/.bmad-core/web-bundles/agents/qa.txt +129 -0
  57. package/.bmad-core/web-bundles/agents/sm.txt +658 -0
  58. package/.bmad-core/web-bundles/agents/ux-expert.txt +1099 -0
  59. package/.bmad-core/web-bundles/teams/team-all.txt +10757 -0
  60. package/.bmad-core/web-bundles/teams/team-fullstack.txt +10109 -0
  61. package/.bmad-core/web-bundles/teams/team-no-ui.txt +8950 -0
  62. package/.bmad-core/workflows/brownfield-fullstack.yml +116 -0
  63. package/.bmad-core/workflows/brownfield-service.yml +117 -0
  64. package/.bmad-core/workflows/brownfield-ui.yml +127 -0
  65. package/{bmad-core/workflows/greenfield-fullstack.yaml → .bmad-core/workflows/greenfield-fullstack.yml} +77 -140
  66. package/.bmad-core/workflows/greenfield-service.yml +143 -0
  67. package/.bmad-core/workflows/greenfield-ui.yml +172 -0
  68. package/.claude/commands/analyst.md +63 -0
  69. package/.claude/commands/architect.md +70 -0
  70. package/.claude/commands/bmad-master.md +108 -0
  71. package/.claude/commands/bmad-orchestrator.md +85 -0
  72. package/.claude/commands/dev.md +74 -0
  73. package/.claude/commands/pm.md +63 -0
  74. package/.claude/commands/po.md +64 -0
  75. package/.claude/commands/qa.md +56 -0
  76. package/.claude/commands/sm.md +59 -0
  77. package/.claude/commands/ux-expert.md +70 -0
  78. package/.cursor/rules/analyst.mdc +77 -0
  79. package/.cursor/rules/architect.mdc +84 -0
  80. package/.cursor/rules/bmad-master.mdc +122 -0
  81. package/.cursor/rules/bmad-orchestrator.mdc +99 -0
  82. package/.cursor/rules/dev.mdc +88 -0
  83. package/.cursor/rules/pm.mdc +77 -0
  84. package/.cursor/rules/po.mdc +78 -0
  85. package/.cursor/rules/qa.mdc +70 -0
  86. package/.cursor/rules/sm.mdc +73 -0
  87. package/.cursor/rules/ux-expert.mdc +84 -0
  88. package/.roo/.roomodes +95 -0
  89. package/.roo/README.md +38 -0
  90. package/.vscode/extensions.json +6 -0
  91. package/.vscode/settings.json +75 -49
  92. package/.windsurf/rules/analyst.md +71 -0
  93. package/.windsurf/rules/architect.md +78 -0
  94. package/.windsurf/rules/bmad-master.md +116 -0
  95. package/.windsurf/rules/bmad-orchestrator.md +93 -0
  96. package/.windsurf/rules/dev.md +82 -0
  97. package/.windsurf/rules/pm.md +71 -0
  98. package/.windsurf/rules/po.md +72 -0
  99. package/.windsurf/rules/qa.md +64 -0
  100. package/.windsurf/rules/sm.md +67 -0
  101. package/.windsurf/rules/ux-expert.md +78 -0
  102. package/CHANGELOG.md +16 -452
  103. package/CONTRIBUTING.md +5 -168
  104. package/LICENSE +1 -1
  105. package/README.md +230 -77
  106. package/docs/bmad-workflow-guide.md +15 -19
  107. package/docs/claude-code-guide.md +119 -0
  108. package/docs/cursor-guide.md +127 -0
  109. package/docs/roo-code-guide.md +140 -0
  110. package/docs/sample-output/simple-fullstack-greenfield/prd.md +42 -0
  111. package/docs/versioning-and-releases.md +16 -8
  112. package/docs/versions.md +5 -4
  113. package/docs/windsurf-guide.md +127 -0
  114. package/expansion-packs/README.md +112 -2
  115. package/expansion-packs/{bmad-infrastructure-devops → infrastructure-devops}/README.md +9 -9
  116. package/expansion-packs/{bmad-infrastructure-devops → infrastructure-devops}/agents/infra-devops-platform.md +15 -15
  117. package/expansion-packs/{bmad-infrastructure-devops → infrastructure-devops}/checklists/infrastructure-checklist.md +1 -1
  118. package/expansion-packs/infrastructure-devops/manifest.yml +38 -0
  119. package/expansion-packs/{bmad-infrastructure-devops → infrastructure-devops}/tasks/review-infrastructure.md +4 -4
  120. package/expansion-packs/{bmad-infrastructure-devops → infrastructure-devops}/tasks/validate-infrastructure.md +4 -4
  121. package/expansion-packs/infrastructure-devops/templates/infrastructure-architecture-tmpl.md +415 -0
  122. package/expansion-packs/infrastructure-devops/templates/infrastructure-platform-from-arch-tmpl.md +0 -0
  123. package/package.json +11 -19
  124. package/tools/bmad-npx-wrapper.js +1 -1
  125. package/tools/builders/web-builder.js +28 -563
  126. package/tools/cli.js +22 -55
  127. package/tools/installer/README.md +53 -3
  128. package/tools/installer/bin/bmad.js +56 -294
  129. package/tools/installer/config/install.config.yml +139 -0
  130. package/tools/installer/lib/config-loader.js +34 -198
  131. package/tools/installer/lib/file-manager.js +5 -123
  132. package/tools/installer/lib/ide-setup.js +189 -545
  133. package/tools/installer/lib/installer.js +55 -1136
  134. package/tools/installer/package-lock.json +3 -3
  135. package/tools/installer/package.json +4 -4
  136. package/tools/installer/templates/claude-commands.md +7 -0
  137. package/tools/installer/templates/cursor-rules.md +22 -0
  138. package/tools/installer/templates/windsurf-rules.md +22 -0
  139. package/tools/lib/dependency-resolver.js +22 -22
  140. package/tools/upgraders/v3-to-v4-upgrader.js +43 -35
  141. package/tools/version-bump.js +1 -1
  142. package/tools/yaml-format.js +2 -2
  143. package/.github/FUNDING.yaml +0 -15
  144. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -32
  145. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -22
  146. package/.prettierignore +0 -21
  147. package/.prettierrc +0 -23
  148. package/bmad-core/agent-teams/team-all.yaml +0 -14
  149. package/bmad-core/agent-teams/team-fullstack.yaml +0 -18
  150. package/bmad-core/agent-teams/team-ide-minimal.yaml +0 -10
  151. package/bmad-core/agent-teams/team-no-ui.yaml +0 -13
  152. package/bmad-core/agents/architect.md +0 -63
  153. package/bmad-core/agents/bmad-master.md +0 -110
  154. package/bmad-core/agents/bmad-orchestrator.md +0 -140
  155. package/bmad-core/agents/dev.md +0 -57
  156. package/bmad-core/agents/qa.md +0 -55
  157. package/bmad-core/agents/sm.md +0 -46
  158. package/bmad-core/agents/ux-expert.md +0 -54
  159. package/bmad-core/core-config.yaml +0 -25
  160. package/bmad-core/data/bmad-kb.md +0 -803
  161. package/bmad-core/data/brainstorming-techniques.md +0 -36
  162. package/bmad-core/data/elicitation-methods.md +0 -134
  163. package/bmad-core/tasks/advanced-elicitation.md +0 -117
  164. package/bmad-core/tasks/create-brownfield-story.md +0 -355
  165. package/bmad-core/tasks/create-next-story.md +0 -114
  166. package/bmad-core/tasks/create-workflow-plan.md +0 -289
  167. package/bmad-core/tasks/document-project.md +0 -317
  168. package/bmad-core/tasks/facilitate-brainstorming-session.md +0 -136
  169. package/bmad-core/tasks/generate-ai-frontend-prompt.md +0 -51
  170. package/bmad-core/tasks/kb-mode-interaction.md +0 -70
  171. package/bmad-core/tasks/review-story.md +0 -145
  172. package/bmad-core/tasks/update-workflow-plan.md +0 -248
  173. package/bmad-core/tasks/validate-next-story.md +0 -134
  174. package/bmad-core/templates/architecture-tmpl.yaml +0 -650
  175. package/bmad-core/templates/brainstorming-output-tmpl.yaml +0 -156
  176. package/bmad-core/templates/brownfield-architecture-tmpl.yaml +0 -476
  177. package/bmad-core/templates/brownfield-prd-tmpl.yaml +0 -280
  178. package/bmad-core/templates/competitor-analysis-tmpl.yaml +0 -293
  179. package/bmad-core/templates/front-end-architecture-tmpl.yaml +0 -206
  180. package/bmad-core/templates/front-end-spec-tmpl.yaml +0 -349
  181. package/bmad-core/templates/fullstack-architecture-tmpl.yaml +0 -805
  182. package/bmad-core/templates/market-research-tmpl.yaml +0 -252
  183. package/bmad-core/templates/prd-tmpl.yaml +0 -202
  184. package/bmad-core/templates/project-brief-tmpl.yaml +0 -221
  185. package/bmad-core/templates/story-tmpl.yaml +0 -137
  186. package/bmad-core/utils/plan-management.md +0 -219
  187. package/bmad-core/workflows/brownfield-fullstack.yaml +0 -297
  188. package/bmad-core/workflows/brownfield-service.yaml +0 -187
  189. package/bmad-core/workflows/brownfield-ui.yaml +0 -197
  190. package/bmad-core/workflows/greenfield-service.yaml +0 -206
  191. package/bmad-core/workflows/greenfield-ui.yaml +0 -235
  192. package/common/tasks/create-doc.md +0 -79
  193. package/common/utils/bmad-doc-template.md +0 -325
  194. package/common/utils/workflow-management.md +0 -69
  195. package/dist/agents/analyst.txt +0 -2849
  196. package/dist/agents/architect.txt +0 -3505
  197. package/dist/agents/bmad-master.txt +0 -9588
  198. package/dist/agents/bmad-orchestrator.txt +0 -2232
  199. package/dist/agents/qa.txt +0 -388
  200. package/dist/agents/sm.txt +0 -673
  201. package/dist/agents/ux-expert.txt +0 -987
  202. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.txt +0 -2401
  203. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.txt +0 -1635
  204. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.txt +0 -825
  205. package/dist/expansion-packs/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +0 -11730
  206. package/dist/expansion-packs/bmad-creator-tools/agents/bmad-the-creator.txt +0 -2023
  207. package/dist/expansion-packs/bmad-infrastructure-devops/agents/infra-devops-platform.txt +0 -2052
  208. package/dist/teams/team-all.txt +0 -11799
  209. package/dist/teams/team-fullstack.txt +0 -11129
  210. package/dist/teams/team-ide-minimal.txt +0 -4573
  211. package/dist/teams/team-no-ui.txt +0 -9684
  212. package/docs/GUIDING-PRINCIPLES.md +0 -91
  213. package/docs/agentic-tools/claude-code-guide.md +0 -19
  214. package/docs/agentic-tools/cline-guide.md +0 -16
  215. package/docs/agentic-tools/cursor-guide.md +0 -14
  216. package/docs/agentic-tools/gemini-cli-guide.md +0 -32
  217. package/docs/agentic-tools/github-copilot-guide.md +0 -42
  218. package/docs/agentic-tools/roo-code-guide.md +0 -15
  219. package/docs/agentic-tools/trae-guide.md +0 -14
  220. package/docs/agentic-tools/windsurf-guide.md +0 -14
  221. package/docs/core-architecture.md +0 -219
  222. package/docs/expansion-packs.md +0 -280
  223. package/docs/how-to-contribute-with-pull-requests.md +0 -158
  224. package/docs/template-markup-references.md +0 -86
  225. package/docs/user-guide.md +0 -1142
  226. package/docs/working-in-the-brownfield.md +0 -361
  227. package/expansion-packs/bmad-2d-phaser-game-dev/agent-teams/phaser-2d-nodejs-game-team.yaml +0 -13
  228. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.md +0 -60
  229. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.md +0 -68
  230. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.md +0 -53
  231. package/expansion-packs/bmad-2d-phaser-game-dev/checklists/game-design-checklist.md +0 -201
  232. package/expansion-packs/bmad-2d-phaser-game-dev/checklists/game-story-dod-checklist.md +0 -160
  233. package/expansion-packs/bmad-2d-phaser-game-dev/config.yaml +0 -7
  234. package/expansion-packs/bmad-2d-phaser-game-dev/data/bmad-kb.md +0 -254
  235. package/expansion-packs/bmad-2d-phaser-game-dev/data/development-guidelines.md +0 -651
  236. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/advanced-elicitation.md +0 -111
  237. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/create-game-story.md +0 -216
  238. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/game-design-brainstorming.md +0 -308
  239. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-architecture-tmpl.yaml +0 -613
  240. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-brief-tmpl.yaml +0 -356
  241. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-design-doc-tmpl.yaml +0 -343
  242. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-story-tmpl.yaml +0 -253
  243. package/expansion-packs/bmad-2d-phaser-game-dev/templates/level-design-doc-tmpl.yaml +0 -484
  244. package/expansion-packs/bmad-2d-phaser-game-dev/workflows/game-dev-greenfield.yaml +0 -183
  245. package/expansion-packs/bmad-2d-phaser-game-dev/workflows/game-prototype.yaml +0 -175
  246. package/expansion-packs/bmad-creator-tools/README.md +0 -8
  247. package/expansion-packs/bmad-creator-tools/agents/bmad-the-creator.md +0 -55
  248. package/expansion-packs/bmad-creator-tools/config.yaml +0 -5
  249. package/expansion-packs/bmad-creator-tools/tasks/generate-expansion-pack.md +0 -1020
  250. package/expansion-packs/bmad-creator-tools/templates/agent-teams-tmpl.yaml +0 -178
  251. package/expansion-packs/bmad-creator-tools/templates/agent-tmpl.yaml +0 -154
  252. package/expansion-packs/bmad-creator-tools/templates/expansion-pack-plan-tmpl.yaml +0 -120
  253. package/expansion-packs/bmad-infrastructure-devops/config.yaml +0 -8
  254. package/expansion-packs/bmad-infrastructure-devops/data/bmad-kb.md +0 -308
  255. package/expansion-packs/bmad-infrastructure-devops/templates/infrastructure-architecture-tmpl.yaml +0 -424
  256. package/expansion-packs/bmad-infrastructure-devops/templates/infrastructure-platform-from-arch-tmpl.yaml +0 -629
  257. package/tools/bump-all-versions.js +0 -107
  258. package/tools/bump-core-version.js +0 -57
  259. package/tools/bump-expansion-version.js +0 -78
  260. package/tools/installer/config/ide-agent-config.yaml +0 -58
  261. package/tools/installer/config/install.config.yaml +0 -91
  262. package/tools/lib/yaml-utils.js +0 -29
  263. package/tools/md-assets/web-agent-startup-instructions.md +0 -39
  264. package/tools/update-expansion-version.js +0 -54
  265. /package/{bmad-core → .bmad-core}/checklists/architect-checklist.md +0 -0
  266. /package/{bmad-core → .bmad-core}/checklists/pm-checklist.md +0 -0
  267. /package/{bmad-core → .bmad-core}/checklists/po-master-checklist.md +0 -0
  268. /package/{bmad-core → .bmad-core}/checklists/story-dod-checklist.md +0 -0
  269. /package/{bmad-core → .bmad-core}/data/technical-preferences.md +0 -0
  270. /package/{bmad-core → .bmad-core}/tasks/brownfield-create-epic.md +0 -0
  271. /package/{bmad-core → .bmad-core}/tasks/brownfield-create-story.md +0 -0
  272. /package/{bmad-core → .bmad-core}/tasks/correct-course.md +0 -0
  273. /package/{bmad-core → .bmad-core}/tasks/create-deep-research-prompt.md +0 -0
  274. /package/.github/workflows/{release.yaml → release.yml} +0 -0
@@ -2,7 +2,6 @@ const path = require("node:path");
2
2
  const fileManager = require("./file-manager");
3
3
  const configLoader = require("./config-loader");
4
4
  const ideSetup = require("./ide-setup");
5
- const { extractYamlFromAgent } = require("../../lib/yaml-utils");
6
5
 
7
6
  // Dynamic imports for ES modules
8
7
  let chalk, ora, inquirer;
@@ -17,20 +16,6 @@ async function initializeModules() {
17
16
  }
18
17
 
19
18
  class Installer {
20
- async getCoreVersion() {
21
- const yaml = require("js-yaml");
22
- const fs = require("fs-extra");
23
- const coreConfigPath = path.join(__dirname, "../../../bmad-core/core-config.yaml");
24
- try {
25
- const coreConfigContent = await fs.readFile(coreConfigPath, "utf8");
26
- const coreConfig = yaml.load(coreConfigContent);
27
- return coreConfig.version || "unknown";
28
- } catch (error) {
29
- console.warn("Could not read version from core-config.yaml, using 'unknown'");
30
- return "unknown";
31
- }
32
- }
33
-
34
19
  async install(config) {
35
20
  // Initialize ES modules
36
21
  await initializeModules();
@@ -38,23 +23,12 @@ class Installer {
38
23
  const spinner = ora("Analyzing installation directory...").start();
39
24
 
40
25
  try {
41
- // Store the original CWD where npx was executed
42
- const originalCwd = process.env.INIT_CWD || process.env.PWD || process.cwd();
43
-
44
- // Resolve installation directory relative to where the user ran the command
45
- let installDir = path.isAbsolute(config.directory)
46
- ? config.directory
47
- : path.resolve(originalCwd, config.directory);
48
-
26
+ // Resolve installation directory
27
+ let installDir = path.resolve(config.directory);
49
28
  if (path.basename(installDir) === '.bmad-core') {
50
29
  // If user points directly to .bmad-core, treat its parent as the project root
51
30
  installDir = path.dirname(installDir);
52
31
  }
53
-
54
- // Log resolved path for clarity
55
- if (!path.isAbsolute(config.directory)) {
56
- spinner.text = `Resolving "${config.directory}" to: ${installDir}`;
57
- }
58
32
 
59
33
  // Check if directory exists and handle non-existent directories
60
34
  if (!(await fileManager.pathExists(installDir))) {
@@ -100,7 +74,6 @@ class Installer {
100
74
  }
101
75
  }
102
76
  ]);
103
- // Preserve the original CWD for the recursive call
104
77
  config.directory = newDirectory;
105
78
  return await this.install(config); // Recursive call with new directory
106
79
  } else if (action === 'create') {
@@ -117,17 +90,6 @@ class Installer {
117
90
  spinner.start("Analyzing installation directory...");
118
91
  }
119
92
 
120
- // If this is an update request from early detection, handle it directly
121
- if (config.installType === 'update') {
122
- const state = await this.detectInstallationState(installDir);
123
- if (state.type === 'v4_existing') {
124
- return await this.performUpdate(config, installDir, state.manifest, spinner);
125
- } else {
126
- spinner.fail('No existing v4 installation found to update');
127
- throw new Error('No existing v4 installation found');
128
- }
129
- }
130
-
131
93
  // Detect current state
132
94
  const state = await this.detectInstallationState(installDir);
133
95
 
@@ -176,7 +138,6 @@ class Installer {
176
138
  hasBmadCore: false,
177
139
  hasOtherFiles: false,
178
140
  manifest: null,
179
- expansionPacks: {},
180
141
  };
181
142
 
182
143
  // Check if directory exists
@@ -186,7 +147,7 @@ class Installer {
186
147
 
187
148
  // Check for V4 installation (has .bmad-core with manifest)
188
149
  const bmadCorePath = path.join(installDir, ".bmad-core");
189
- const manifestPath = path.join(bmadCorePath, "install-manifest.yaml");
150
+ const manifestPath = path.join(bmadCorePath, "install-manifest.yml");
190
151
 
191
152
  if (await fileManager.pathExists(manifestPath)) {
192
153
  state.type = "v4_existing";
@@ -220,22 +181,18 @@ class Installer {
220
181
  });
221
182
 
222
183
  if (files.length > 0) {
223
- // Directory has other files, but no BMad installation.
184
+ // Directory has other files, but no BMAD installation.
224
185
  // Treat as clean install but record that it isn't empty.
225
186
  state.hasOtherFiles = true;
226
187
  }
227
188
 
228
- // Check for expansion packs (folders starting with .)
229
- const expansionPacks = await this.detectExpansionPacks(installDir);
230
- state.expansionPacks = expansionPacks;
231
-
232
189
  return state; // clean install
233
190
  }
234
191
 
235
- async performFreshInstall(config, installDir, spinner, options = {}) {
192
+ async performFreshInstall(config, installDir, spinner) {
236
193
  // Ensure modules are initialized
237
194
  await initializeModules();
238
- spinner.text = "Installing BMad Method...";
195
+ spinner.text = "Installing BMAD Method...";
239
196
 
240
197
  let files = [];
241
198
 
@@ -245,10 +202,6 @@ class Installer {
245
202
  const sourceDir = configLoader.getBmadCorePath();
246
203
  const bmadCoreDestDir = path.join(installDir, ".bmad-core");
247
204
  await fileManager.copyDirectory(sourceDir, bmadCoreDestDir);
248
-
249
- // Copy common/ items to .bmad-core
250
- spinner.text = "Copying common utilities...";
251
- await this.copyCommonItems(installDir, ".bmad-core", spinner);
252
205
 
253
206
  // Get list of all files for manifest
254
207
  const glob = require("glob");
@@ -267,12 +220,11 @@ class Installer {
267
220
  const agentPath = configLoader.getAgentPath(config.agent);
268
221
  const destAgentPath = path.join(
269
222
  installDir,
270
- ".bmad-core",
271
223
  "agents",
272
224
  `${config.agent}.md`
273
225
  );
274
226
  await fileManager.copyFile(agentPath, destAgentPath);
275
- files.push(`.bmad-core/agents/${config.agent}.md`);
227
+ files.push(`agents/${config.agent}.md`);
276
228
 
277
229
  // Copy dependencies
278
230
  const dependencies = await configLoader.getAgentDependencies(
@@ -288,9 +240,9 @@ class Installer {
288
240
  const copiedFiles = await fileManager.copyGlobPattern(
289
241
  dep.replace(".bmad-core/", ""),
290
242
  sourceBase,
291
- path.join(installDir, ".bmad-core")
243
+ installDir
292
244
  );
293
- files.push(...copiedFiles.map(f => `.bmad-core/${f}`));
245
+ files.push(...copiedFiles);
294
246
  } else {
295
247
  // Handle single files
296
248
  const sourcePath = path.join(
@@ -299,73 +251,14 @@ class Installer {
299
251
  );
300
252
  const destPath = path.join(
301
253
  installDir,
302
- dep
254
+ dep.replace(".bmad-core/", "")
303
255
  );
304
256
 
305
257
  if (await fileManager.copyFile(sourcePath, destPath)) {
306
- files.push(dep);
258
+ files.push(dep.replace(".bmad-core/", ""));
307
259
  }
308
260
  }
309
261
  }
310
-
311
- // Copy common/ items to .bmad-core
312
- spinner.text = "Copying common utilities...";
313
- const commonFiles = await this.copyCommonItems(installDir, ".bmad-core", spinner);
314
- files.push(...commonFiles);
315
- } else if (config.installType === "team") {
316
- // Team installation
317
- spinner.text = `Installing ${config.team} team...`;
318
-
319
- // Get team dependencies
320
- const teamDependencies = await configLoader.getTeamDependencies(config.team);
321
- const sourceBase = configLoader.getBmadCorePath();
322
-
323
- // Install all team dependencies
324
- for (const dep of teamDependencies) {
325
- spinner.text = `Copying team dependency: ${dep}`;
326
-
327
- if (dep.includes("*")) {
328
- // Handle glob patterns
329
- const copiedFiles = await fileManager.copyGlobPattern(
330
- dep.replace(".bmad-core/", ""),
331
- sourceBase,
332
- path.join(installDir, ".bmad-core")
333
- );
334
- files.push(...copiedFiles.map(f => `.bmad-core/${f}`));
335
- } else {
336
- // Handle single files
337
- const sourcePath = path.join(sourceBase, dep.replace(".bmad-core/", ""));
338
- const destPath = path.join(installDir, dep);
339
-
340
- if (await fileManager.copyFile(sourcePath, destPath)) {
341
- files.push(dep);
342
- }
343
- }
344
- }
345
-
346
- // Copy common/ items to .bmad-core
347
- spinner.text = "Copying common utilities...";
348
- const commonFiles = await this.copyCommonItems(installDir, ".bmad-core", spinner);
349
- files.push(...commonFiles);
350
- } else if (config.installType === "expansion-only") {
351
- // Expansion-only installation - DO NOT create .bmad-core
352
- // Only install expansion packs
353
- spinner.text = "Installing expansion packs only...";
354
- }
355
-
356
- // Install expansion packs if requested
357
- const expansionFiles = await this.installExpansionPacks(installDir, config.expansionPacks, spinner, config);
358
- files.push(...expansionFiles);
359
-
360
- // Install web bundles if requested
361
- if (config.includeWebBundles && config.webBundlesDirectory) {
362
- spinner.text = "Installing web bundles...";
363
- // Resolve web bundles directory using the same logic as the main installation directory
364
- const originalCwd = process.env.INIT_CWD || process.env.PWD || process.cwd();
365
- let resolvedWebBundlesDir = path.isAbsolute(config.webBundlesDirectory)
366
- ? config.webBundlesDirectory
367
- : path.resolve(originalCwd, config.webBundlesDirectory);
368
- await this.installWebBundles(resolvedWebBundlesDir, config, spinner);
369
262
  }
370
263
 
371
264
  // Set up IDE integration if requested
@@ -373,25 +266,16 @@ class Installer {
373
266
  if (ides.length > 0) {
374
267
  for (const ide of ides) {
375
268
  spinner.text = `Setting up ${ide} integration...`;
376
- const preConfiguredSettings = ide === 'github-copilot' ? config.githubCopilotConfig : null;
377
- await ideSetup.setup(ide, installDir, config.agent, spinner, preConfiguredSettings);
269
+ await ideSetup.setup(ide, installDir, config.agent);
378
270
  }
379
271
  }
380
272
 
381
- // Modify core-config.yaml if sharding preferences were provided
382
- if (config.installType !== "expansion-only" && (config.prdSharded !== undefined || config.architectureSharded !== undefined)) {
383
- spinner.text = "Configuring document sharding settings...";
384
- await fileManager.modifyCoreConfig(installDir, config);
385
- }
386
-
387
- // Create manifest (skip for expansion-only installations)
388
- if (config.installType !== "expansion-only") {
389
- spinner.text = "Creating installation manifest...";
390
- await fileManager.createManifest(installDir, config, files);
391
- }
273
+ // Create manifest
274
+ spinner.text = "Creating installation manifest...";
275
+ await fileManager.createManifest(installDir, config, files);
392
276
 
393
277
  spinner.succeed("Installation complete!");
394
- this.showSuccessMessage(config, installDir, options);
278
+ this.showSuccessMessage(config, installDir);
395
279
  }
396
280
 
397
281
  async handleExistingV4Installation(config, installDir, state, spinner) {
@@ -399,137 +283,33 @@ class Installer {
399
283
  await initializeModules();
400
284
  spinner.stop();
401
285
 
402
- const currentVersion = state.manifest.version;
403
- const newVersion = await this.getCoreVersion();
404
- const versionCompare = this.compareVersions(currentVersion, newVersion);
405
-
406
- console.log(chalk.yellow("\n🔍 Found existing BMad v4 installation"));
286
+ console.log(chalk.yellow("\n🔍 Found existing BMAD v4 installation"));
407
287
  console.log(` Directory: ${installDir}`);
408
- console.log(` Current version: ${currentVersion}`);
409
- console.log(` Available version: ${newVersion}`);
288
+ console.log(` Version: ${state.manifest.version}`);
410
289
  console.log(
411
290
  ` Installed: ${new Date(
412
291
  state.manifest.installed_at
413
292
  ).toLocaleDateString()}`
414
293
  );
415
294
 
416
- // Check file integrity
417
- spinner.start("Checking installation integrity...");
418
- const integrity = await fileManager.checkFileIntegrity(installDir, state.manifest);
419
- spinner.stop();
420
-
421
- const hasMissingFiles = integrity.missing.length > 0;
422
- const hasModifiedFiles = integrity.modified.length > 0;
423
- const hasIntegrityIssues = hasMissingFiles || hasModifiedFiles;
424
-
425
- if (hasIntegrityIssues) {
426
- console.log(chalk.red("\n⚠️ Installation issues detected:"));
427
- if (hasMissingFiles) {
428
- console.log(chalk.red(` Missing files: ${integrity.missing.length}`));
429
- if (integrity.missing.length <= 5) {
430
- integrity.missing.forEach(file => console.log(chalk.dim(` - ${file}`)));
431
- }
432
- }
433
- if (hasModifiedFiles) {
434
- console.log(chalk.yellow(` Modified files: ${integrity.modified.length}`));
435
- if (integrity.modified.length <= 5) {
436
- integrity.modified.forEach(file => console.log(chalk.dim(` - ${file}`)));
437
- }
438
- }
439
- }
440
-
441
- // Show existing expansion packs
442
- if (Object.keys(state.expansionPacks).length > 0) {
443
- console.log(chalk.cyan("\n📦 Installed expansion packs:"));
444
- for (const [packId, packInfo] of Object.entries(state.expansionPacks)) {
445
- if (packInfo.hasManifest && packInfo.manifest) {
446
- console.log(` - ${packId} (v${packInfo.manifest.version || 'unknown'})`);
447
- } else {
448
- console.log(` - ${packId} (no manifest)`);
449
- }
450
- }
451
- }
452
-
453
- let choices = [];
454
-
455
- if (versionCompare < 0) {
456
- console.log(chalk.cyan("\n⬆️ Upgrade available for BMad core"));
457
- choices.push({ name: `Upgrade BMad core (v${currentVersion} → v${newVersion})`, value: "upgrade" });
458
- } else if (versionCompare === 0) {
459
- if (hasIntegrityIssues) {
460
- // Offer repair option when files are missing or modified
461
- choices.push({
462
- name: "Repair installation (restore missing/modified files)",
463
- value: "repair"
464
- });
465
- }
466
- console.log(chalk.yellow("\n⚠️ Same version already installed"));
467
- choices.push({ name: `Force reinstall BMad core (v${currentVersion} - reinstall)`, value: "reinstall" });
468
- } else {
469
- console.log(chalk.yellow("\n⬇️ Installed version is newer than available"));
470
- choices.push({ name: `Downgrade BMad core (v${currentVersion} → v${newVersion})`, value: "reinstall" });
471
- }
472
-
473
- choices.push(
474
- { name: "Add/update expansion packs only", value: "expansions" },
475
- { name: "Cancel", value: "cancel" }
476
- );
477
-
478
295
  const { action } = await inquirer.prompt([
479
296
  {
480
297
  type: "list",
481
298
  name: "action",
482
299
  message: "What would you like to do?",
483
- choices: choices,
300
+ choices: [
301
+ { name: "Update existing installation", value: "update" },
302
+ { name: "Reinstall (overwrite)", value: "reinstall" },
303
+ { name: "Cancel", value: "cancel" },
304
+ ],
484
305
  },
485
306
  ]);
486
307
 
487
308
  switch (action) {
488
- case "upgrade":
309
+ case "update":
489
310
  return await this.performUpdate(config, installDir, state.manifest, spinner);
490
- case "repair":
491
- // For repair, restore missing/modified files while backing up modified ones
492
- return await this.performRepair(config, installDir, state.manifest, integrity, spinner);
493
311
  case "reinstall":
494
- // For reinstall, don't check for modifications - just overwrite
495
312
  return await this.performReinstall(config, installDir, spinner);
496
- case "expansions":
497
- // Ask which expansion packs to install
498
- const availableExpansionPacks = await this.getAvailableExpansionPacks();
499
-
500
- if (availableExpansionPacks.length === 0) {
501
- console.log(chalk.yellow("No expansion packs available."));
502
- return;
503
- }
504
-
505
- const { selectedPacks } = await inquirer.prompt([
506
- {
507
- type: 'checkbox',
508
- name: 'selectedPacks',
509
- message: 'Select expansion packs to install/update:',
510
- choices: availableExpansionPacks.map(pack => ({
511
- name: `${pack.name} v${pack.version} - ${pack.description}`,
512
- value: pack.id,
513
- checked: state.expansionPacks[pack.id] !== undefined
514
- }))
515
- }
516
- ]);
517
-
518
- if (selectedPacks.length === 0) {
519
- console.log(chalk.yellow("No expansion packs selected."));
520
- return;
521
- }
522
-
523
- spinner.start("Installing expansion packs...");
524
- const expansionFiles = await this.installExpansionPacks(installDir, selectedPacks, spinner, { ides: config.ides || [] });
525
- spinner.succeed("Expansion packs installed successfully!");
526
-
527
- console.log(chalk.green("\n✓ Installation complete!"));
528
- console.log(chalk.green(`✓ Expansion packs installed/updated:`));
529
- for (const packId of selectedPacks) {
530
- console.log(chalk.green(` - ${packId} → .${packId}/`));
531
- }
532
- return;
533
313
  case "cancel":
534
314
  console.log("Installation cancelled.");
535
315
  return;
@@ -542,7 +322,7 @@ class Installer {
542
322
  spinner.stop();
543
323
 
544
324
  console.log(
545
- chalk.yellow("\n🔍 Found BMad v3 installation (bmad-agent/ directory)")
325
+ chalk.yellow("\n🔍 Found BMAD v3 installation (bmad-agent/ directory)")
546
326
  );
547
327
  console.log(` Directory: ${installDir}`);
548
328
 
@@ -564,10 +344,7 @@ class Installer {
564
344
  console.log(chalk.cyan("\n📦 Starting v3 to v4 upgrade process..."));
565
345
  const V3ToV4Upgrader = require("../../upgraders/v3-to-v4-upgrader");
566
346
  const upgrader = new V3ToV4Upgrader();
567
- return await upgrader.upgrade({
568
- projectPath: installDir,
569
- ides: config.ides || [] // Pass IDE selections from initial config
570
- });
347
+ return await upgrader.upgrade({ projectPath: installDir });
571
348
  }
572
349
  case "alongside":
573
350
  return await this.performFreshInstall(config, installDir, spinner);
@@ -630,20 +407,12 @@ class Installer {
630
407
  spinner.start("Checking for updates...");
631
408
 
632
409
  try {
633
- // Get current and new versions
634
- const currentVersion = manifest.version;
635
- const newVersion = await this.getCoreVersion();
636
- const versionCompare = this.compareVersions(currentVersion, newVersion);
637
-
638
- // Only check for modified files if it's an actual version upgrade
639
- let modifiedFiles = [];
640
- if (versionCompare !== 0) {
641
- spinner.text = "Checking for modified files...";
642
- modifiedFiles = await fileManager.checkModifiedFiles(
643
- installDir,
644
- manifest
645
- );
646
- }
410
+ // Check for modified files
411
+ spinner.text = "Checking for modified files...";
412
+ const modifiedFiles = await fileManager.checkModifiedFiles(
413
+ installDir,
414
+ manifest
415
+ );
647
416
 
648
417
  if (modifiedFiles.length > 0) {
649
418
  spinner.warn("Found modified files");
@@ -683,138 +452,35 @@ class Installer {
683
452
  }
684
453
 
685
454
  // Perform update by re-running installation
686
- spinner.text = versionCompare === 0 ? "Reinstalling files..." : "Updating files...";
455
+ spinner.text = "Updating files...";
687
456
  const config = {
688
457
  installType: manifest.install_type,
689
458
  agent: manifest.agent,
690
459
  directory: installDir,
691
- ides: newConfig?.ides || manifest.ides_setup || [],
460
+ ide: newConfig.ide || manifest.ide_setup, // Use new IDE choice if provided
692
461
  };
693
462
 
694
- await this.performFreshInstall(config, installDir, spinner, { isUpdate: true });
695
-
696
- // Clean up .yml files that now have .yaml counterparts
697
- spinner.text = "Cleaning up legacy .yml files...";
698
- await this.cleanupLegacyYmlFiles(installDir, spinner);
463
+ await this.performFreshInstall(config, installDir, spinner);
699
464
  } catch (error) {
700
465
  spinner.fail("Update failed");
701
466
  throw error;
702
467
  }
703
468
  }
704
469
 
705
- async performRepair(config, installDir, manifest, integrity, spinner) {
706
- spinner.start("Preparing to repair installation...");
707
-
708
- try {
709
- // Back up modified files
710
- if (integrity.modified.length > 0) {
711
- spinner.text = "Backing up modified files...";
712
- for (const file of integrity.modified) {
713
- const filePath = path.join(installDir, file);
714
- if (await fileManager.pathExists(filePath)) {
715
- const backupPath = await fileManager.backupFile(filePath);
716
- console.log(chalk.dim(` Backed up: ${file} → ${path.basename(backupPath)}`));
717
- }
718
- }
719
- }
720
-
721
- // Restore missing and modified files
722
- spinner.text = "Restoring files...";
723
- const sourceBase = configLoader.getBmadCorePath();
724
- const filesToRestore = [...integrity.missing, ...integrity.modified];
725
-
726
- for (const file of filesToRestore) {
727
- // Skip the manifest file itself
728
- if (file.endsWith('install-manifest.yaml')) continue;
729
-
730
- const relativePath = file.replace('.bmad-core/', '');
731
- const destPath = path.join(installDir, file);
732
-
733
- // Check if this is a common/ file that needs special processing
734
- const commonBase = path.dirname(path.dirname(path.dirname(path.dirname(__filename))));
735
- const commonSourcePath = path.join(commonBase, 'common', relativePath);
736
-
737
- if (await fileManager.pathExists(commonSourcePath)) {
738
- // This is a common/ file - needs template processing
739
- const fs = require('fs').promises;
740
- const content = await fs.readFile(commonSourcePath, 'utf8');
741
- const updatedContent = content.replace(/\{root\}/g, '.bmad-core');
742
- await fileManager.ensureDirectory(path.dirname(destPath));
743
- await fs.writeFile(destPath, updatedContent, 'utf8');
744
- spinner.text = `Restored: ${file}`;
745
- } else {
746
- // Regular file from bmad-core
747
- const sourcePath = path.join(sourceBase, relativePath);
748
- if (await fileManager.pathExists(sourcePath)) {
749
- await fileManager.copyFile(sourcePath, destPath);
750
- spinner.text = `Restored: ${file}`;
751
-
752
- // If this is a .yaml file, check for and remove corresponding .yml file
753
- if (file.endsWith('.yaml')) {
754
- const ymlFile = file.replace(/\.yaml$/, '.yml');
755
- const ymlPath = path.join(installDir, ymlFile);
756
- if (await fileManager.pathExists(ymlPath)) {
757
- const fs = require('fs').promises;
758
- await fs.unlink(ymlPath);
759
- console.log(chalk.dim(` Removed legacy: ${ymlFile} (replaced by ${file})`));
760
- }
761
- }
762
- } else {
763
- console.warn(chalk.yellow(` Warning: Source file not found: ${file}`));
764
- }
765
- }
766
- }
767
-
768
- // Clean up .yml files that now have .yaml counterparts
769
- spinner.text = "Cleaning up legacy .yml files...";
770
- await this.cleanupLegacyYmlFiles(installDir, spinner);
771
-
772
- spinner.succeed("Repair completed successfully!");
773
-
774
- // Show summary
775
- console.log(chalk.green("\n✓ Installation repaired!"));
776
- if (integrity.missing.length > 0) {
777
- console.log(chalk.green(` Restored ${integrity.missing.length} missing files`));
778
- }
779
- if (integrity.modified.length > 0) {
780
- console.log(chalk.green(` Restored ${integrity.modified.length} modified files (backups created)`));
781
- }
782
-
783
- // Warning for Cursor custom modes if agents were repaired
784
- const ides = manifest.ides_setup || [];
785
- if (ides.includes('cursor')) {
786
- console.log(chalk.yellow.bold("\n⚠️ IMPORTANT: Cursor Custom Modes Update Required"));
787
- console.log(chalk.yellow("Since agent files have been repaired, you need to update any custom agent modes configured in the Cursor custom agent GUI per the Cursor docs."));
788
- }
789
-
790
- } catch (error) {
791
- spinner.fail("Repair failed");
792
- throw error;
793
- }
794
- }
795
-
796
470
  async performReinstall(config, installDir, spinner) {
797
- spinner.start("Preparing to reinstall BMad Method...");
471
+ spinner.start("Reinstalling BMAD Method...");
798
472
 
799
473
  // Remove existing .bmad-core
800
474
  const bmadCorePath = path.join(installDir, ".bmad-core");
801
475
  if (await fileManager.pathExists(bmadCorePath)) {
802
- spinner.text = "Removing existing installation...";
803
476
  await fileManager.removeDirectory(bmadCorePath);
804
477
  }
805
-
806
- spinner.text = "Installing fresh copy...";
807
- const result = await this.performFreshInstall(config, installDir, spinner, { isUpdate: true });
808
-
809
- // Clean up .yml files that now have .yaml counterparts
810
- spinner.text = "Cleaning up legacy .yml files...";
811
- await this.cleanupLegacyYmlFiles(installDir, spinner);
812
-
813
- return result;
478
+
479
+ return await this.performFreshInstall(config, installDir, spinner);
814
480
  }
815
481
 
816
- showSuccessMessage(config, installDir, options = {}) {
817
- console.log(chalk.green("\n✓ BMad Method installed successfully!\n"));
482
+ showSuccessMessage(config, installDir) {
483
+ console.log(chalk.green("\n✓ BMAD Method installed successfully!\n"));
818
484
 
819
485
  const ides = config.ides || (config.ide ? [config.ide] : []);
820
486
  if (ides.length > 0) {
@@ -822,7 +488,7 @@ class Installer {
822
488
  const ideConfig = configLoader.getIdeConfiguration(ide);
823
489
  if (ideConfig?.instructions) {
824
490
  console.log(
825
- chalk.bold(`To use BMad agents in ${ideConfig.name}:`)
491
+ chalk.bold(`To use BMAD agents in ${ideConfig.name}:`)
826
492
  );
827
493
  console.log(ideConfig.instructions);
828
494
  }
@@ -837,26 +503,7 @@ class Installer {
837
503
 
838
504
  // Information about installation components
839
505
  console.log(chalk.bold("\n🎯 Installation Summary:"));
840
- if (config.installType !== "expansion-only") {
841
- console.log(chalk.green("✓ .bmad-core framework installed with all agents and workflows"));
842
- }
843
-
844
- if (config.expansionPacks && config.expansionPacks.length > 0) {
845
- console.log(chalk.green(`✓ Expansion packs installed:`));
846
- for (const packId of config.expansionPacks) {
847
- console.log(chalk.green(` - ${packId} → .${packId}/`));
848
- }
849
- }
850
-
851
- if (config.includeWebBundles && config.webBundlesDirectory) {
852
- const bundleInfo = this.getWebBundleInfo(config);
853
- // Resolve the web bundles directory for display
854
- const originalCwd = process.env.INIT_CWD || process.env.PWD || process.cwd();
855
- const resolvedWebBundlesDir = path.isAbsolute(config.webBundlesDirectory)
856
- ? config.webBundlesDirectory
857
- : path.resolve(originalCwd, config.webBundlesDirectory);
858
- console.log(chalk.green(`✓ Web bundles (${bundleInfo}) installed to: ${resolvedWebBundlesDir}`));
859
- }
506
+ console.log(chalk.green("✓ .bmad-core framework installed with all agents and workflows"));
860
507
 
861
508
  if (ides.length > 0) {
862
509
  const ideNames = ides.map(ide => {
@@ -867,13 +514,11 @@ class Installer {
867
514
  }
868
515
 
869
516
  // Information about web bundles
870
- if (!config.includeWebBundles) {
871
- console.log(chalk.bold("\n📦 Web Bundles Available:"));
872
- console.log("Pre-built web bundles are available and can be added later:");
873
- console.log(chalk.cyan(" Run the installer again to add them to your project"));
874
- console.log("These bundles work independently and can be shared, moved, or used");
875
- console.log("in other projects as standalone files.");
876
- }
517
+ console.log(chalk.bold("\n📦 Web Bundles Available:"));
518
+ console.log("Self-contained web bundles have been included in your installation:");
519
+ console.log(chalk.cyan(` ${installDir}/.bmad-core/web-bundles/`));
520
+ console.log("These bundles work independently without this installation and can be");
521
+ console.log("shared, moved, or used in other projects as standalone files.");
877
522
 
878
523
  if (config.installType === "single-agent") {
879
524
  console.log(
@@ -885,12 +530,6 @@ class Installer {
885
530
  chalk.dim("Need everything? Run: npx bmad-method install --full")
886
531
  );
887
532
  }
888
-
889
- // Warning for Cursor custom modes if agents were updated
890
- if (options.isUpdate && ides.includes('cursor')) {
891
- console.log(chalk.yellow.bold("\n⚠️ IMPORTANT: Cursor Custom Modes Update Required"));
892
- console.log(chalk.yellow("Since agents have been updated, you need to update any custom agent modes configured in the Cursor custom agent GUI per the Cursor docs."));
893
- }
894
533
  }
895
534
 
896
535
  // Legacy method for backward compatibility
@@ -911,7 +550,7 @@ class Installer {
911
550
  };
912
551
  return await this.install(config);
913
552
  }
914
- console.log(chalk.red("No BMad installation found."));
553
+ console.log(chalk.red("No BMAD installation found."));
915
554
  }
916
555
 
917
556
  async listAgents() {
@@ -919,7 +558,7 @@ class Installer {
919
558
  await initializeModules();
920
559
  const agents = await configLoader.getAvailableAgents();
921
560
 
922
- console.log(chalk.bold("\nAvailable BMad Agents:\n"));
561
+ console.log(chalk.bold("\nAvailable BMAD Agents:\n"));
923
562
 
924
563
  for (const agent of agents) {
925
564
  console.log(chalk.cyan(` ${agent.id.padEnd(20)}`), agent.description);
@@ -930,33 +569,6 @@ class Installer {
930
569
  );
931
570
  }
932
571
 
933
- async listExpansionPacks() {
934
- // Initialize ES modules
935
- await initializeModules();
936
- const expansionPacks = await this.getAvailableExpansionPacks();
937
-
938
- console.log(chalk.bold("\nAvailable BMad Expansion Packs:\n"));
939
-
940
- if (expansionPacks.length === 0) {
941
- console.log(chalk.yellow("No expansion packs found."));
942
- return;
943
- }
944
-
945
- for (const pack of expansionPacks) {
946
- console.log(chalk.cyan(` ${pack.id.padEnd(20)}`),
947
- `${pack.name} v${pack.version}`);
948
- console.log(chalk.dim(` ${' '.repeat(22)}${pack.description}`));
949
- if (pack.author && pack.author !== 'Unknown') {
950
- console.log(chalk.dim(` ${' '.repeat(22)}by ${pack.author}`));
951
- }
952
- console.log();
953
- }
954
-
955
- console.log(
956
- chalk.dim("Install with: npx bmad-method install --full --expansion-packs <id>\n")
957
- );
958
- }
959
-
960
572
  async showStatus() {
961
573
  // Initialize ES modules
962
574
  await initializeModules();
@@ -964,7 +576,7 @@ class Installer {
964
576
 
965
577
  if (!installDir) {
966
578
  console.log(
967
- chalk.yellow("No BMad installation found in current directory tree")
579
+ chalk.yellow("No BMAD installation found in current directory tree")
968
580
  );
969
581
  return;
970
582
  }
@@ -976,7 +588,7 @@ class Installer {
976
588
  return;
977
589
  }
978
590
 
979
- console.log(chalk.bold("\nBMad Installation Status:\n"));
591
+ console.log(chalk.bold("\nBMAD Installation Status:\n"));
980
592
  console.log(` Directory: ${installDir}`);
981
593
  console.log(` Version: ${manifest.version}`);
982
594
  console.log(
@@ -990,8 +602,8 @@ class Installer {
990
602
  console.log(` Agent: ${manifest.agent}`);
991
603
  }
992
604
 
993
- if (manifest.ides_setup && manifest.ides_setup.length > 0) {
994
- console.log(` IDE Setup: ${manifest.ides_setup.join(', ')}`);
605
+ if (manifest.ide_setup) {
606
+ console.log(` IDE Setup: ${manifest.ide_setup}`);
995
607
  }
996
608
 
997
609
  console.log(` Total Files: ${manifest.files.length}`);
@@ -1012,706 +624,13 @@ class Installer {
1012
624
  return configLoader.getAvailableAgents();
1013
625
  }
1014
626
 
1015
- async getAvailableExpansionPacks() {
1016
- return configLoader.getAvailableExpansionPacks();
1017
- }
1018
-
1019
- async getAvailableTeams() {
1020
- return configLoader.getAvailableTeams();
1021
- }
1022
-
1023
- async installExpansionPacks(installDir, selectedPacks, spinner, config = {}) {
1024
- if (!selectedPacks || selectedPacks.length === 0) {
1025
- return [];
1026
- }
1027
-
1028
- const installedFiles = [];
1029
- const glob = require('glob');
1030
-
1031
- for (const packId of selectedPacks) {
1032
- spinner.text = `Installing expansion pack: ${packId}...`;
1033
-
1034
- try {
1035
- const expansionPacks = await this.getAvailableExpansionPacks();
1036
- const pack = expansionPacks.find(p => p.id === packId);
1037
-
1038
- if (!pack) {
1039
- console.warn(`Expansion pack ${packId} not found, skipping...`);
1040
- continue;
1041
- }
1042
-
1043
- // Check if expansion pack already exists
1044
- let expansionDotFolder = path.join(installDir, `.${packId}`);
1045
- const existingManifestPath = path.join(expansionDotFolder, 'install-manifest.yaml');
1046
-
1047
- if (await fileManager.pathExists(existingManifestPath)) {
1048
- spinner.stop();
1049
- const existingManifest = await fileManager.readExpansionPackManifest(installDir, packId);
1050
-
1051
- console.log(chalk.yellow(`\n🔍 Found existing ${pack.name} installation`));
1052
- console.log(` Current version: ${existingManifest.version || 'unknown'}`);
1053
- console.log(` New version: ${pack.version}`);
1054
-
1055
- // Check integrity of existing expansion pack
1056
- const packIntegrity = await fileManager.checkFileIntegrity(installDir, existingManifest);
1057
- const hasPackIntegrityIssues = packIntegrity.missing.length > 0 || packIntegrity.modified.length > 0;
1058
-
1059
- if (hasPackIntegrityIssues) {
1060
- console.log(chalk.red(" ⚠️ Installation issues detected:"));
1061
- if (packIntegrity.missing.length > 0) {
1062
- console.log(chalk.red(` Missing files: ${packIntegrity.missing.length}`));
1063
- }
1064
- if (packIntegrity.modified.length > 0) {
1065
- console.log(chalk.yellow(` Modified files: ${packIntegrity.modified.length}`));
1066
- }
1067
- }
1068
-
1069
- const versionCompare = this.compareVersions(existingManifest.version || '0.0.0', pack.version);
1070
-
1071
- if (versionCompare === 0) {
1072
- console.log(chalk.yellow(' ⚠️ Same version already installed'));
1073
-
1074
- const choices = [];
1075
- if (hasPackIntegrityIssues) {
1076
- choices.push({ name: 'Repair (restore missing/modified files)', value: 'repair' });
1077
- }
1078
- choices.push(
1079
- { name: 'Force reinstall (overwrite)', value: 'overwrite' },
1080
- { name: 'Skip this expansion pack', value: 'skip' },
1081
- { name: 'Cancel installation', value: 'cancel' }
1082
- );
1083
-
1084
- const { action } = await inquirer.prompt([{
1085
- type: 'list',
1086
- name: 'action',
1087
- message: `${pack.name} v${pack.version} is already installed. What would you like to do?`,
1088
- choices: choices
1089
- }]);
1090
-
1091
- if (action === 'skip') {
1092
- spinner.start();
1093
- continue;
1094
- } else if (action === 'cancel') {
1095
- console.log(chalk.red('Installation cancelled.'));
1096
- process.exit(0);
1097
- } else if (action === 'repair') {
1098
- // Repair the expansion pack
1099
- await this.repairExpansionPack(installDir, packId, pack, packIntegrity, spinner);
1100
- continue;
1101
- }
1102
- } else if (versionCompare < 0) {
1103
- console.log(chalk.cyan(' ⬆️ Upgrade available'));
1104
-
1105
- const { proceed } = await inquirer.prompt([{
1106
- type: 'confirm',
1107
- name: 'proceed',
1108
- message: `Upgrade ${pack.name} from v${existingManifest.version} to v${pack.version}?`,
1109
- default: true
1110
- }]);
1111
-
1112
- if (!proceed) {
1113
- spinner.start();
1114
- continue;
1115
- }
1116
- } else {
1117
- console.log(chalk.yellow(' ⬇️ Installed version is newer than available version'));
1118
-
1119
- const { action } = await inquirer.prompt([{
1120
- type: 'list',
1121
- name: 'action',
1122
- message: 'What would you like to do?',
1123
- choices: [
1124
- { name: 'Keep current version', value: 'skip' },
1125
- { name: 'Downgrade to available version', value: 'downgrade' },
1126
- { name: 'Cancel installation', value: 'cancel' }
1127
- ]
1128
- }]);
1129
-
1130
- if (action === 'skip') {
1131
- spinner.start();
1132
- continue;
1133
- } else if (action === 'cancel') {
1134
- console.log(chalk.red('Installation cancelled.'));
1135
- process.exit(0);
1136
- }
1137
- }
1138
-
1139
- // If we get here, we're proceeding with installation
1140
- spinner.start(`Removing old ${pack.name} installation...`);
1141
- await fileManager.removeDirectory(expansionDotFolder);
1142
- }
1143
-
1144
- const expansionPackDir = pack.packPath;
1145
-
1146
- // Ensure dedicated dot folder exists for this expansion pack
1147
- expansionDotFolder = path.join(installDir, `.${packId}`);
1148
- await fileManager.ensureDirectory(expansionDotFolder);
1149
-
1150
- // Define the folders to copy from expansion packs
1151
- const foldersToSync = [
1152
- 'agents',
1153
- 'agent-teams',
1154
- 'templates',
1155
- 'tasks',
1156
- 'checklists',
1157
- 'workflows',
1158
- 'data',
1159
- 'utils',
1160
- 'schemas'
1161
- ];
1162
-
1163
- // Copy each folder if it exists
1164
- for (const folder of foldersToSync) {
1165
- const sourceFolder = path.join(expansionPackDir, folder);
1166
-
1167
- // Check if folder exists in expansion pack
1168
- if (await fileManager.pathExists(sourceFolder)) {
1169
- // Get all files in this folder
1170
- const files = glob.sync('**/*', {
1171
- cwd: sourceFolder,
1172
- nodir: true
1173
- });
1174
-
1175
- // Copy each file to the expansion pack's dot folder
1176
- for (const file of files) {
1177
- const sourcePath = path.join(sourceFolder, file);
1178
- const destPath = path.join(expansionDotFolder, folder, file);
1179
-
1180
- if (await fileManager.copyFile(sourcePath, destPath)) {
1181
- installedFiles.push(path.join(`.${packId}`, folder, file));
1182
- }
1183
- }
1184
- }
1185
- }
1186
-
1187
- // Copy config.yaml
1188
- const configPath = path.join(expansionPackDir, 'config.yaml');
1189
- if (await fileManager.pathExists(configPath)) {
1190
- const configDestPath = path.join(expansionDotFolder, 'config.yaml');
1191
- if (await fileManager.copyFile(configPath, configDestPath)) {
1192
- installedFiles.push(path.join(`.${packId}`, 'config.yaml'));
1193
- }
1194
- }
1195
-
1196
- // Copy README if it exists
1197
- const readmePath = path.join(expansionPackDir, 'README.md');
1198
- if (await fileManager.pathExists(readmePath)) {
1199
- const readmeDestPath = path.join(expansionDotFolder, 'README.md');
1200
- if (await fileManager.copyFile(readmePath, readmeDestPath)) {
1201
- installedFiles.push(path.join(`.${packId}`, 'README.md'));
1202
- }
1203
- }
1204
-
1205
- // Copy common/ items to expansion pack folder
1206
- spinner.text = `Copying common utilities to ${packId}...`;
1207
- await this.copyCommonItems(installDir, `.${packId}`, spinner);
1208
-
1209
- // Check and resolve core dependencies
1210
- await this.resolveExpansionPackCoreDependencies(installDir, expansionDotFolder, packId, spinner);
1211
-
1212
- // Check and resolve core agents referenced by teams
1213
- await this.resolveExpansionPackCoreAgents(installDir, expansionDotFolder, packId, spinner);
1214
-
1215
- // Create manifest for this expansion pack
1216
- spinner.text = `Creating manifest for ${packId}...`;
1217
- const expansionConfig = {
1218
- installType: 'expansion-pack',
1219
- expansionPackId: packId,
1220
- expansionPackName: pack.name,
1221
- expansionPackVersion: pack.version,
1222
- ides: config.ides || [] // Use ides_setup instead of ide_setup
1223
- };
1224
-
1225
- // Get all files installed in this expansion pack
1226
- const expansionPackFiles = glob.sync('**/*', {
1227
- cwd: expansionDotFolder,
1228
- nodir: true
1229
- }).map(f => path.join(`.${packId}`, f));
1230
-
1231
- await fileManager.createExpansionPackManifest(installDir, packId, expansionConfig, expansionPackFiles);
1232
-
1233
- console.log(chalk.green(`✓ Installed expansion pack: ${pack.name} to ${`.${packId}`}`));
1234
- } catch (error) {
1235
- console.error(chalk.red(`Failed to install expansion pack ${packId}: ${error.message}`));
1236
- console.error(chalk.red(`Stack trace: ${error.stack}`));
1237
- }
1238
- }
1239
-
1240
- return installedFiles;
1241
- }
1242
-
1243
- async resolveExpansionPackCoreDependencies(installDir, expansionDotFolder, packId, spinner) {
1244
- const glob = require('glob');
1245
- const yaml = require('js-yaml');
1246
- const fs = require('fs').promises;
1247
-
1248
- // Find all agent files in the expansion pack
1249
- const agentFiles = glob.sync('agents/*.md', {
1250
- cwd: expansionDotFolder
1251
- });
1252
-
1253
- for (const agentFile of agentFiles) {
1254
- const agentPath = path.join(expansionDotFolder, agentFile);
1255
- const agentContent = await fs.readFile(agentPath, 'utf8');
1256
-
1257
- // Extract YAML frontmatter to check dependencies
1258
- const yamlContent = extractYamlFromAgent(agentContent);
1259
- if (yamlContent) {
1260
- try {
1261
- const agentConfig = yaml.parse(yamlContent);
1262
- const dependencies = agentConfig.dependencies || {};
1263
-
1264
- // Check for core dependencies (those that don't exist in the expansion pack)
1265
- for (const depType of ['tasks', 'templates', 'checklists', 'workflows', 'utils', 'data']) {
1266
- const deps = dependencies[depType] || [];
1267
-
1268
- for (const dep of deps) {
1269
- const depFileName = dep.endsWith('.md') ? dep : `${dep}.md`;
1270
- const expansionDepPath = path.join(expansionDotFolder, depType, depFileName);
1271
-
1272
- // Check if dependency exists in expansion pack
1273
- if (!(await fileManager.pathExists(expansionDepPath))) {
1274
- // Try to find it in core
1275
- const coreDepPath = path.join(configLoader.getBmadCorePath(), depType, depFileName);
1276
-
1277
- if (await fileManager.pathExists(coreDepPath)) {
1278
- spinner.text = `Copying core dependency ${dep} for ${packId}...`;
1279
-
1280
- // Copy from core to expansion pack dot folder
1281
- const destPath = path.join(expansionDotFolder, depType, depFileName);
1282
- await fileManager.copyFile(coreDepPath, destPath);
1283
-
1284
- console.log(chalk.dim(` Added core dependency: ${depType}/${depFileName}`));
1285
- } else {
1286
- console.warn(chalk.yellow(` Warning: Dependency ${depType}/${dep} not found in core or expansion pack`));
1287
- }
1288
- }
1289
- }
1290
- }
1291
- } catch (error) {
1292
- console.warn(chalk.yellow(` Warning: Could not parse agent dependencies: ${error.message}`));
1293
- }
1294
- }
1295
- }
1296
- }
1297
-
1298
- async resolveExpansionPackCoreAgents(installDir, expansionDotFolder, packId, spinner) {
1299
- const glob = require('glob');
1300
- const yaml = require('js-yaml');
1301
- const fs = require('fs').promises;
1302
-
1303
- // Find all team files in the expansion pack
1304
- const teamFiles = glob.sync('agent-teams/*.yaml', {
1305
- cwd: expansionDotFolder
1306
- });
1307
-
1308
- // Also get existing agents in the expansion pack
1309
- const existingAgents = new Set();
1310
- const agentFiles = glob.sync('agents/*.md', {
1311
- cwd: expansionDotFolder
1312
- });
1313
- for (const agentFile of agentFiles) {
1314
- const agentName = path.basename(agentFile, '.md');
1315
- existingAgents.add(agentName);
1316
- }
1317
-
1318
- // Process each team file
1319
- for (const teamFile of teamFiles) {
1320
- const teamPath = path.join(expansionDotFolder, teamFile);
1321
- const teamContent = await fs.readFile(teamPath, 'utf8');
1322
-
1323
- try {
1324
- const teamConfig = yaml.parse(teamContent);
1325
- const agents = teamConfig.agents || [];
1326
-
1327
- // Add bmad-orchestrator if not present (required for all teams)
1328
- if (!agents.includes('bmad-orchestrator')) {
1329
- agents.unshift('bmad-orchestrator');
1330
- }
1331
-
1332
- // Check each agent in the team
1333
- for (const agentId of agents) {
1334
- if (!existingAgents.has(agentId)) {
1335
- // Agent not in expansion pack, try to get from core
1336
- const coreAgentPath = path.join(configLoader.getBmadCorePath(), 'agents', `${agentId}.md`);
1337
-
1338
- if (await fileManager.pathExists(coreAgentPath)) {
1339
- spinner.text = `Copying core agent ${agentId} for ${packId}...`;
1340
-
1341
- // Copy agent file
1342
- const destPath = path.join(expansionDotFolder, 'agents', `${agentId}.md`);
1343
- await fileManager.copyFile(coreAgentPath, destPath);
1344
- existingAgents.add(agentId);
1345
-
1346
- console.log(chalk.dim(` Added core agent: ${agentId}`));
1347
-
1348
- // Now resolve this agent's dependencies too
1349
- const agentContent = await fs.readFile(coreAgentPath, 'utf8');
1350
- const yamlContent = extractYamlFromAgent(agentContent, true);
1351
-
1352
- if (yamlContent) {
1353
- try {
1354
-
1355
- const agentConfig = yaml.parse(yamlContent);
1356
- const dependencies = agentConfig.dependencies || {};
1357
-
1358
- // Copy all dependencies for this agent
1359
- for (const depType of ['tasks', 'templates', 'checklists', 'workflows', 'utils', 'data']) {
1360
- const deps = dependencies[depType] || [];
1361
-
1362
- for (const dep of deps) {
1363
- const depFileName = dep.endsWith('.md') || dep.endsWith('.yaml') ? dep : `${dep}.md`;
1364
- const expansionDepPath = path.join(expansionDotFolder, depType, depFileName);
1365
-
1366
- // Check if dependency exists in expansion pack
1367
- if (!(await fileManager.pathExists(expansionDepPath))) {
1368
- // Try to find it in core
1369
- const coreDepPath = path.join(configLoader.getBmadCorePath(), depType, depFileName);
1370
-
1371
- if (await fileManager.pathExists(coreDepPath)) {
1372
- const destDepPath = path.join(expansionDotFolder, depType, depFileName);
1373
- await fileManager.copyFile(coreDepPath, destDepPath);
1374
- console.log(chalk.dim(` Added agent dependency: ${depType}/${depFileName}`));
1375
- } else {
1376
- // Try common folder
1377
- const sourceBase = path.dirname(path.dirname(path.dirname(path.dirname(__filename)))); // Go up to project root
1378
- const commonDepPath = path.join(sourceBase, 'common', depType, depFileName);
1379
- if (await fileManager.pathExists(commonDepPath)) {
1380
- const destDepPath = path.join(expansionDotFolder, depType, depFileName);
1381
- await fileManager.copyFile(commonDepPath, destDepPath);
1382
- console.log(chalk.dim(` Added agent dependency from common: ${depType}/${depFileName}`));
1383
- }
1384
- }
1385
- }
1386
- }
1387
- }
1388
- } catch (error) {
1389
- console.warn(chalk.yellow(` Warning: Could not parse agent ${agentId} dependencies: ${error.message}`));
1390
- }
1391
- }
1392
- } else {
1393
- console.warn(chalk.yellow(` Warning: Core agent ${agentId} not found for team ${path.basename(teamFile, '.yaml')}`));
1394
- }
1395
- }
1396
- }
1397
- } catch (error) {
1398
- console.warn(chalk.yellow(` Warning: Could not parse team file ${teamFile}: ${error.message}`));
1399
- }
1400
- }
1401
- }
1402
-
1403
- getWebBundleInfo(config) {
1404
- const webBundleType = config.webBundleType || 'all';
1405
-
1406
- switch (webBundleType) {
1407
- case 'all':
1408
- return 'all bundles';
1409
- case 'agents':
1410
- return 'individual agents only';
1411
- case 'teams':
1412
- return config.selectedWebBundleTeams ?
1413
- `teams: ${config.selectedWebBundleTeams.join(', ')}` :
1414
- 'selected teams';
1415
- case 'custom':
1416
- const parts = [];
1417
- if (config.selectedWebBundleTeams && config.selectedWebBundleTeams.length > 0) {
1418
- parts.push(`teams: ${config.selectedWebBundleTeams.join(', ')}`);
1419
- }
1420
- if (config.includeIndividualAgents) {
1421
- parts.push('individual agents');
1422
- }
1423
- return parts.length > 0 ? parts.join(' + ') : 'custom selection';
1424
- default:
1425
- return 'selected bundles';
1426
- }
1427
- }
1428
-
1429
- async installWebBundles(webBundlesDirectory, config, spinner) {
1430
- // Ensure modules are initialized
1431
- await initializeModules();
1432
-
1433
- try {
1434
- // Find the dist directory in the BMad installation
1435
- const distDir = configLoader.getDistPath();
1436
-
1437
- if (!(await fileManager.pathExists(distDir))) {
1438
- console.warn(chalk.yellow('Web bundles not found. Run "npm run build" to generate them.'));
1439
- return;
1440
- }
1441
-
1442
- // Ensure web bundles directory exists
1443
- await fileManager.ensureDirectory(webBundlesDirectory);
1444
-
1445
- const webBundleType = config.webBundleType || 'all';
1446
-
1447
- if (webBundleType === 'all') {
1448
- // Copy the entire dist directory structure
1449
- await fileManager.copyDirectory(distDir, webBundlesDirectory);
1450
- console.log(chalk.green(`✓ Installed all web bundles to: ${webBundlesDirectory}`));
1451
- } else {
1452
- let copiedCount = 0;
1453
-
1454
- // Copy specific selections based on type
1455
- if (webBundleType === 'agents' || (webBundleType === 'custom' && config.includeIndividualAgents)) {
1456
- const agentsSource = path.join(distDir, 'agents');
1457
- const agentsTarget = path.join(webBundlesDirectory, 'agents');
1458
- if (await fileManager.pathExists(agentsSource)) {
1459
- await fileManager.copyDirectory(agentsSource, agentsTarget);
1460
- console.log(chalk.green(`✓ Copied individual agent bundles`));
1461
- copiedCount += 10; // Approximate count for agents
1462
- }
1463
- }
1464
-
1465
- if (webBundleType === 'teams' || webBundleType === 'custom') {
1466
- if (config.selectedWebBundleTeams && config.selectedWebBundleTeams.length > 0) {
1467
- const teamsSource = path.join(distDir, 'teams');
1468
- const teamsTarget = path.join(webBundlesDirectory, 'teams');
1469
- await fileManager.ensureDirectory(teamsTarget);
1470
-
1471
- for (const teamId of config.selectedWebBundleTeams) {
1472
- const teamFile = `${teamId}.txt`;
1473
- const sourcePath = path.join(teamsSource, teamFile);
1474
- const targetPath = path.join(teamsTarget, teamFile);
1475
-
1476
- if (await fileManager.pathExists(sourcePath)) {
1477
- await fileManager.copyFile(sourcePath, targetPath);
1478
- copiedCount++;
1479
- console.log(chalk.green(`✓ Copied team bundle: ${teamId}`));
1480
- }
1481
- }
1482
- }
1483
- }
1484
-
1485
- // Always copy expansion packs if they exist
1486
- const expansionSource = path.join(distDir, 'expansion-packs');
1487
- const expansionTarget = path.join(webBundlesDirectory, 'expansion-packs');
1488
- if (await fileManager.pathExists(expansionSource)) {
1489
- await fileManager.copyDirectory(expansionSource, expansionTarget);
1490
- console.log(chalk.green(`✓ Copied expansion pack bundles`));
1491
- }
1492
-
1493
- console.log(chalk.green(`✓ Installed ${copiedCount} selected web bundles to: ${webBundlesDirectory}`));
1494
- }
1495
- } catch (error) {
1496
- console.error(chalk.red(`Failed to install web bundles: ${error.message}`));
1497
- }
1498
- }
1499
-
1500
- async copyCommonItems(installDir, targetSubdir, spinner) {
1501
- // Ensure modules are initialized
1502
- await initializeModules();
1503
-
1504
- const glob = require('glob');
1505
- const fs = require('fs').promises;
1506
- const sourceBase = path.dirname(path.dirname(path.dirname(path.dirname(__filename)))); // Go up to project root
1507
- const commonPath = path.join(sourceBase, 'common');
1508
- const targetPath = path.join(installDir, targetSubdir);
1509
- const copiedFiles = [];
1510
-
1511
- // Check if common/ exists
1512
- if (!(await fileManager.pathExists(commonPath))) {
1513
- console.warn(chalk.yellow('Warning: common/ folder not found'));
1514
- return copiedFiles;
1515
- }
1516
-
1517
- // Copy all items from common/ to target
1518
- const commonItems = glob.sync('**/*', {
1519
- cwd: commonPath,
1520
- nodir: true
1521
- });
1522
-
1523
- for (const item of commonItems) {
1524
- const sourcePath = path.join(commonPath, item);
1525
- const destPath = path.join(targetPath, item);
1526
-
1527
- // Read the file content
1528
- const content = await fs.readFile(sourcePath, 'utf8');
1529
-
1530
- // Replace {root} with the target subdirectory
1531
- const updatedContent = content.replace(/\{root\}/g, targetSubdir);
1532
-
1533
- // Ensure directory exists
1534
- await fileManager.ensureDirectory(path.dirname(destPath));
1535
-
1536
- // Write the updated content
1537
- await fs.writeFile(destPath, updatedContent, 'utf8');
1538
- copiedFiles.push(path.join(targetSubdir, item));
1539
- }
1540
-
1541
- console.log(chalk.dim(` Added ${commonItems.length} common utilities`));
1542
- return copiedFiles;
1543
- }
1544
-
1545
- async detectExpansionPacks(installDir) {
1546
- const expansionPacks = {};
1547
- const glob = require("glob");
1548
-
1549
- // Find all dot folders that might be expansion packs
1550
- const dotFolders = glob.sync(".*", {
1551
- cwd: installDir,
1552
- ignore: [".git", ".git/**", ".bmad-core", ".bmad-core/**"],
1553
- });
1554
-
1555
- for (const folder of dotFolders) {
1556
- const folderPath = path.join(installDir, folder);
1557
- const stats = await fileManager.pathExists(folderPath);
1558
-
1559
- if (stats) {
1560
- // Check if it has a manifest
1561
- const manifestPath = path.join(folderPath, "install-manifest.yaml");
1562
- if (await fileManager.pathExists(manifestPath)) {
1563
- const manifest = await fileManager.readExpansionPackManifest(installDir, folder.substring(1));
1564
- if (manifest) {
1565
- expansionPacks[folder.substring(1)] = {
1566
- path: folderPath,
1567
- manifest: manifest,
1568
- hasManifest: true
1569
- };
1570
- }
1571
- } else {
1572
- // Check if it has a config.yaml (expansion pack without manifest)
1573
- const configPath = path.join(folderPath, "config.yaml");
1574
- if (await fileManager.pathExists(configPath)) {
1575
- expansionPacks[folder.substring(1)] = {
1576
- path: folderPath,
1577
- manifest: null,
1578
- hasManifest: false
1579
- };
1580
- }
1581
- }
1582
- }
1583
- }
1584
-
1585
- return expansionPacks;
1586
- }
1587
-
1588
- async repairExpansionPack(installDir, packId, pack, integrity, spinner) {
1589
- spinner.start(`Repairing ${pack.name}...`);
1590
-
1591
- try {
1592
- const expansionDotFolder = path.join(installDir, `.${packId}`);
1593
-
1594
- // Back up modified files
1595
- if (integrity.modified.length > 0) {
1596
- spinner.text = "Backing up modified files...";
1597
- for (const file of integrity.modified) {
1598
- const filePath = path.join(installDir, file);
1599
- if (await fileManager.pathExists(filePath)) {
1600
- const backupPath = await fileManager.backupFile(filePath);
1601
- console.log(chalk.dim(` Backed up: ${file} → ${path.basename(backupPath)}`));
1602
- }
1603
- }
1604
- }
1605
-
1606
- // Restore missing and modified files
1607
- spinner.text = "Restoring files...";
1608
- const filesToRestore = [...integrity.missing, ...integrity.modified];
1609
-
1610
- for (const file of filesToRestore) {
1611
- // Skip the manifest file itself
1612
- if (file.endsWith('install-manifest.yaml')) continue;
1613
-
1614
- const relativePath = file.replace(`.${packId}/`, '');
1615
- const sourcePath = path.join(pack.packPath, relativePath);
1616
- const destPath = path.join(installDir, file);
1617
-
1618
- // Check if this is a common/ file that needs special processing
1619
- const commonBase = path.dirname(path.dirname(path.dirname(path.dirname(__filename))));
1620
- const commonSourcePath = path.join(commonBase, 'common', relativePath);
1621
-
1622
- if (await fileManager.pathExists(commonSourcePath)) {
1623
- // This is a common/ file - needs template processing
1624
- const fs = require('fs').promises;
1625
- const content = await fs.readFile(commonSourcePath, 'utf8');
1626
- const updatedContent = content.replace(/\{root\}/g, `.${packId}`);
1627
- await fileManager.ensureDirectory(path.dirname(destPath));
1628
- await fs.writeFile(destPath, updatedContent, 'utf8');
1629
- spinner.text = `Restored: ${file}`;
1630
- } else if (await fileManager.pathExists(sourcePath)) {
1631
- // Regular file from expansion pack
1632
- await fileManager.copyFile(sourcePath, destPath);
1633
- spinner.text = `Restored: ${file}`;
1634
- } else {
1635
- console.warn(chalk.yellow(` Warning: Source file not found: ${file}`));
1636
- }
1637
- }
1638
-
1639
- spinner.succeed(`${pack.name} repaired successfully!`);
1640
-
1641
- // Show summary
1642
- console.log(chalk.green(`\n✓ ${pack.name} repaired!`));
1643
- if (integrity.missing.length > 0) {
1644
- console.log(chalk.green(` Restored ${integrity.missing.length} missing files`));
1645
- }
1646
- if (integrity.modified.length > 0) {
1647
- console.log(chalk.green(` Restored ${integrity.modified.length} modified files (backups created)`));
1648
- }
1649
-
1650
- } catch (error) {
1651
- spinner.fail(`Failed to repair ${pack.name}`);
1652
- console.error(chalk.red(`Error: ${error.message}`));
1653
- }
1654
- }
1655
-
1656
- compareVersions(v1, v2) {
1657
- // Simple semver comparison
1658
- const parts1 = v1.split('.').map(Number);
1659
- const parts2 = v2.split('.').map(Number);
1660
-
1661
- for (let i = 0; i < 3; i++) {
1662
- const part1 = parts1[i] || 0;
1663
- const part2 = parts2[i] || 0;
1664
-
1665
- if (part1 > part2) return 1;
1666
- if (part1 < part2) return -1;
1667
- }
1668
-
1669
- return 0;
1670
- }
1671
-
1672
- async cleanupLegacyYmlFiles(installDir, spinner) {
1673
- const glob = require('glob');
1674
- const fs = require('fs').promises;
1675
-
1676
- try {
1677
- // Find all .yml files in the installation directory
1678
- const ymlFiles = glob.sync('**/*.yml', {
1679
- cwd: installDir,
1680
- ignore: ['**/node_modules/**', '**/.git/**']
1681
- });
1682
-
1683
- let deletedCount = 0;
1684
-
1685
- for (const ymlFile of ymlFiles) {
1686
- // Check if corresponding .yaml file exists
1687
- const yamlFile = ymlFile.replace(/\.yml$/, '.yaml');
1688
- const ymlPath = path.join(installDir, ymlFile);
1689
- const yamlPath = path.join(installDir, yamlFile);
1690
-
1691
- if (await fileManager.pathExists(yamlPath)) {
1692
- // .yaml counterpart exists, delete the .yml file
1693
- await fs.unlink(ymlPath);
1694
- deletedCount++;
1695
- console.log(chalk.dim(` Removed legacy: ${ymlFile} (replaced by ${yamlFile})`));
1696
- }
1697
- }
1698
-
1699
- if (deletedCount > 0) {
1700
- console.log(chalk.green(`✓ Cleaned up ${deletedCount} legacy .yml files`));
1701
- }
1702
-
1703
- } catch (error) {
1704
- console.warn(chalk.yellow(`Warning: Could not cleanup legacy .yml files: ${error.message}`));
1705
- }
1706
- }
1707
-
1708
627
  async findInstallation() {
1709
628
  // Look for .bmad-core in current directory or parent directories
1710
629
  let currentDir = process.cwd();
1711
630
 
1712
631
  while (currentDir !== path.dirname(currentDir)) {
1713
632
  const bmadDir = path.join(currentDir, ".bmad-core");
1714
- const manifestPath = path.join(bmadDir, "install-manifest.yaml");
633
+ const manifestPath = path.join(bmadDir, "install-manifest.yml");
1715
634
 
1716
635
  if (await fileManager.pathExists(manifestPath)) {
1717
636
  return bmadDir;
@@ -1722,7 +641,7 @@ class Installer {
1722
641
 
1723
642
  // Also check if we're inside a .bmad-core directory
1724
643
  if (path.basename(process.cwd()) === ".bmad-core") {
1725
- const manifestPath = path.join(process.cwd(), "install-manifest.yaml");
644
+ const manifestPath = path.join(process.cwd(), "install-manifest.yml");
1726
645
  if (await fileManager.pathExists(manifestPath)) {
1727
646
  return process.cwd();
1728
647
  }