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

@@ -14,28 +14,26 @@ const isNpxExecution = __dirname.includes('_npx') || __dirname.includes('.npm');
// If running via npx, we need to handle things differently
if (isNpxExecution) {
// The actual bmad.js is in installer/bin/ (relative to tools directory)
const args = process.argv.slice(2);
// Use the installer for all commands
const bmadScriptPath = path.join(__dirname, 'installer', 'bin', 'bmad.js');
// Verify the file exists
if (!fs.existsSync(bmadScriptPath)) {
console.error('Error: Could not find bmad.js at', bmadScriptPath);
console.error('Current directory:', __dirname);
process.exit(1);
}
// Execute with proper working directory
try {
execSync(`node "${bmadScriptPath}" ${process.argv.slice(2).join(' ')}`, {
execSync(`node "${bmadScriptPath}" ${args.join(' ')}`, {
stdio: 'inherit',
cwd: path.dirname(__dirname)
});
} catch (error) {
// execSync will throw if the command exits with non-zero
// But the stdio is inherited, so the error is already displayed
process.exit(error.status || 1);
}
} else {
// Local execution - just require the installer directly
// Local execution - use installer for all commands
require('./installer/bin/bmad.js');
}