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
125 lines • 5.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLIParsers = exports.CLIValidators = exports.CLICommands = exports.CLI = void 0;
const commands_1 = require("./commands");
const validators_1 = require("./validators");
const parsers_1 = require("./parsers");
/**
* Main CLI class - refactored to use modular components
* This serves as the main entry point and orchestrates the various CLI modules
*/
class CLI {
constructor() {
this.commands = new commands_1.CLICommands();
this.validators = new validators_1.CLIValidators();
}
// Authentication commands
async authStatus(projectRoot = process.cwd()) {
return this.commands.authStatus(projectRoot);
}
async authConfigure(method, projectRoot = process.cwd()) {
return this.commands.authConfigure(method, projectRoot);
}
async authSwitch(method, projectRoot = process.cwd()) {
return this.commands.authSwitch(method, projectRoot);
}
// Task management commands
async logs(taskId, projectRoot = process.cwd()) {
return this.commands.logs(taskId, projectRoot);
}
async retry(taskId, projectRoot = process.cwd()) {
return this.commands.retry(taskId, projectRoot);
}
// Agent management commands
async listAgents(projectRoot = process.cwd()) {
return this.commands.listAgents(projectRoot);
}
// Project lifecycle commands
async init(projectRoot = process.cwd()) {
return this.commands.init(projectRoot);
}
// Status and monitoring commands
async status(projectRoot = process.cwd()) {
return this.validators.status(projectRoot);
}
// Orchestration commands
async start(projectRoot = process.cwd()) {
return this.validators.start(projectRoot);
}
// Session management commands
async attach(sessionId) {
return this.validators.attach(sessionId);
}
async merge(projectRoot = process.cwd(), taskId) {
return this.validators.merge(projectRoot, taskId);
}
// Maintenance commands
async cleanup(projectRoot = process.cwd()) {
return this.validators.cleanup(projectRoot);
}
// Validation method (moved to CLIUtils but kept for compatibility)
validateProject(projectRoot) {
// Import CLIUtils here to avoid circular dependencies
const { CLIUtils } = require('../cli-utils');
return CLIUtils.validateProject(projectRoot);
}
// Static method to parse command line arguments
static parseArguments(args) {
return parsers_1.CLIParsers.parseArguments(args);
}
// Static method to validate parsed commands
static validateCommand(command, args) {
return parsers_1.CLIParsers.validateCommand(command, args);
}
// Static method to get help text
static getHelp(command) {
return parsers_1.CLIParsers.formatHelp(command);
}
// Execute a command with parsed arguments
async executeCommand(command, args, projectRoot) {
const root = projectRoot || args.options.project || args.options.p || process.cwd();
switch (command) {
case 'init':
return this.init(args.positional[0] || root);
case 'start':
return this.start(root);
case 'auth':
const subcommand = args.positional[0];
switch (subcommand) {
case 'status':
return this.authStatus(root);
case 'configure':
return this.authConfigure(args.positional[1], root);
case 'switch':
return this.authSwitch(args.positional[1], root);
default:
throw new Error(`Unknown auth subcommand: ${subcommand}`);
}
case 'status':
return this.status(root);
case 'logs':
return this.logs(args.positional[0], root);
case 'retry':
return this.retry(args.positional[0], root);
case 'merge':
return this.merge(root, args.positional[0]);
case 'attach':
return this.attach(args.positional[0]);
case 'cleanup':
return this.cleanup(root);
case 'list-agents':
return this.listAgents(root);
default:
throw new Error(`Unknown command: ${command}`);
}
}
}
exports.CLI = CLI;
// Re-export modular components for direct access if needed
var commands_2 = require("./commands");
Object.defineProperty(exports, "CLICommands", { enumerable: true, get: function () { return commands_2.CLICommands; } });
var validators_2 = require("./validators");
Object.defineProperty(exports, "CLIValidators", { enumerable: true, get: function () { return validators_2.CLIValidators; } });
var parsers_2 = require("./parsers");
Object.defineProperty(exports, "CLIParsers", { enumerable: true, get: function () { return parsers_2.CLIParsers; } });
//# sourceMappingURL=index.js.map