The Build Crew for AI Development
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112import { install } from './commands/install.js';import { uninstall } from './commands/uninstall.js';import { doctor } from './commands/doctor.js';import { list } from './commands/list.js';
export async function run(args) { const command = args[0];
if (!command || command === '-h' || command === '--help') { showHelp(); return; }
if (command === '--version' || command === '-v') { console.log('0.1.0'); return; }
switch (command) { case 'install': await install(parseInstallArgs(args.slice(1))); break; case 'uninstall': await uninstall(parseInstallArgs(args.slice(1))); break; case 'doctor': await doctor(parseInstallArgs(args.slice(1))); break; case 'list': await list(parseListArgs(args.slice(1))); break; default: console.error(`Unknown command: ${command}`); showHelp(); process.exit(1); }}
function showHelp() { console.log(`BuildCrew - The Build Crew for AI Development
Usage: buildcrew <command> [options]
Commands: install <platform> [-p | -u] [-t <dir>] [--dry-run] [--force] Install or update BuildCrew recipes for a platform.
uninstall <platform> [-p | -u] [-t <dir>] [--dry-run] Remove BuildCrew recipes for a platform.
doctor <platform> [-p | -u] [-t <dir>] Check the status of BuildCrew recipes.
list [platforms | installed] List supported platforms or installed recipes.
Options: -p, --project Install into current/project directory (default) -u, --user Install into user-level config directory -t, --target Target project directory (only with --project) --dry-run Show what would happen without making changes --force Overwrite files even if they conflict
Platforms: opencode, claude, copilot
Examples: buildcrew install copilot buildcrew install opencode -u buildcrew install claude -t ./my-app --dry-run buildcrew doctor copilot buildcrew uninstall opencode`);}
function parseInstallArgs(args) { const result = { platform: null, project: false, user: false, target: null, dryRun: false, force: false };
for (let i = 0; i < args.length; i++) { const arg = args[i]; if (arg === '-p' || arg === '--project') { result.project = true; } else if (arg === '-u' || arg === '--user') { result.user = true; } else if (arg === '-t' || arg === '--target') { result.target = args[++i]; } else if (arg === '--dry-run') { result.dryRun = true; } else if (arg === '--force') { result.force = true; } else if (!arg.startsWith('-')) { if (!result.platform) { result.platform = arg; } } }
return result;}
function parseListArgs(args) { return { subcommand: args[0] || 'platforms' };}