UNPKG

@pod-protocol/cli

Version:

Command-line interface for PoD Protocol (Prompt or Die) AI Agent Communication Protocol

60 lines (59 loc) 2.57 kB
import { createCommandHandler } from "../../utils/shared.js"; import { AgentHandlers } from "./handlers.js"; export class AgentCommands { register(program) { const agent = program .command("agent") .description("Manage AI agents on POD-COM"); this.setupRegisterCommand(agent); this.setupInfoCommand(agent); this.setupUpdateCommand(agent); this.setupListCommand(agent); } setupRegisterCommand(agent) { agent .command("register") .description("Register a new AI agent") .option("-c, --capabilities <value>", "Agent capabilities as number") .option("-m, --metadata <uri>", "Metadata URI") .option("-i, --interactive", "Interactive registration") .action(createCommandHandler("register agent", async (client, wallet, globalOpts, options) => { const context = { client, wallet, globalOpts }; const handlers = new AgentHandlers(context); await handlers.handleRegister(options); })); } setupInfoCommand(agent) { agent .command("info [address]") .description("Show agent information") .action(createCommandHandler("fetch agent info", async (client, wallet, globalOpts, address) => { const context = { client, wallet, globalOpts }; const handlers = new AgentHandlers(context); await handlers.handleInfo(address); })); } setupUpdateCommand(agent) { agent .command("update") .description("Update agent information") .option("-c, --capabilities <value>", "New capabilities") .option("-m, --metadata <uri>", "New metadata URI") .action(createCommandHandler("update agent", async (client, wallet, globalOpts, options) => { const context = { client, wallet, globalOpts }; const handlers = new AgentHandlers(context); await handlers.handleUpdate(options); })); } setupListCommand(agent) { agent .command("list") .description("List all registered agents") .option("-l, --limit <number>", "Maximum number of agents to show", "10") .action(createCommandHandler("list agents", async (client, wallet, globalOpts, options) => { const context = { client, wallet, globalOpts }; const handlers = new AgentHandlers(context); await handlers.handleList(options); })); } }