UNPKG

gemini-code-flow

Version:

AI-powered development orchestration for Gemini CLI - adapted from Claude Code Flow by ruvnet

146 lines 6.32 kB
#!/usr/bin/env node "use strict"; /** * Gemini Code Flow CLI * Adapted from Claude Code Flow by ruvnet */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const chalk_1 = __importDefault(require("chalk")); const orchestrator_1 = require("./core/orchestrator"); const sparc_1 = require("./commands/sparc"); const init_1 = require("./commands/init"); const agent_1 = require("./commands/agent"); const packageJson = require('../package.json'); const version = packageJson.version; const program = new commander_1.Command(); // ASCII art banner const banner = ` ${chalk_1.default.cyan(` ╔═══════════════════════════════════════════╗ ║ ║ ║ 🚀 GEMINI CODE FLOW v${version} ║ ║ ║ ║ AI-Powered Development Orchestration ║ ║ ║ ║ Adapted from Claude Code Flow ║ ║ by ruvnet ║ ║ ║ ╚═══════════════════════════════════════════╝ `)} `; program .name('gemini-flow') .description('AI-powered development orchestration for Gemini CLI') .version(version) .addHelpText('before', banner); // Init command program .command('init') .description('Initialize a new Gemini Code Flow project') .option('--sparc', 'Initialize with SPARC methodology') .option('--path <path>', 'Project path', '.') .action(async (options) => { const init = new init_1.InitCommand(); await init.execute(options); }); // SPARC command program .command('sparc [mode] [task]') .description('Run SPARC development mode') .option('-f, --file <file>', 'Input file for multimodal processing') .option('-p, --parallel <number>', 'Number of parallel agents', '3') .option('-m, --memory <path>', 'Memory bank path', './gemini-memory.json') .action(async (mode, task, options) => { const sparc = new sparc_1.SparcCommand(); await sparc.execute(mode, task, options); }); // Agent command program .command('agent <task>') .description('Run a single agent task') .option('-m, --mode <mode>', 'Agent mode', 'coder') .option('-s, --stream', 'Stream output in real-time') .action(async (task, options) => { const agent = new agent_1.AgentCommand(); await agent.execute(task, options); }); // Start command program .command('start') .description('Start the orchestrator in interactive mode') .option('-c, --config <file>', 'Configuration file', '.gemini-flow.json') .action(async (options) => { console.log(chalk_1.default.cyan('Starting Gemini Code Flow Orchestrator...')); try { const config = require(options.config); const orchestrator = new orchestrator_1.Orchestrator(config); orchestrator.on('started', () => { console.log(chalk_1.default.green('✓ Orchestrator started successfully')); }); orchestrator.on('agentSpawned', (agent) => { console.log(chalk_1.default.blue(`🤖 Agent ${agent.id} spawned in ${agent.mode} mode`)); }); orchestrator.on('agentCompleted', (agent) => { console.log(chalk_1.default.green(`✓ Agent ${agent.id} completed successfully`)); }); await orchestrator.start(); // Keep process alive process.on('SIGINT', async () => { console.log(chalk_1.default.yellow('\nGracefully shutting down...')); await orchestrator.stop(); process.exit(0); }); } catch (error) { console.error(chalk_1.default.red('Error starting orchestrator:'), error instanceof Error ? error.message : 'Unknown error'); process.exit(1); } }); // List command program .command('list') .description('List available SPARC modes') .action(() => { console.log(chalk_1.default.cyan('\nAvailable SPARC Development Modes:\n')); const modes = [ { icon: '🏗️', name: 'architect', desc: 'System design and architecture' }, { icon: '🧠', name: 'coder', desc: 'Clean, modular implementation' }, { icon: '🧪', name: 'tester', desc: 'Test-driven development' }, { icon: '🪲', name: 'debugger', desc: 'Troubleshooting and bug fixes' }, { icon: '🛡️', name: 'security', desc: 'Security audits and reviews' }, { icon: '📚', name: 'documentation', desc: 'Comprehensive documentation' }, { icon: '🔗', name: 'integrator', desc: 'Component integration' }, { icon: '📈', name: 'monitor', desc: 'Performance monitoring' }, { icon: '🧹', name: 'optimizer', desc: 'Code optimization' }, { icon: '❓', name: 'ask', desc: 'Task formulation guide' }, { icon: '🚀', name: 'devops', desc: 'Deployment and infrastructure' }, { icon: '📘', name: 'tutorial', desc: 'Interactive learning' }, { icon: '🔐', name: 'database', desc: 'Database management' }, { icon: '📋', name: 'specification', desc: 'Requirements and pseudocode' }, { icon: '♾️', name: 'mcp', desc: 'External service integration' }, { icon: '⚡', name: 'orchestrator', desc: 'Complex workflows' }, { icon: '🎨', name: 'designer', desc: 'UI/UX with multimodal' }, ]; modes.forEach(mode => { console.log(` ${mode.icon} ${chalk_1.default.yellow(mode.name.padEnd(15))} ${mode.desc}`); }); console.log(chalk_1.default.gray('\nExample: gemini-flow sparc architect "Design a REST API"')); }); // Status command program .command('status') .description('Show orchestrator status') .action(() => { console.log(chalk_1.default.yellow('Status command not yet implemented')); }); // Parse arguments program.parse(process.argv); // Show help if no command provided if (!process.argv.slice(2).length) { program.outputHelp(); } //# sourceMappingURL=cli.js.map