eat: enhance flattener tool with improved CLI integration and custom directory support (#372)

* feat(cli): move flatten command to installer and update docs

Refactor the flatten command from tools/cli.js to tools/installer/bin/bmad.js for better integration. Add support for custom input directory and improve error handling. Update documentation in README.md and working-in-the-brownfield.md to reflect new command usage. Also clean up package-lock.json and add it to .gitignore.

* chore: update gitignore and add package-lock.json for installer tool

Remove package-lock.json from root gitignore since it's now needed for the installer tool
Add package-lock.json with dependencies for the bmad-method installer

---------

Co-authored-by: Devin Stagner <devin@blackstag.family>
This commit is contained in:
manjaroblack
2025-07-27 18:02:08 -05:00
committed by GitHub
parent a2ddf926e5
commit a80ea150f2
9 changed files with 1171 additions and 1564 deletions

View File

@@ -497,7 +497,7 @@ class Installer {
case "reinstall":
// For reinstall, don't check for modifications - just overwrite
return await this.performReinstall(config, installDir, spinner);
case "expansions":
case "expansions": {
// Ask which expansion packs to install
const availableExpansionPacks = await resourceLocator.getExpansionPacks();
@@ -534,6 +534,7 @@ class Installer {
console.log(chalk.green(` - ${packId} → .${packId}/`));
}
return;
}
case "cancel":
console.log("Installation cancelled.");
return;
@@ -865,6 +866,8 @@ class Installer {
}).join(", ");
console.log(chalk.green(`✓ IDE rules and configurations set up for: ${ideNames}`));
}
// Information about web bundles
if (!config.includeWebBundles) {
@@ -1428,7 +1431,7 @@ class Installer {
return config.selectedWebBundleTeams ?
`teams: ${config.selectedWebBundleTeams.join(', ')}` :
'selected teams';
case 'custom':
case 'custom': {
const parts = [];
if (config.selectedWebBundleTeams && config.selectedWebBundleTeams.length > 0) {
parts.push(`teams: ${config.selectedWebBundleTeams.join(', ')}`);
@@ -1437,6 +1440,7 @@ class Installer {
parts.push('individual agents');
}
return parts.length > 0 ? parts.join(' + ') : 'custom selection';
}
default:
return 'selected bundles';
}
@@ -1741,6 +1745,28 @@ class Installer {
return null;
}
async flatten(options) {
const { spawn } = require('child_process');
const flattenerPath = path.join(__dirname, '..', '..', 'flattener', 'main.js');
const args = [];
if (options.input) {
args.push('--input', options.input);
}
if (options.output) {
args.push('--output', options.output);
}
const child = spawn('node', [flattenerPath, ...args], {
stdio: 'inherit',
cwd: process.cwd()
});
child.on('exit', (code) => {
process.exit(code);
});
}
}
module.exports = new Installer();