mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-29 16:14:59 +00:00
feat: v6.0.0-alpha.0 - the future is now
This commit is contained in:
42
tools/cli/bmad-cli.js
Executable file
42
tools/cli/bmad-cli.js
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { program } = require('commander');
|
||||
const path = require('node:path');
|
||||
const fs = require('node:fs');
|
||||
|
||||
// Load package.json from root for version info
|
||||
const packageJson = require('../../package.json');
|
||||
|
||||
// Load all command modules
|
||||
const commandsPath = path.join(__dirname, 'commands');
|
||||
const commandFiles = fs.readdirSync(commandsPath).filter((file) => file.endsWith('.js'));
|
||||
|
||||
const commands = {};
|
||||
for (const file of commandFiles) {
|
||||
const command = require(path.join(commandsPath, file));
|
||||
commands[command.command] = command;
|
||||
}
|
||||
|
||||
// Set up main program
|
||||
program.version(packageJson.version).description('BMAD Core CLI - Universal AI agent framework');
|
||||
|
||||
// Register all commands
|
||||
for (const [name, cmd] of Object.entries(commands)) {
|
||||
const command = program.command(name).description(cmd.description);
|
||||
|
||||
// Add options
|
||||
for (const option of cmd.options || []) {
|
||||
command.option(...option);
|
||||
}
|
||||
|
||||
// Set action
|
||||
command.action(cmd.action);
|
||||
}
|
||||
|
||||
// Parse arguments
|
||||
program.parse(process.argv);
|
||||
|
||||
// Show help if no command provided
|
||||
if (process.argv.slice(2).length === 0) {
|
||||
program.outputHelp();
|
||||
}
|
||||
Reference in New Issue
Block a user