UNPKG

gemini-code-flow

Version:

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

137 lines (127 loc) 4.77 kB
"use strict"; /** * Init 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.InitCommand = void 0; const fs_extra_1 = __importDefault(require("fs-extra")); const path_1 = __importDefault(require("path")); const chalk_1 = __importDefault(require("chalk")); const inquirer_1 = __importDefault(require("inquirer")); class InitCommand { async execute(options) { const projectPath = path_1.default.resolve(options.path || '.'); console.log(chalk_1.default.cyan('🚀 Initializing Gemini Code Flow project...')); // Create project structure await this.createProjectStructure(projectPath); // Create configuration const config = await this.createConfiguration(options.sparc); await fs_extra_1.default.writeJson(path_1.default.join(projectPath, '.gemini-flow.json'), config, { spaces: 2 }); // Create README if doesn't exist const readmePath = path_1.default.join(projectPath, 'README.md'); if (!(await fs_extra_1.default.pathExists(readmePath))) { await this.createReadme(readmePath); } console.log(chalk_1.default.green('✓ Project initialized successfully!')); console.log(chalk_1.default.yellow('\nNext steps:')); console.log(' 1. Set your GEMINI_API_KEY environment variable'); console.log(' 2. Run: gemini-flow sparc architect "Design my system"'); console.log(' 3. Or run: gemini-flow start (for interactive mode)'); } async createProjectStructure(projectPath) { const dirs = [ 'src', 'tests', 'docs', '.gemini-flow', ]; for (const dir of dirs) { await fs_extra_1.default.ensureDir(path_1.default.join(projectPath, dir)); } } async createConfiguration(sparc) { const questions = [ { type: 'input', name: 'maxAgents', message: 'Maximum concurrent agents:', default: '5', validate: (input) => { const num = parseInt(input); return num > 0 && num <= 10 ? true : 'Please enter a number between 1 and 10'; }, }, { type: 'list', name: 'defaultMode', message: 'Default agent mode:', choices: [ 'architect', 'coder', 'tester', 'debugger', 'documentation', ], default: 'coder', }, ]; const answers = await inquirer_1.default.prompt(questions); return { maxAgents: parseInt(answers.maxAgents), memoryPath: './.gemini-flow/memory.json', defaultMode: answers.defaultMode, modes: { architect: { temperature: 0.7, maxTokens: 8000, }, coder: { temperature: 0.3, maxTokens: 4000, }, tester: { temperature: 0.2, maxTokens: 4000, }, }, ...(sparc && { sparc: { enabled: true, methodology: 'systematic', parallelExecution: true, }, }), }; } async createReadme(readmePath) { const content = `# Gemini Code Flow Project This project uses Gemini Code Flow for AI-powered development orchestration. ## Getting Started \`\`\`bash # Set your API key export GEMINI_API_KEY="your-api-key-here" # Run SPARC modes gemini-flow sparc architect "Design system architecture" gemini-flow sparc coder "Implement the core features" gemini-flow sparc tester "Create comprehensive tests" # Or start interactive mode gemini-flow start \`\`\` ## Available Commands - \`gemini-flow list\` - Show available SPARC modes - \`gemini-flow agent <task>\` - Run single agent task - \`gemini-flow sparc <mode> <task>\` - Run SPARC development mode - \`gemini-flow start\` - Start interactive orchestrator ## Configuration Edit \`.gemini-flow.json\` to customize your setup. Built with Gemini Code Flow - adapted from Claude Code Flow by ruvnet. `; await fs_extra_1.default.writeFile(readmePath, content); } } exports.InitCommand = InitCommand; //# sourceMappingURL=init.js.map