UNPKG

netlify

Version:

Netlify command line tool

83 lines (82 loc) 4 kB
import { chalk } from '../../utils/command-helpers.js'; import requiresSiteInfoWithProject from '../../utils/hooks/requires-site-info-with-project.js'; const agents = (_options, command) => { command.help(); }; export const createAgentsCommand = (program) => { program .command('agents:create') .alias('agents:run') .argument('[prompt]', 'the prompt for the agent to execute') .description('Create and run a new agent task on your site') .option('-p, --prompt <prompt>', 'agent prompt') .option('-a, --agent <agent>', 'agent type (claude, codex, gemini)') .option('-m, --model <model>', 'model to use for the agent') .option('-b, --branch <branch>', 'git branch to work on') .option('--project <project>', 'project ID or name (if not in a linked directory)') .option('--json', 'output result as JSON') .hook('preAction', requiresSiteInfoWithProject) .addExamples([ 'netlify agents:create', 'netlify agents:create "Fix the login bug"', 'netlify agents:create --prompt "Add dark mode" --agent claude', 'netlify agents:create -p "Update README" -a codex -b feature-branch', 'netlify agents:create "Add tests" --project my-site-name', ]) .action(async (prompt, options, command) => { const { agentsCreate } = await import('./agents-create.js'); await agentsCreate(prompt, options, command); }); program .command('agents:list') .description('List agent tasks for the current site') .option('--json', 'output result as JSON') .option('-s, --status <status>', 'filter by status (new, running, done, error, cancelled)') .option('--project <project>', 'project ID or name (if not in a linked directory)') .hook('preAction', requiresSiteInfoWithProject) .addExamples(['netlify agents:list', 'netlify agents:list --status running', 'netlify agents:list --json']) .action(async (options, command) => { const { agentsList } = await import('./agents-list.js'); await agentsList(options, command); }); program .command('agents:show') .argument('<id>', 'agent task ID to show') .description('Show details of a specific agent task') .option('--json', 'output result as JSON') .option('--project <project>', 'project ID or name (if not in a linked directory)') .hook('preAction', requiresSiteInfoWithProject) .addExamples([ 'netlify agents:show 60c7c3b3e7b4a0001f5e4b3a', 'netlify agents:show 60c7c3b3e7b4a0001f5e4b3a --json', ]) .action(async (id, options, command) => { const { agentsShow } = await import('./agents-show.js'); await agentsShow(id, options, command); }); program .command('agents:stop') .argument('<id>', 'agent task ID to stop') .description('Stop a running agent task') .option('--json', 'output result as JSON') .option('--project <project>', 'project ID or name (if not in a linked directory)') .hook('preAction', requiresSiteInfoWithProject) .addExamples(['netlify agents:stop 60c7c3b3e7b4a0001f5e4b3a']) .action(async (id, options, command) => { const { agentsStop } = await import('./agents-stop.js'); await agentsStop(id, options, command); }); const name = chalk.greenBright('`agents`'); return program .command('agents') .description(`Manage Netlify AI agent tasks The ${name} command will help you run AI agents on your Netlify sites to automate development tasks Note: Agent tasks execute remotely on Netlify infrastructure, not locally.`) .addExamples([ 'netlify agents:create --prompt "Add a contact form"', 'netlify agents:list --status running', 'netlify agents:show 60c7c3b3e7b4a0001f5e4b3a', ]) .action(agents); }; //# sourceMappingURL=agents.js.map