bmad-method 4.37.0-beta.5 → 4.37.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 (206) hide show
  1. package/.github/FUNDING.yaml +15 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
  4. package/.github/workflows/discord.yaml +16 -0
  5. package/.github/workflows/release.yaml +60 -0
  6. package/.releaserc.json +21 -0
  7. package/.vscode/settings.json +44 -0
  8. package/CHANGELOG.md +707 -0
  9. package/CONTRIBUTING.md +209 -0
  10. package/LICENSE +21 -0
  11. package/README.md +214 -3
  12. package/bmad-core/agent-teams/team-all.yaml +14 -0
  13. package/bmad-core/agent-teams/team-fullstack.yaml +18 -0
  14. package/bmad-core/agent-teams/team-ide-minimal.yaml +10 -0
  15. package/bmad-core/agent-teams/team-no-ui.yaml +13 -0
  16. package/bmad-core/agents/analyst.md +81 -0
  17. package/bmad-core/agents/architect.md +83 -0
  18. package/bmad-core/agents/bmad-master.md +107 -0
  19. package/bmad-core/agents/bmad-orchestrator.md +149 -0
  20. package/bmad-core/agents/dev.md +75 -0
  21. package/bmad-core/agents/pm.md +81 -0
  22. package/bmad-core/agents/po.md +76 -0
  23. package/bmad-core/agents/qa.md +69 -0
  24. package/bmad-core/agents/sm.md +62 -0
  25. package/bmad-core/agents/ux-expert.md +66 -0
  26. package/bmad-core/checklists/architect-checklist.md +438 -0
  27. package/bmad-core/checklists/change-checklist.md +182 -0
  28. package/bmad-core/checklists/pm-checklist.md +370 -0
  29. package/bmad-core/checklists/po-master-checklist.md +432 -0
  30. package/bmad-core/checklists/story-dod-checklist.md +94 -0
  31. package/bmad-core/checklists/story-draft-checklist.md +153 -0
  32. package/bmad-core/core-config.yaml +20 -0
  33. package/bmad-core/data/bmad-kb.md +806 -0
  34. package/bmad-core/data/brainstorming-techniques.md +36 -0
  35. package/bmad-core/data/elicitation-methods.md +154 -0
  36. package/bmad-core/data/technical-preferences.md +3 -0
  37. package/bmad-core/tasks/advanced-elicitation.md +117 -0
  38. package/bmad-core/tasks/brownfield-create-epic.md +160 -0
  39. package/bmad-core/tasks/brownfield-create-story.md +147 -0
  40. package/bmad-core/tasks/correct-course.md +70 -0
  41. package/bmad-core/tasks/create-brownfield-story.md +312 -0
  42. package/bmad-core/tasks/create-deep-research-prompt.md +278 -0
  43. package/bmad-core/tasks/create-next-story.md +112 -0
  44. package/bmad-core/tasks/document-project.md +343 -0
  45. package/bmad-core/tasks/facilitate-brainstorming-session.md +136 -0
  46. package/bmad-core/tasks/generate-ai-frontend-prompt.md +51 -0
  47. package/bmad-core/tasks/index-docs.md +173 -0
  48. package/bmad-core/tasks/kb-mode-interaction.md +75 -0
  49. package/bmad-core/tasks/review-story.md +154 -0
  50. package/bmad-core/tasks/shard-doc.md +185 -0
  51. package/bmad-core/tasks/validate-next-story.md +134 -0
  52. package/bmad-core/templates/architecture-tmpl.yaml +650 -0
  53. package/bmad-core/templates/brainstorming-output-tmpl.yaml +156 -0
  54. package/bmad-core/templates/brownfield-architecture-tmpl.yaml +476 -0
  55. package/bmad-core/templates/brownfield-prd-tmpl.yaml +280 -0
  56. package/bmad-core/templates/competitor-analysis-tmpl.yaml +293 -0
  57. package/bmad-core/templates/front-end-architecture-tmpl.yaml +206 -0
  58. package/bmad-core/templates/front-end-spec-tmpl.yaml +349 -0
  59. package/bmad-core/templates/fullstack-architecture-tmpl.yaml +805 -0
  60. package/bmad-core/templates/market-research-tmpl.yaml +252 -0
  61. package/bmad-core/templates/prd-tmpl.yaml +202 -0
  62. package/bmad-core/templates/project-brief-tmpl.yaml +221 -0
  63. package/bmad-core/templates/story-tmpl.yaml +137 -0
  64. package/bmad-core/workflows/brownfield-fullstack.yaml +297 -0
  65. package/bmad-core/workflows/brownfield-service.yaml +187 -0
  66. package/bmad-core/workflows/brownfield-ui.yaml +197 -0
  67. package/bmad-core/workflows/greenfield-fullstack.yaml +240 -0
  68. package/bmad-core/workflows/greenfield-service.yaml +206 -0
  69. package/bmad-core/workflows/greenfield-ui.yaml +235 -0
  70. package/common/tasks/create-doc.md +101 -0
  71. package/common/tasks/execute-checklist.md +86 -0
  72. package/common/utils/bmad-doc-template.md +325 -0
  73. package/common/utils/workflow-management.md +69 -0
  74. package/dist/agents/analyst.txt +2882 -0
  75. package/dist/agents/architect.txt +3543 -0
  76. package/dist/agents/bmad-master.txt +8756 -0
  77. package/dist/agents/bmad-orchestrator.txt +1490 -0
  78. package/dist/agents/dev.txt +428 -0
  79. package/dist/agents/pm.txt +2229 -0
  80. package/dist/agents/po.txt +1364 -0
  81. package/dist/agents/qa.txt +386 -0
  82. package/dist/agents/sm.txt +668 -0
  83. package/dist/agents/ux-expert.txt +701 -0
  84. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.txt +2408 -0
  85. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.txt +1631 -0
  86. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.txt +822 -0
  87. package/dist/expansion-packs/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +10989 -0
  88. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-architect.txt +4047 -0
  89. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-designer.txt +3744 -0
  90. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-developer.txt +465 -0
  91. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-sm.txt +990 -0
  92. package/dist/expansion-packs/bmad-2d-unity-game-dev/teams/unity-2d-game-team.txt +15467 -0
  93. package/dist/expansion-packs/bmad-infrastructure-devops/agents/infra-devops-platform.txt +2077 -0
  94. package/dist/teams/team-all.txt +11062 -0
  95. package/dist/teams/team-fullstack.txt +10392 -0
  96. package/dist/teams/team-ide-minimal.txt +3507 -0
  97. package/dist/teams/team-no-ui.txt +8951 -0
  98. package/docs/GUIDING-PRINCIPLES.md +91 -0
  99. package/docs/core-architecture.md +219 -0
  100. package/docs/enhanced-ide-development-workflow.md +43 -0
  101. package/docs/expansion-packs.md +280 -0
  102. package/docs/how-to-contribute-with-pull-requests.md +158 -0
  103. package/docs/user-guide.md +251 -0
  104. package/docs/versioning-and-releases.md +77 -0
  105. package/docs/versions.md +48 -0
  106. package/docs/working-in-the-brownfield.md +364 -0
  107. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/Complete AI Agent System - Flowchart.svg +102 -0
  108. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.1 Google Cloud Project Setup/1.1.1 - Initial Project Configuration - bash copy.txt +13 -0
  109. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.1 Google Cloud Project Setup/1.1.1 - Initial Project Configuration - bash.txt +13 -0
  110. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.2 Agent Development Kit Installation/1.2.2 - Basic Project Structure - txt.txt +25 -0
  111. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.3 Core Configuration Files/1.3.1 - settings.py +34 -0
  112. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.3 Core Configuration Files/1.3.2 - main.py - Base Application.py +70 -0
  113. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.4 Deployment Configuration/1.4.2 - cloudbuild.yaml +26 -0
  114. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/README.md +109 -0
  115. package/expansion-packs/README.md +3 -0
  116. package/expansion-packs/bmad-2d-phaser-game-dev/agent-teams/phaser-2d-nodejs-game-team.yaml +13 -0
  117. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.md +71 -0
  118. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.md +78 -0
  119. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.md +64 -0
  120. package/expansion-packs/bmad-2d-phaser-game-dev/checklists/game-design-checklist.md +201 -0
  121. package/expansion-packs/bmad-2d-phaser-game-dev/checklists/game-story-dod-checklist.md +160 -0
  122. package/expansion-packs/bmad-2d-phaser-game-dev/config.yaml +8 -0
  123. package/expansion-packs/bmad-2d-phaser-game-dev/data/bmad-kb.md +250 -0
  124. package/expansion-packs/bmad-2d-phaser-game-dev/data/development-guidelines.md +649 -0
  125. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/advanced-elicitation.md +110 -0
  126. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/create-game-story.md +216 -0
  127. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/game-design-brainstorming.md +290 -0
  128. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-architecture-tmpl.yaml +613 -0
  129. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-brief-tmpl.yaml +356 -0
  130. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-design-doc-tmpl.yaml +343 -0
  131. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-story-tmpl.yaml +253 -0
  132. package/expansion-packs/bmad-2d-phaser-game-dev/templates/level-design-doc-tmpl.yaml +484 -0
  133. package/expansion-packs/bmad-2d-phaser-game-dev/workflows/game-dev-greenfield.yaml +183 -0
  134. package/expansion-packs/bmad-2d-phaser-game-dev/workflows/game-prototype.yaml +175 -0
  135. package/expansion-packs/bmad-2d-unity-game-dev/agent-teams/unity-2d-game-team.yaml +14 -0
  136. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-architect.md +80 -0
  137. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-designer.md +77 -0
  138. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-developer.md +78 -0
  139. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-sm.md +65 -0
  140. package/expansion-packs/bmad-2d-unity-game-dev/checklists/game-architect-checklist.md +391 -0
  141. package/expansion-packs/bmad-2d-unity-game-dev/checklists/game-change-checklist.md +203 -0
  142. package/expansion-packs/bmad-2d-unity-game-dev/checklists/game-design-checklist.md +201 -0
  143. package/expansion-packs/bmad-2d-unity-game-dev/checklists/game-story-dod-checklist.md +124 -0
  144. package/expansion-packs/bmad-2d-unity-game-dev/config.yaml +6 -0
  145. package/expansion-packs/bmad-2d-unity-game-dev/data/bmad-kb.md +769 -0
  146. package/expansion-packs/bmad-2d-unity-game-dev/data/development-guidelines.md +586 -0
  147. package/expansion-packs/bmad-2d-unity-game-dev/tasks/advanced-elicitation.md +110 -0
  148. package/expansion-packs/bmad-2d-unity-game-dev/tasks/correct-course-game.md +141 -0
  149. package/expansion-packs/bmad-2d-unity-game-dev/tasks/create-game-story.md +184 -0
  150. package/expansion-packs/bmad-2d-unity-game-dev/tasks/game-design-brainstorming.md +290 -0
  151. package/expansion-packs/bmad-2d-unity-game-dev/tasks/validate-game-story.md +200 -0
  152. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-architecture-tmpl.yaml +1030 -0
  153. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-brief-tmpl.yaml +356 -0
  154. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-design-doc-tmpl.yaml +705 -0
  155. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-story-tmpl.yaml +256 -0
  156. package/expansion-packs/bmad-2d-unity-game-dev/templates/level-design-doc-tmpl.yaml +484 -0
  157. package/expansion-packs/bmad-2d-unity-game-dev/workflows/game-dev-greenfield.yaml +183 -0
  158. package/expansion-packs/bmad-2d-unity-game-dev/workflows/game-prototype.yaml +175 -0
  159. package/expansion-packs/bmad-infrastructure-devops/README.md +147 -0
  160. package/expansion-packs/bmad-infrastructure-devops/agents/infra-devops-platform.md +71 -0
  161. package/expansion-packs/bmad-infrastructure-devops/checklists/infrastructure-checklist.md +484 -0
  162. package/expansion-packs/bmad-infrastructure-devops/config.yaml +9 -0
  163. package/expansion-packs/bmad-infrastructure-devops/data/bmad-kb.md +305 -0
  164. package/expansion-packs/bmad-infrastructure-devops/tasks/review-infrastructure.md +159 -0
  165. package/expansion-packs/bmad-infrastructure-devops/tasks/validate-infrastructure.md +153 -0
  166. package/expansion-packs/bmad-infrastructure-devops/templates/infrastructure-architecture-tmpl.yaml +424 -0
  167. package/expansion-packs/bmad-infrastructure-devops/templates/infrastructure-platform-from-arch-tmpl.yaml +629 -0
  168. package/package.json +62 -24
  169. package/tools/bmad-npx-wrapper.js +39 -0
  170. package/tools/builders/web-builder.js +681 -0
  171. package/tools/bump-all-versions.js +106 -0
  172. package/tools/bump-expansion-version.js +83 -0
  173. package/tools/cli.js +154 -0
  174. package/tools/flattener/aggregate.js +76 -0
  175. package/tools/flattener/binary.js +53 -0
  176. package/tools/flattener/discovery.js +70 -0
  177. package/tools/flattener/files.js +35 -0
  178. package/tools/flattener/ignoreRules.js +176 -0
  179. package/tools/flattener/main.js +217 -0
  180. package/tools/flattener/projectRoot.js +45 -0
  181. package/tools/flattener/prompts.js +44 -0
  182. package/tools/flattener/stats.js +30 -0
  183. package/tools/flattener/xml.js +86 -0
  184. package/tools/installer/README.md +8 -0
  185. package/tools/installer/package.json +44 -0
  186. package/tools/lib/dependency-resolver.js +179 -0
  187. package/tools/lib/yaml-utils.js +29 -0
  188. package/tools/md-assets/web-agent-startup-instructions.md +39 -0
  189. package/tools/semantic-release-sync-installer.js +30 -0
  190. package/tools/shared/bannerArt.js +105 -0
  191. package/tools/sync-installer-version.js +34 -0
  192. package/tools/update-expansion-version.js +54 -0
  193. package/tools/upgraders/v3-to-v4-upgrader.js +763 -0
  194. package/tools/version-bump.js +79 -0
  195. package/tools/yaml-format.js +240 -0
  196. /package/{bin → tools/installer/bin}/bmad.js +0 -0
  197. /package/{config → tools/installer/config}/ide-agent-config.yaml +0 -0
  198. /package/{config → tools/installer/config}/install.config.yaml +0 -0
  199. /package/{lib → tools/installer/lib}/config-loader.js +0 -0
  200. /package/{lib → tools/installer/lib}/file-manager.js +0 -0
  201. /package/{lib → tools/installer/lib}/ide-base-setup.js +0 -0
  202. /package/{lib → tools/installer/lib}/ide-setup.js +0 -0
  203. /package/{lib → tools/installer/lib}/installer.js +0 -0
  204. /package/{lib → tools/installer/lib}/memory-profiler.js +0 -0
  205. /package/{lib → tools/installer/lib}/module-manager.js +0 -0
  206. /package/{lib → tools/installer/lib}/resource-locator.js +0 -0
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const yaml = require('js-yaml');
6
+
7
+ const args = process.argv.slice(2);
8
+ const bumpType = args[0] || 'minor'; // default to minor
9
+
10
+ if (!['major', 'minor', 'patch'].includes(bumpType)) {
11
+ console.log('Usage: node bump-all-versions.js [major|minor|patch]');
12
+ console.log('Default: minor');
13
+ process.exit(1);
14
+ }
15
+
16
+ function bumpVersion(currentVersion, type) {
17
+ const [major, minor, patch] = currentVersion.split('.').map(Number);
18
+
19
+ switch (type) {
20
+ case 'major':
21
+ return `${major + 1}.0.0`;
22
+ case 'minor':
23
+ return `${major}.${minor + 1}.0`;
24
+ case 'patch':
25
+ return `${major}.${minor}.${patch + 1}`;
26
+ default:
27
+ return currentVersion;
28
+ }
29
+ }
30
+
31
+ async function bumpAllVersions() {
32
+ const updatedItems = [];
33
+
34
+ // First, bump the core version (package.json)
35
+ const packagePath = path.join(__dirname, '..', 'package.json');
36
+ try {
37
+ const packageContent = fs.readFileSync(packagePath, 'utf8');
38
+ const packageJson = JSON.parse(packageContent);
39
+ const oldCoreVersion = packageJson.version || '1.0.0';
40
+ const newCoreVersion = bumpVersion(oldCoreVersion, bumpType);
41
+
42
+ packageJson.version = newCoreVersion;
43
+
44
+ fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n');
45
+
46
+ updatedItems.push({ type: 'core', name: 'BMad Core', oldVersion: oldCoreVersion, newVersion: newCoreVersion });
47
+ console.log(`✓ BMad Core (package.json): ${oldCoreVersion} → ${newCoreVersion}`);
48
+ } catch (error) {
49
+ console.error(`✗ Failed to update BMad Core: ${error.message}`);
50
+ }
51
+
52
+ // Then, bump all expansion packs
53
+ const expansionPacksDir = path.join(__dirname, '..', 'expansion-packs');
54
+
55
+ try {
56
+ const entries = fs.readdirSync(expansionPacksDir, { withFileTypes: true });
57
+
58
+ for (const entry of entries) {
59
+ if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'README.md') {
60
+ const packId = entry.name;
61
+ const configPath = path.join(expansionPacksDir, packId, 'config.yaml');
62
+
63
+ if (fs.existsSync(configPath)) {
64
+ try {
65
+ const configContent = fs.readFileSync(configPath, 'utf8');
66
+ const config = yaml.load(configContent);
67
+ const oldVersion = config.version || '1.0.0';
68
+ const newVersion = bumpVersion(oldVersion, bumpType);
69
+
70
+ config.version = newVersion;
71
+
72
+ const updatedYaml = yaml.dump(config, { indent: 2 });
73
+ fs.writeFileSync(configPath, updatedYaml);
74
+
75
+ updatedItems.push({ type: 'expansion', name: packId, oldVersion, newVersion });
76
+ console.log(`✓ ${packId}: ${oldVersion} → ${newVersion}`);
77
+
78
+ } catch (error) {
79
+ console.error(`✗ Failed to update ${packId}: ${error.message}`);
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ if (updatedItems.length > 0) {
86
+ const coreCount = updatedItems.filter(i => i.type === 'core').length;
87
+ const expansionCount = updatedItems.filter(i => i.type === 'expansion').length;
88
+
89
+ console.log(`\n✓ Successfully bumped ${updatedItems.length} item(s) with ${bumpType} version bump`);
90
+ if (coreCount > 0) console.log(` - ${coreCount} core`);
91
+ if (expansionCount > 0) console.log(` - ${expansionCount} expansion pack(s)`);
92
+
93
+ console.log('\nNext steps:');
94
+ console.log('1. Test the changes');
95
+ console.log('2. Commit: git add -A && git commit -m "chore: bump all versions (' + bumpType + ')"');
96
+ } else {
97
+ console.log('No items found to update');
98
+ }
99
+
100
+ } catch (error) {
101
+ console.error('Error reading expansion packs directory:', error.message);
102
+ process.exit(1);
103
+ }
104
+ }
105
+
106
+ bumpAllVersions();
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Load required modules
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const yaml = require('js-yaml');
7
+
8
+ // Parse CLI arguments
9
+ const args = process.argv.slice(2);
10
+ const packId = args[0];
11
+ const bumpType = args[1] || 'minor';
12
+
13
+ // Validate arguments
14
+ if (!packId || args.length > 2) {
15
+ console.log('Usage: node bump-expansion-version.js <expansion-pack-id> [major|minor|patch]');
16
+ console.log('Default: minor');
17
+ console.log('Example: node bump-expansion-version.js bmad-creator-tools patch');
18
+ process.exit(1);
19
+ }
20
+
21
+ if (!['major', 'minor', 'patch'].includes(bumpType)) {
22
+ console.error('Error: Bump type must be major, minor, or patch');
23
+ process.exit(1);
24
+ }
25
+
26
+ // Version bump logic
27
+ function bumpVersion(currentVersion, type) {
28
+ const [major, minor, patch] = currentVersion.split('.').map(Number);
29
+
30
+ switch (type) {
31
+ case 'major': return `${major + 1}.0.0`;
32
+ case 'minor': return `${major}.${minor + 1}.0`;
33
+ case 'patch': return `${major}.${minor}.${patch + 1}`;
34
+ default: return currentVersion;
35
+ }
36
+ }
37
+
38
+ // Main function to bump version
39
+ async function updateVersion() {
40
+ const configPath = path.join(__dirname, '..', 'expansion-packs', packId, 'config.yaml');
41
+
42
+ // Check if config exists
43
+ if (!fs.existsSync(configPath)) {
44
+ console.error(`Error: Expansion pack '${packId}' not found`);
45
+ console.log('\nAvailable expansion packs:');
46
+
47
+ const packsDir = path.join(__dirname, '..', 'expansion-packs');
48
+ const entries = fs.readdirSync(packsDir, { withFileTypes: true });
49
+
50
+ entries.forEach(entry => {
51
+ if (entry.isDirectory() && !entry.name.startsWith('.')) {
52
+ console.log(` - ${entry.name}`);
53
+ }
54
+ });
55
+
56
+ process.exit(1);
57
+ }
58
+
59
+ try {
60
+ const configContent = fs.readFileSync(configPath, 'utf8');
61
+ const config = yaml.load(configContent);
62
+
63
+ const oldVersion = config.version || '1.0.0';
64
+ const newVersion = bumpVersion(oldVersion, bumpType);
65
+
66
+ config.version = newVersion;
67
+
68
+ const updatedYaml = yaml.dump(config, { indent: 2 });
69
+ fs.writeFileSync(configPath, updatedYaml);
70
+
71
+ console.log(`✓ ${packId}: ${oldVersion} → ${newVersion}`);
72
+ console.log(`\n✓ Successfully bumped ${packId} with ${bumpType} version bump`);
73
+ console.log('\nNext steps:');
74
+ console.log(`1. Test the changes`);
75
+ console.log(`2. Commit: git add -A && git commit -m "chore: bump ${packId} version (${bumpType})"`);
76
+
77
+ } catch (error) {
78
+ console.error('Error updating version:', error.message);
79
+ process.exit(1);
80
+ }
81
+ }
82
+
83
+ updateVersion();
package/tools/cli.js ADDED
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require('commander');
4
+ const WebBuilder = require('./builders/web-builder');
5
+ const V3ToV4Upgrader = require('./upgraders/v3-to-v4-upgrader');
6
+ const IdeSetup = require('./installer/lib/ide-setup');
7
+ const path = require('path');
8
+
9
+ const program = new Command();
10
+
11
+ program
12
+ .name('bmad-build')
13
+ .description('BMad-Method build tool for creating web bundles')
14
+ .version('4.0.0');
15
+
16
+ program
17
+ .command('build')
18
+ .description('Build web bundles for agents and teams')
19
+ .option('-a, --agents-only', 'Build only agent bundles')
20
+ .option('-t, --teams-only', 'Build only team bundles')
21
+ .option('-e, --expansions-only', 'Build only expansion pack bundles')
22
+ .option('--no-expansions', 'Skip building expansion packs')
23
+ .option('--no-clean', 'Skip cleaning output directories')
24
+ .action(async (options) => {
25
+ const builder = new WebBuilder({
26
+ rootDir: process.cwd()
27
+ });
28
+
29
+ try {
30
+ if (options.clean) {
31
+ console.log('Cleaning output directories...');
32
+ await builder.cleanOutputDirs();
33
+ }
34
+
35
+ if (options.expansionsOnly) {
36
+ console.log('Building expansion pack bundles...');
37
+ await builder.buildAllExpansionPacks({ clean: false });
38
+ } else {
39
+ if (!options.teamsOnly) {
40
+ console.log('Building agent bundles...');
41
+ await builder.buildAgents();
42
+ }
43
+
44
+ if (!options.agentsOnly) {
45
+ console.log('Building team bundles...');
46
+ await builder.buildTeams();
47
+ }
48
+
49
+ if (!options.noExpansions) {
50
+ console.log('Building expansion pack bundles...');
51
+ await builder.buildAllExpansionPacks({ clean: false });
52
+ }
53
+ }
54
+
55
+ console.log('Build completed successfully!');
56
+ } catch (error) {
57
+ console.error('Build failed:', error.message);
58
+ process.exit(1);
59
+ }
60
+ });
61
+
62
+ program
63
+ .command('build:expansions')
64
+ .description('Build web bundles for all expansion packs')
65
+ .option('--expansion <name>', 'Build specific expansion pack only')
66
+ .option('--no-clean', 'Skip cleaning output directories')
67
+ .action(async (options) => {
68
+ const builder = new WebBuilder({
69
+ rootDir: process.cwd()
70
+ });
71
+
72
+ try {
73
+ if (options.expansion) {
74
+ console.log(`Building expansion pack: ${options.expansion}`);
75
+ await builder.buildExpansionPack(options.expansion, { clean: options.clean });
76
+ } else {
77
+ console.log('Building all expansion packs...');
78
+ await builder.buildAllExpansionPacks({ clean: options.clean });
79
+ }
80
+
81
+ console.log('Expansion pack build completed successfully!');
82
+ } catch (error) {
83
+ console.error('Expansion pack build failed:', error.message);
84
+ process.exit(1);
85
+ }
86
+ });
87
+
88
+ program
89
+ .command('list:agents')
90
+ .description('List all available agents')
91
+ .action(async () => {
92
+ const builder = new WebBuilder({ rootDir: process.cwd() });
93
+ const agents = await builder.resolver.listAgents();
94
+ console.log('Available agents:');
95
+ agents.forEach(agent => console.log(` - ${agent}`));
96
+ process.exit(0);
97
+ });
98
+
99
+ program
100
+ .command('list:expansions')
101
+ .description('List all available expansion packs')
102
+ .action(async () => {
103
+ const builder = new WebBuilder({ rootDir: process.cwd() });
104
+ const expansions = await builder.listExpansionPacks();
105
+ console.log('Available expansion packs:');
106
+ expansions.forEach(expansion => console.log(` - ${expansion}`));
107
+ process.exit(0);
108
+ });
109
+
110
+ program
111
+ .command('validate')
112
+ .description('Validate agent and team configurations')
113
+ .action(async () => {
114
+ const builder = new WebBuilder({ rootDir: process.cwd() });
115
+ try {
116
+ // Validate by attempting to build all agents and teams
117
+ const agents = await builder.resolver.listAgents();
118
+ const teams = await builder.resolver.listTeams();
119
+
120
+ console.log('Validating agents...');
121
+ for (const agent of agents) {
122
+ await builder.resolver.resolveAgentDependencies(agent);
123
+ console.log(` ✓ ${agent}`);
124
+ }
125
+
126
+ console.log('\nValidating teams...');
127
+ for (const team of teams) {
128
+ await builder.resolver.resolveTeamDependencies(team);
129
+ console.log(` ✓ ${team}`);
130
+ }
131
+
132
+ console.log('\nAll configurations are valid!');
133
+ } catch (error) {
134
+ console.error('Validation failed:', error.message);
135
+ process.exit(1);
136
+ }
137
+ });
138
+
139
+ program
140
+ .command('upgrade')
141
+ .description('Upgrade a BMad-Method V3 project to V4')
142
+ .option('-p, --project <path>', 'Path to V3 project (defaults to current directory)')
143
+ .option('--dry-run', 'Show what would be changed without making changes')
144
+ .option('--no-backup', 'Skip creating backup (not recommended)')
145
+ .action(async (options) => {
146
+ const upgrader = new V3ToV4Upgrader();
147
+ await upgrader.upgrade({
148
+ projectPath: options.project,
149
+ dryRun: options.dryRun,
150
+ backup: options.backup
151
+ });
152
+ });
153
+
154
+ program.parse();
@@ -0,0 +1,76 @@
1
+ const fs = require("fs-extra");
2
+ const path = require("node:path");
3
+ const os = require("node:os");
4
+ const { isBinaryFile } = require("./binary.js");
5
+
6
+ /**
7
+ * Aggregate file contents with bounded concurrency.
8
+ * Returns text files, binary files (with size), and errors.
9
+ * @param {string[]} files absolute file paths
10
+ * @param {string} rootDir
11
+ * @param {{ text?: string, warn?: (msg: string) => void } | null} spinner
12
+ */
13
+ async function aggregateFileContents(files, rootDir, spinner = null) {
14
+ const results = {
15
+ textFiles: [],
16
+ binaryFiles: [],
17
+ errors: [],
18
+ totalFiles: files.length,
19
+ processedFiles: 0,
20
+ };
21
+
22
+ // Automatic concurrency selection based on CPU count and workload size.
23
+ // - Base on 2x logical CPUs, clamped to [2, 64]
24
+ // - For very small workloads, avoid excessive parallelism
25
+ const cpuCount = (os.cpus && Array.isArray(os.cpus()) ? os.cpus().length : (os.cpus?.length || 4));
26
+ let concurrency = Math.min(64, Math.max(2, (Number(cpuCount) || 4) * 2));
27
+ if (files.length > 0 && files.length < concurrency) {
28
+ concurrency = Math.max(1, Math.min(concurrency, Math.ceil(files.length / 2)));
29
+ }
30
+
31
+ async function processOne(filePath) {
32
+ try {
33
+ const relativePath = path.relative(rootDir, filePath);
34
+ if (spinner) {
35
+ spinner.text = `Processing: ${relativePath} (${results.processedFiles + 1}/${results.totalFiles})`;
36
+ }
37
+
38
+ const binary = await isBinaryFile(filePath);
39
+ if (binary) {
40
+ const size = (await fs.stat(filePath)).size;
41
+ results.binaryFiles.push({ path: relativePath, absolutePath: filePath, size });
42
+ } else {
43
+ const content = await fs.readFile(filePath, "utf8");
44
+ results.textFiles.push({
45
+ path: relativePath,
46
+ absolutePath: filePath,
47
+ content,
48
+ size: content.length,
49
+ lines: content.split("\n").length,
50
+ });
51
+ }
52
+ } catch (error) {
53
+ const relativePath = path.relative(rootDir, filePath);
54
+ const errorInfo = { path: relativePath, absolutePath: filePath, error: error.message };
55
+ results.errors.push(errorInfo);
56
+ if (spinner) {
57
+ spinner.warn(`Warning: Could not read file ${relativePath}: ${error.message}`);
58
+ } else {
59
+ console.warn(`Warning: Could not read file ${relativePath}: ${error.message}`);
60
+ }
61
+ } finally {
62
+ results.processedFiles++;
63
+ }
64
+ }
65
+
66
+ for (let i = 0; i < files.length; i += concurrency) {
67
+ const slice = files.slice(i, i + concurrency);
68
+ await Promise.all(slice.map(processOne));
69
+ }
70
+
71
+ return results;
72
+ }
73
+
74
+ module.exports = {
75
+ aggregateFileContents,
76
+ };
@@ -0,0 +1,53 @@
1
+ const fsp = require("node:fs/promises");
2
+ const path = require("node:path");
3
+ const { Buffer } = require("node:buffer");
4
+
5
+ /**
6
+ * Efficiently determine if a file is binary without reading the whole file.
7
+ * - Fast path by extension for common binaries
8
+ * - Otherwise read a small prefix and check for NUL bytes
9
+ * @param {string} filePath
10
+ * @returns {Promise<boolean>}
11
+ */
12
+ async function isBinaryFile(filePath) {
13
+ try {
14
+ const stats = await fsp.stat(filePath);
15
+ if (stats.isDirectory()) {
16
+ throw new Error("EISDIR: illegal operation on a directory");
17
+ }
18
+
19
+ const binaryExtensions = new Set([
20
+ ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".ico", ".svg",
21
+ ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx",
22
+ ".zip", ".tar", ".gz", ".rar", ".7z",
23
+ ".exe", ".dll", ".so", ".dylib",
24
+ ".mp3", ".mp4", ".avi", ".mov", ".wav",
25
+ ".ttf", ".otf", ".woff", ".woff2",
26
+ ".bin", ".dat", ".db", ".sqlite",
27
+ ]);
28
+
29
+ const ext = path.extname(filePath).toLowerCase();
30
+ if (binaryExtensions.has(ext)) return true;
31
+ if (stats.size === 0) return false;
32
+
33
+ const sampleSize = Math.min(4096, stats.size);
34
+ const fd = await fsp.open(filePath, "r");
35
+ try {
36
+ const buffer = Buffer.allocUnsafe(sampleSize);
37
+ const { bytesRead } = await fd.read(buffer, 0, sampleSize, 0);
38
+ const slice = bytesRead === sampleSize ? buffer : buffer.subarray(0, bytesRead);
39
+ return slice.includes(0);
40
+ } finally {
41
+ await fd.close();
42
+ }
43
+ } catch (error) {
44
+ console.warn(
45
+ `Warning: Could not determine if file is binary: ${filePath} - ${error.message}`,
46
+ );
47
+ return false;
48
+ }
49
+ }
50
+
51
+ module.exports = {
52
+ isBinaryFile,
53
+ };
@@ -0,0 +1,70 @@
1
+ const path = require("node:path");
2
+ const { execFile } = require("node:child_process");
3
+ const { promisify } = require("node:util");
4
+ const { glob } = require("glob");
5
+ const { loadIgnore } = require("./ignoreRules.js");
6
+
7
+ const pExecFile = promisify(execFile);
8
+
9
+ async function isGitRepo(rootDir) {
10
+ try {
11
+ const { stdout } = await pExecFile("git", [
12
+ "rev-parse",
13
+ "--is-inside-work-tree",
14
+ ], { cwd: rootDir });
15
+ return String(stdout || "").toString().trim() === "true";
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+
21
+ async function gitListFiles(rootDir) {
22
+ try {
23
+ const { stdout } = await pExecFile("git", [
24
+ "ls-files",
25
+ "-co",
26
+ "--exclude-standard",
27
+ ], { cwd: rootDir });
28
+ return String(stdout || "")
29
+ .split(/\r?\n/)
30
+ .map((s) => s.trim())
31
+ .filter(Boolean);
32
+ } catch {
33
+ return [];
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Discover files under rootDir.
39
+ * - Prefer git ls-files when available for speed/correctness
40
+ * - Fallback to glob and apply unified ignore rules
41
+ * @param {string} rootDir
42
+ * @param {object} [options]
43
+ * @param {boolean} [options.preferGit=true]
44
+ * @returns {Promise<string[]>} absolute file paths
45
+ */
46
+ async function discoverFiles(rootDir, options = {}) {
47
+ const { preferGit = true } = options;
48
+ const { filter } = await loadIgnore(rootDir);
49
+
50
+ // Try git first
51
+ if (preferGit && await isGitRepo(rootDir)) {
52
+ const relFiles = await gitListFiles(rootDir);
53
+ const filteredRel = relFiles.filter((p) => filter(p));
54
+ return filteredRel.map((p) => path.resolve(rootDir, p));
55
+ }
56
+
57
+ // Glob fallback
58
+ const globbed = await glob("**/*", {
59
+ cwd: rootDir,
60
+ nodir: true,
61
+ dot: true,
62
+ follow: false,
63
+ });
64
+ const filteredRel = globbed.filter((p) => filter(p));
65
+ return filteredRel.map((p) => path.resolve(rootDir, p));
66
+ }
67
+
68
+ module.exports = {
69
+ discoverFiles,
70
+ };
@@ -0,0 +1,35 @@
1
+ const path = require("node:path");
2
+ const discovery = require("./discovery.js");
3
+ const ignoreRules = require("./ignoreRules.js");
4
+ const { isBinaryFile } = require("./binary.js");
5
+ const { aggregateFileContents } = require("./aggregate.js");
6
+
7
+ // Backward-compatible signature; delegate to central loader
8
+ async function parseGitignore(gitignorePath) {
9
+ return await ignoreRules.parseGitignore(gitignorePath);
10
+ }
11
+
12
+ async function discoverFiles(rootDir) {
13
+ try {
14
+ // Delegate to discovery module which respects .gitignore and defaults
15
+ return await discovery.discoverFiles(rootDir, { preferGit: true });
16
+ } catch (error) {
17
+ console.error("Error discovering files:", error.message);
18
+ return [];
19
+ }
20
+ }
21
+
22
+ async function filterFiles(files, rootDir) {
23
+ const { filter } = await ignoreRules.loadIgnore(rootDir);
24
+ const relativeFiles = files.map((f) => path.relative(rootDir, f));
25
+ const filteredRelative = relativeFiles.filter((p) => filter(p));
26
+ return filteredRelative.map((p) => path.resolve(rootDir, p));
27
+ }
28
+
29
+ module.exports = {
30
+ parseGitignore,
31
+ discoverFiles,
32
+ isBinaryFile,
33
+ aggregateFileContents,
34
+ filterFiles,
35
+ };