2025-06-10 21:41:58 -05:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
|
|
const { Command } = require('commander');
|
|
|
|
|
const WebBuilder = require('./builders/web-builder');
|
2025-06-14 13:00:58 -05:00
|
|
|
const V3ToV4Upgrader = require('./upgraders/v3-to-v4-upgrader');
|
2025-06-14 16:38:37 -05:00
|
|
|
const IdeSetup = require('./installer/lib/ide-setup');
|
2025-06-10 21:41:58 -05:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
|
|
const program = new Command();
|
|
|
|
|
|
|
|
|
|
program
|
|
|
|
|
.name('bmad-build')
|
2025-07-04 07:47:57 -05:00
|
|
|
.description('BMad-Method build tool for creating web bundles')
|
2025-06-10 21:41:58 -05:00
|
|
|
.version('4.0.0');
|
|
|
|
|
|
|
|
|
|
program
|
|
|
|
|
.command('build')
|
|
|
|
|
.description('Build web bundles for agents and teams')
|
|
|
|
|
.option('-a, --agents-only', 'Build only agent bundles')
|
|
|
|
|
.option('-t, --teams-only', 'Build only team bundles')
|
2025-06-16 18:34:12 -05:00
|
|
|
.option('-e, --expansions-only', 'Build only expansion pack bundles')
|
|
|
|
|
.option('--no-expansions', 'Skip building expansion packs')
|
2025-06-10 21:41:58 -05:00
|
|
|
.option('--no-clean', 'Skip cleaning output directories')
|
|
|
|
|
.action(async (options) => {
|
|
|
|
|
const builder = new WebBuilder({
|
|
|
|
|
rootDir: process.cwd()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (options.clean) {
|
|
|
|
|
console.log('Cleaning output directories...');
|
|
|
|
|
await builder.cleanOutputDirs();
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-16 18:34:12 -05:00
|
|
|
if (options.expansionsOnly) {
|
|
|
|
|
console.log('Building expansion pack bundles...');
|
|
|
|
|
await builder.buildAllExpansionPacks({ clean: false });
|
|
|
|
|
} else {
|
|
|
|
|
if (!options.teamsOnly) {
|
|
|
|
|
console.log('Building agent bundles...');
|
|
|
|
|
await builder.buildAgents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!options.agentsOnly) {
|
|
|
|
|
console.log('Building team bundles...');
|
|
|
|
|
await builder.buildTeams();
|
|
|
|
|
}
|
2025-06-10 21:41:58 -05:00
|
|
|
|
2025-06-16 18:34:12 -05:00
|
|
|
if (!options.noExpansions) {
|
|
|
|
|
console.log('Building expansion pack bundles...');
|
|
|
|
|
await builder.buildAllExpansionPacks({ clean: false });
|
|
|
|
|
}
|
2025-06-10 21:41:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('Build completed successfully!');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Build failed:', error.message);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-16 18:34:12 -05:00
|
|
|
program
|
|
|
|
|
.command('build:expansions')
|
|
|
|
|
.description('Build web bundles for all expansion packs')
|
|
|
|
|
.option('--expansion <name>', 'Build specific expansion pack only')
|
|
|
|
|
.option('--no-clean', 'Skip cleaning output directories')
|
|
|
|
|
.action(async (options) => {
|
|
|
|
|
const builder = new WebBuilder({
|
|
|
|
|
rootDir: process.cwd()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (options.expansion) {
|
|
|
|
|
console.log(`Building expansion pack: ${options.expansion}`);
|
|
|
|
|
await builder.buildExpansionPack(options.expansion, { clean: options.clean });
|
|
|
|
|
} else {
|
|
|
|
|
console.log('Building all expansion packs...');
|
|
|
|
|
await builder.buildAllExpansionPacks({ clean: options.clean });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('Expansion pack build completed successfully!');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Expansion pack build failed:', error.message);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-10 21:41:58 -05:00
|
|
|
program
|
|
|
|
|
.command('list:agents')
|
|
|
|
|
.description('List all available agents')
|
2025-06-12 22:38:24 -05:00
|
|
|
.action(async () => {
|
2025-06-10 21:41:58 -05:00
|
|
|
const builder = new WebBuilder({ rootDir: process.cwd() });
|
2025-06-12 22:38:24 -05:00
|
|
|
const agents = await builder.resolver.listAgents();
|
2025-06-10 21:41:58 -05:00
|
|
|
console.log('Available agents:');
|
|
|
|
|
agents.forEach(agent => console.log(` - ${agent}`));
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-16 18:34:12 -05:00
|
|
|
program
|
|
|
|
|
.command('list:expansions')
|
|
|
|
|
.description('List all available expansion packs')
|
|
|
|
|
.action(async () => {
|
|
|
|
|
const builder = new WebBuilder({ rootDir: process.cwd() });
|
|
|
|
|
const expansions = await builder.listExpansionPacks();
|
|
|
|
|
console.log('Available expansion packs:');
|
|
|
|
|
expansions.forEach(expansion => console.log(` - ${expansion}`));
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-10 21:41:58 -05:00
|
|
|
program
|
|
|
|
|
.command('validate')
|
|
|
|
|
.description('Validate agent and team configurations')
|
|
|
|
|
.action(async () => {
|
|
|
|
|
const builder = new WebBuilder({ rootDir: process.cwd() });
|
|
|
|
|
try {
|
2025-06-12 22:38:24 -05:00
|
|
|
// Validate by attempting to build all agents and teams
|
|
|
|
|
const agents = await builder.resolver.listAgents();
|
|
|
|
|
const teams = await builder.resolver.listTeams();
|
|
|
|
|
|
|
|
|
|
console.log('Validating agents...');
|
|
|
|
|
for (const agent of agents) {
|
|
|
|
|
await builder.resolver.resolveAgentDependencies(agent);
|
|
|
|
|
console.log(` ✓ ${agent}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('\nValidating teams...');
|
|
|
|
|
for (const team of teams) {
|
|
|
|
|
await builder.resolver.resolveTeamDependencies(team);
|
|
|
|
|
console.log(` ✓ ${team}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('\nAll configurations are valid!');
|
2025-06-10 21:41:58 -05:00
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Validation failed:', error.message);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-14 13:00:58 -05:00
|
|
|
program
|
|
|
|
|
.command('upgrade')
|
2025-07-04 07:47:57 -05:00
|
|
|
.description('Upgrade a BMad-Method V3 project to V4')
|
2025-06-14 13:00:58 -05:00
|
|
|
.option('-p, --project <path>', 'Path to V3 project (defaults to current directory)')
|
|
|
|
|
.option('--dry-run', 'Show what would be changed without making changes')
|
|
|
|
|
.option('--no-backup', 'Skip creating backup (not recommended)')
|
|
|
|
|
.action(async (options) => {
|
|
|
|
|
const upgrader = new V3ToV4Upgrader();
|
|
|
|
|
await upgrader.upgrade({
|
|
|
|
|
projectPath: options.project,
|
|
|
|
|
dryRun: options.dryRun,
|
|
|
|
|
backup: options.backup
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
Feat/flattener-tool (#337)
* This PR introduces a powerful new Codebase Flattener Tool that aggregates entire codebases into AI-optimized XML format, making it easy to share project context with AI assistants for analysis, debugging, and development assistance.
- AI-Optimized XML Output : Generates clean, structured XML specifically designed for AI model consumption
- Smart File Discovery : Recursive file scanning with intelligent filtering using glob patterns
- Binary File Detection : Automatically identifies and excludes binary files, focusing on source code
- Progress Tracking : Real-time progress indicators with comprehensive completion statistics
- Flexible Output : Customizable output file location and naming via CLI arguments
- Gitignore Integration : Automatically respects .gitignore patterns to exclude unnecessary files
- CDATA Handling : Proper XML CDATA sections with escape sequence handling for ]]> patterns
- Content Indentation : Beautiful XML formatting with properly indented file content (4-space indentation)
- Error Handling : Robust error handling with detailed logging for problematic files
- Hierarchical Formatting : Clean XML structure with proper indentation and formatting
- File Content Preservation : Maintains original file formatting within indented CDATA sections
- Exclusion Logic : Prevents self-inclusion of output files ( flattened-codebase.xml , repomix-output.xml )
- tools/flattener/main.js - Complete flattener implementation with CLI interface
- package.json - Added new dependencies (glob, minimatch, fs-extra, commander, ora, chalk)
- package-lock.json - Updated dependency tree
- .gitignore - Added exclusions for flattener outputs
- README.md - Comprehensive documentation with usage examples
- docs/bmad-workflow-guide.md - Integration guidance
- tools/cli.js - CLI integration
- .vscode/settings.json - SonarLint configuration
```
current directory
npm run flatten
npm run flatten -- --output my-project.xml
npm run flatten -- -o /path/to/output/codebase.xml
```
The tool provides comprehensive completion summaries including:
- File count and breakdown (text/binary/errors)
- Source code size and generated XML size
- Total lines of code and estimated token count
- Processing progress and performance metrics
- Bug Fix : Corrected typo in exclusion patterns ( repromix-output.xml → repomix-output.xml )
- Performance : Efficient file processing with streaming and progress indicators
- Reliability : Comprehensive error handling and validation
- Maintainability : Clean, well-documented code with modular functions
- AI Integration : Perfect for sharing codebase context with AI assistants
- Code Reviews : Streamlined code review process with complete project context
- Documentation : Enhanced project documentation and analysis capabilities
- Development Workflow : Improved development assistance and debugging support
This tool significantly enhances the BMad-Method framework's AI integration capabilities, providing developers with a seamless way to share complete project context for enhanced AI-assisted development workflows.
* docs(bmad-core): update documentation for enhanced workflow and user guide
- Fix typos and improve clarity in user guide
- Add new enhanced development workflow documentation
- Update brownfield workflow with flattened codebase instructions
- Improve consistency in documentation formatting
* chore: remove unused files and configurations
- Delete deprecated bmad workflow guide and roomodes file
- Remove sonarlint project configuration
- Downgrade ora dependency version
- Remove jest test script
* Update package.json
Removed jest as it is not needed.
* Update working-in-the-brownfield.md
added documentation for sharding docs
* perf(flattener): improve memory efficiency by streaming xml output
- Replace in-memory XML generation with streaming approach
- Add comprehensive common ignore patterns list
- Update statistics calculation to use file size instead of content length
* fix/chore: Update console.log for user-guide.md install path. Cleaned up config files/folders and updated .gitignore (#347)
* fix: Update console.log for user-guide.md install path
Changed
IMPORTANT: Please read the user guide installed at docs/user-guilde.md
to
IMPORTANT: Please read the user guide installed at .bmad-core/user-guide.md
WHY: the actual install location of the user-guide.md is in the .bmad-core directory.
* chore: remove formatting configs and clean up gitignore
- Delete husky pre-commit hook and prettier config files
- Remove VS Code chat/copilot settings
- Reorganize and clean up gitignore entries
* feat: Overhaul and Enhance 2D Unity Game Dev Expansion Pack (#350)
* Updated game-sm agent to match the new core framework patterns
* feat:Created more comprehensive game story matching new format system as well
* feat:Added Game specific course correct task
* feat:Updated dod-checklist to match new DoD format
* feat:Added new Architect agent for appropriate architecture doc creation and design
* feat:Overhaul of game-architecture-tmpl template
* feat:Updated rest of templates besides level which doesnt really need it
* feat: Finished extended architecture documentation needed for new game story tasks
* feat: Updated game Developer to new format
* feat: Updated last agent to new format and updated bmad-kb. bmad-kb I did my best with but im not sure of it's valid usage in the expansion pack, the AI generated more of the file then myself. I made sure to include it due to the new core-config file
* feat: Finished updating designer agent to new format and cleaned up template linting errors
* Built dist for web bundle
* Increased expansion pack minor verison number
* Updated architecht and design for sharding built-in
* chore: bump bmad-2d-unity-game-dev version (minor)
* updated config.yaml for game-specific pieces to supplement core-config.yaml
* Updated game-core-config and epic processing for game story and game design. Initial implementation was far too generic
* chore: bump bmad-2d-unity-game-dev version (patch)
* feat: Fixed issue with multi-configs being needed. chore: bump bmad-2d-unity-game-dev version (patch)
* Chore: Built web-bundle
* feat: Added the ability to specify the unity editor install location.\nchore: bump bmad-2d-unity-game-dev version (patch)
* feat: core-config must be in two places to support inherited tasks at this time so added instructions to copy and create one in expansion pack folder as well. chore: bump bmad-2d-unity-game-dev version (patch)
* This PR introduces a powerful new Codebase Flattener Tool that aggregates entire codebases into AI-optimized XML format, making it easy to share project context with AI assistants for analysis, debugging, and development assistance.
- AI-Optimized XML Output : Generates clean, structured XML specifically designed for AI model consumption
- Smart File Discovery : Recursive file scanning with intelligent filtering using glob patterns
- Binary File Detection : Automatically identifies and excludes binary files, focusing on source code
- Progress Tracking : Real-time progress indicators with comprehensive completion statistics
- Flexible Output : Customizable output file location and naming via CLI arguments
- Gitignore Integration : Automatically respects .gitignore patterns to exclude unnecessary files
- CDATA Handling : Proper XML CDATA sections with escape sequence handling for ]]> patterns
- Content Indentation : Beautiful XML formatting with properly indented file content (4-space indentation)
- Error Handling : Robust error handling with detailed logging for problematic files
- Hierarchical Formatting : Clean XML structure with proper indentation and formatting
- File Content Preservation : Maintains original file formatting within indented CDATA sections
- Exclusion Logic : Prevents self-inclusion of output files ( flattened-codebase.xml , repomix-output.xml )
- tools/flattener/main.js - Complete flattener implementation with CLI interface
- package.json - Added new dependencies (glob, minimatch, fs-extra, commander, ora, chalk)
- package-lock.json - Updated dependency tree
- .gitignore - Added exclusions for flattener outputs
- README.md - Comprehensive documentation with usage examples
- docs/bmad-workflow-guide.md - Integration guidance
- tools/cli.js - CLI integration
- .vscode/settings.json - SonarLint configuration
```
current directory
npm run flatten
npm run flatten -- --output my-project.xml
npm run flatten -- -o /path/to/output/codebase.xml
```
The tool provides comprehensive completion summaries including:
- File count and breakdown (text/binary/errors)
- Source code size and generated XML size
- Total lines of code and estimated token count
- Processing progress and performance metrics
- Bug Fix : Corrected typo in exclusion patterns ( repromix-output.xml → repomix-output.xml )
- Performance : Efficient file processing with streaming and progress indicators
- Reliability : Comprehensive error handling and validation
- Maintainability : Clean, well-documented code with modular functions
- AI Integration : Perfect for sharing codebase context with AI assistants
- Code Reviews : Streamlined code review process with complete project context
- Documentation : Enhanced project documentation and analysis capabilities
- Development Workflow : Improved development assistance and debugging support
This tool significantly enhances the BMad-Method framework's AI integration capabilities, providing developers with a seamless way to share complete project context for enhanced AI-assisted development workflows.
* chore: remove unused files and configurations
- Delete deprecated bmad workflow guide and roomodes file
- Remove sonarlint project configuration
- Downgrade ora dependency version
- Remove jest test script
* docs: update command names and agent references in documentation
- Change `*create` to `*draft` in workflow guide
- Update PM agent commands to use consistent naming
- Replace `analyst` references with `architect`
- Fix command examples to match new naming conventions
---------
Co-authored-by: PinkyD <paulbeanjr@gmail.com>
2025-07-26 14:56:00 -05:00
|
|
|
program
|
|
|
|
|
.command('flatten')
|
|
|
|
|
.description('Flatten codebase to XML format')
|
|
|
|
|
.option('-o, --output <path>', 'Output file path', 'flattened-codebase.xml')
|
|
|
|
|
.action(async (options) => {
|
|
|
|
|
const flattener = require('./flattener/main');
|
|
|
|
|
await flattener.parseAsync(['flatten', '--output', options.output], { from: 'user' });
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-10 21:41:58 -05:00
|
|
|
program.parse();
|