UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

4 lines 2.86 kB
import{parseSetupAnswer}from"./setup-answers.js";import{InvalidArgumentError}from"#compiled/commander/index.js";import{agentCommand}from"#cli/agent-command.js";import{applicationCommand}from"#cli/application-command.js";function parseSearchLimit(e){if(!/^\d+$/u.test(e))throw new InvalidArgumentError(`Expected a positive integer, received "${e}".`);let t=Number(e);if(t<1||t>100)throw new InvalidArgumentError(`Expected a limit between 1 and 100, received "${e}".`);return t}function registerRegistryCommands(e){let{applicationContext:t,logger:n,program:r}=e,i=agentCommand(r.command(`add [item]`),t).description(`Install a registry item; relative paths use the official eve registry.`).option(`-o, --overwrite`,`Overwrite existing files.`).option(`--skip-install`,`Run the item's setup flow without installing it.`).option(`--skip-setup`,`Skip the item's setup flow.`).option(`--non-interactive`,`Run without interactive prompts, instead emit structured NDJSON when further input is required`).option(`--answer <key=value>`,`Answer a setup question with JSON; requires --non-interactive; repeat for multiple answers.`,parseSetupAnswer).option(`-y, --yes`,`Run setup and accept its recommended defaults.`).addHelpText(`after`,` Search the registry: $ eve registry search <query> `).action(async(e,r)=>{if(e===void 0){i.outputHelp();return}if(r.answer!==void 0&&!r.nonInteractive)throw new InvalidArgumentError(`--answer requires --non-interactive.`);let{runAddCommand:a}=await import(`./registry.js`);await a(n,t.root,e,{...r,answers:r.answer})}),a=r.command(`registry`).description(`Configure and browse extension and agent registry catalogs.`);applicationCommand(a.command(`add <registries...>`),t).description(`Add registry namespace mappings to package.json.`).action(async e=>{let{runRegistryAddCommand:r}=await import(`./registry.js`);await r(n,t.root,e)}),applicationCommand(a.command(`list`),t).description(`List items from all registries or one source.`).option(`-r, --registry <source>`,`List items from one registry.`).option(`--json`,`Output as JSON`).action(async e=>{let{runRegistryListCommand:r}=await import(`./registry.js`);await r(n,t.root,e.registry,e)}),applicationCommand(a.command(`search <query>`),t).description(`Search all registries or one source.`).option(`-r, --registry <source>`,`Search one registry.`).option(`--limit <count>`,`Maximum results to return (default: 10).`,parseSearchLimit,10).option(`--json`,`Output as JSON`).action(async(e,r)=>{let{runRegistrySearchCommand:i}=await import(`./registry.js`);await i(n,t.root,e,r.registry,r)}),applicationCommand(a.command(`view <item>`),t).description(`Inspect one registry item.`).option(`--json`,`Output the raw registry item as JSON.`).action(async(e,r)=>{let{runRegistryViewCommand:i}=await import(`./registry.js`);await i(n,t.root,e,r)})}export{registerRegistryCommands};