UNPKG

cortexweaver

Version:

CortexWeaver is a command-line interface (CLI) tool that orchestrates a swarm of specialized AI agents, powered by Claude Code and Gemini CLI, to assist in software development. It transforms a high-level project plan (plan.md) into a series of coordinate

203 lines 6.53 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const yargs_1 = __importDefault(require("yargs")); const helpers_1 = require("yargs/helpers"); const cli_1 = require("./cli"); const cli = new cli_1.CLI(); (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)) .scriptName('cortex-weaver') .usage('$0 <cmd> [args]') .command('init [path]', 'Initialize a new CortexWeaver project', (yargs) => { yargs.positional('path', { type: 'string', default: process.cwd(), describe: 'Project directory path' }); }, async (argv) => { try { await cli.init(argv.path); } catch (error) { console.error('❌ Failed to initialize project:', error.message); process.exit(1); } }) .command('status [path]', 'Show project status and active tasks', (yargs) => { yargs.positional('path', { type: 'string', default: process.cwd(), describe: 'Project directory path' }); }, async (argv) => { try { const status = await cli.status(argv.path); console.log(status); } catch (error) { console.error('❌ Failed to get status:', error.message); process.exit(1); } }) .command('start [path]', 'Start the orchestrator agent', (yargs) => { yargs.positional('path', { type: 'string', default: process.cwd(), describe: 'Project directory path' }); }, async (argv) => { try { await cli.start(argv.path); } catch (error) { console.error('❌ Failed to start orchestrator:', error.message); process.exit(1); } }) .command('logs <task-id> [path]', 'Print full log output of completed/running tasks', (yargs) => { yargs.positional('task-id', { type: 'string', describe: 'Task ID to retrieve logs for', demandOption: true }).positional('path', { type: 'string', default: process.cwd(), describe: 'Project directory path' }); }, async (argv) => { try { const logs = await cli.logs(argv['task-id'], argv.path); console.log(logs); } catch (error) { console.error('❌ Failed to retrieve logs:', error.message); process.exit(1); } }) .command('retry <task-id> [path]', 'Re-queue failed tasks for retry', (yargs) => { yargs.positional('task-id', { type: 'string', describe: 'Task ID to retry', demandOption: true }).positional('path', { type: 'string', default: process.cwd(), describe: 'Project directory path' }); }, async (argv) => { try { await cli.retry(argv['task-id'], argv.path); } catch (error) { console.error('❌ Failed to retry task:', error.message); process.exit(1); } }) .command('list-agents [path]', 'Display all available agent personas from /prompts directory', (yargs) => { yargs.positional('path', { type: 'string', default: process.cwd(), describe: 'Project directory path' }); }, async (argv) => { try { const agentList = await cli.listAgents(argv.path); console.log(agentList); } catch (error) { console.error('❌ Failed to list agents:', error.message); process.exit(1); } }) .command('attach <task-id>', 'Attach to a running agent task session', (yargs) => { yargs.positional('task-id', { type: 'string', describe: 'Task ID to attach to', demandOption: true }); }, async (argv) => { try { const attachCommand = await cli.attach(argv['task-id']); console.log(`🔗 Attaching to task: ${argv['task-id']}`); console.log(`Run: ${attachCommand}`); } catch (error) { console.error('❌ Failed to attach to session:', error.message); process.exit(1); } }) .command('merge <task-id> [path]', 'Merge completed task back to main branch', (yargs) => { yargs.positional('task-id', { type: 'string', describe: 'Task ID to merge', demandOption: true }).positional('path', { type: 'string', default: process.cwd(), describe: 'Project directory path' }); }, async (argv) => { try { await cli.merge(argv.path, argv['task-id']); } catch (error) { console.error('❌ Failed to merge task:', error.message); process.exit(1); } }) .command('auth <command> [method]', 'Manage authentication for CortexWeaver', (yargs) => { yargs .positional('command', { type: 'string', describe: 'Authentication command', choices: ['status', 'configure', 'switch'], demandOption: true }) .positional('method', { type: 'string', describe: 'Authentication method', choices: ['claude-code', 'gemini-cli', 'direct-api'] }) .example('$0 auth status', 'Show current authentication status') .example('$0 auth configure claude-code', 'Configure Claude Code authentication') .example('$0 auth switch gemini-cli', 'Switch to Gemini CLI authentication'); }, async (argv) => { try { const command = argv.command; const method = argv.method; switch (command) { case 'status': const status = await cli.authStatus(); console.log(status); break; case 'configure': await cli.authConfigure(method); break; case 'switch': if (!method) { console.error('❌ Method is required for switch command'); console.log('Available methods: claude-code, gemini-cli, direct-api'); process.exit(1); } await cli.authSwitch(method); break; default: console.error(`❌ Unknown auth command: ${command}`); process.exit(1); } } catch (error) { console.error('❌ Authentication command failed:', error.message); process.exit(1); } }) .demandCommand(1, 'You need at least one command before moving on') .help() .alias('h', 'help') .version('1.0.0') .alias('v', 'version') .parse(); //# sourceMappingURL=index.js.map