UNPKG

autoagent-cli

Version:

Run autonomous AI agents using Claude or Gemini for task execution

55 lines (54 loc) 2.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.registerCreateCommand = registerCreateCommand; const autonomous_agent_1 = require("../../core/autonomous-agent"); const logger_1 = require("../../utils/logger"); function registerCreateCommand(program) { program .command('create') .description('Create a new task') .option('-t, --title <title>', 'Task title') .option('-d, --description <description>', 'Task description') .option('-a, --acceptance <criteria>', 'Acceptance criteria (can be used multiple times)', (value, prev) => { return Array.isArray(prev) && prev.length > 0 ? [...prev, value] : [value]; }, []) .option('--details <details>', 'Technical details') .option('--plan <plan>', 'Implementation plan') .option('--testing <strategy>', 'Testing strategy') .option('--tags <tags>', 'Comma-separated tags') .option('-p, --provider <provider>', 'Override AI provider for this operation (claude or gemini)') .option('-w, --workspace <path>', 'Workspace directory') .action(async (options) => { try { if (options.title === undefined || options.title === '') { logger_1.Logger.error('Task title is required'); process.exit(1); } const agent = new autonomous_agent_1.AutonomousAgent({ provider: options.provider, workspace: options.workspace }); await agent.initialize(); const content = { description: options.description !== undefined && options.description !== '' ? options.description : 'No description provided', technicalDetails: options.details !== undefined && options.details !== '' ? options.details : '', implementationPlan: options.plan !== undefined && options.plan !== '' ? options.plan : '', acceptanceCriteria: options.acceptance || [], testingStrategy: options.testing, tags: options.tags !== undefined && options.tags !== '' ? options.tags.split(',').map(t => t.trim()) : undefined }; const taskId = await agent.createTask(options.title, content); logger_1.Logger.success(`✅ Created task: ${taskId}`); logger_1.Logger.info(`Title: ${options.title}`); if (content.tags && content.tags.length > 0) { logger_1.Logger.info(`Tags: ${content.tags.join(', ')}`); } logger_1.Logger.info('\nRun with the task ID to execute:'); logger_1.Logger.info(` autoagent run ${taskId}`); } catch (error) { logger_1.Logger.error(`Failed: ${error instanceof Error ? error.message : String(error)}`); process.exit(1); } }); }