UNPKG

gemini-code-flow

Version:

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

51 lines (49 loc) • 2 kB
"use strict"; /** * Agent Command for Gemini Code Flow * 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 }); exports.AgentCommand = void 0; const chalk_1 = __importDefault(require("chalk")); const ora_1 = __importDefault(require("ora")); const gemini_client_1 = require("../core/gemini-client"); class AgentCommand { async execute(task, options) { const mode = (options.mode || 'coder'); const spinner = (0, ora_1.default)(`šŸ¤– Agent working on task...`).start(); try { const apiKey = process.env.GEMINI_API_KEY; if (!apiKey) { throw new Error('GEMINI_API_KEY environment variable is required'); } const client = new gemini_client_1.GeminiClient({ apiKey }); const prompt = `You are an AI assistant in ${mode} mode. Task: ${task} Please provide a clear, actionable response. Be concise but thorough.`; if (options.stream) { spinner.stop(); console.log(chalk_1.default.cyan('šŸ¤– Agent response:\n')); for await (const chunk of client.streamExecute(prompt, mode)) { process.stdout.write(chunk); } console.log('\n'); } else { const result = await client.execute(prompt, mode); spinner.succeed('Agent completed task'); console.log(chalk_1.default.cyan('\nšŸ¤– Agent response:\n')); console.log(result); } } catch (error) { spinner.fail('Agent failed'); console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : 'Unknown error'); } } } exports.AgentCommand = AgentCommand; //# sourceMappingURL=agent.js.map