@agentled/cli
Version:
CLI for Agentled — manage workflows, apps, and knowledge from the command line. Zero context-window cost for AI agents.
34 lines • 1.45 kB
JavaScript
import { AgentledClient } from '../client.js';
import { printOutput, printError } from '../utils/output.js';
export function registerAiCommands(program) {
const ai = program
.command('ai')
.description('Test AI actions');
ai
.command('test')
.description('Test an AI prompt with variables and response structure')
.requiredOption('--template <template>', 'Prompt template with {{variables}}')
.option('--vars <json>', 'Variables as JSON')
.option('--response-structure <json>', 'Expected output shape as JSON')
.option('--response-type <type>', 'Response type')
.option('--system-prompt <prompt>', 'System prompt')
.option('--format <fmt>', 'Output format', 'json')
.action(async (opts) => {
try {
const variables = opts.vars ? JSON.parse(opts.vars) : undefined;
const responseStructure = opts.responseStructure
? JSON.parse(opts.responseStructure)
: undefined;
const client = new AgentledClient();
const result = await client.testAiAction(opts.template, variables, responseStructure, {
responseType: opts.responseType,
systemPrompt: opts.systemPrompt,
});
printOutput(result, opts.format);
}
catch (e) {
printError(e.message);
}
});
}
//# sourceMappingURL=ai.js.map