UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

100 lines 3.28 kB
/** * CLI Handler Types * * Defines the interface for CLI command handlers extracted from the monolithic router. * * @implements @.aiwg/architecture/decisions/ADR-001-unified-extension-system.md * @source @src/cli/router.ts * @issue #33 */ /** * Result of a CLI handler execution */ export interface HandlerResult { /** Exit code (0 = success, non-zero = error) */ exitCode: number; /** Output message (optional) */ message?: string; /** Error details (optional) */ error?: Error; } /** * Context passed to handlers */ export interface HandlerContext { /** Command arguments (after the command name) */ args: string[]; /** Raw arguments including command name */ rawArgs: string[]; /** Current working directory */ cwd: string; /** Framework root path */ frameworkRoot: string; /** Whether running in dry-run mode */ dryRun?: boolean; /** * Cancellation signal. Aborted on SIGINT/SIGTERM by the top-level entry. * Long-running handlers MUST check `signal.aborted` between iterations * (or `throwIfAborted()`), and any fetch()/child-process call that * accepts a signal MUST plumb this through (typically via * `AbortSignal.any([ctx.signal, AbortSignal.timeout(N)])`). * * Handlers that never block or loop can safely ignore this field. * Optional so existing handlers can adopt incrementally (#920). */ signal?: AbortSignal; } /** * CLI command handler interface * * All extracted handlers implement this interface for uniform dispatch. */ export interface CommandHandler { /** Handler identifier matching command name */ id: string; /** Human-readable name */ name: string; /** Description for help text */ description: string; /** Command category for help grouping */ category: CommandCategory; /** Command aliases (e.g., ['-new', '--new'] for 'new') */ aliases: string[]; /** Execute the handler */ execute(ctx: HandlerContext): Promise<HandlerResult>; } /** * Command categories for help text grouping */ export type CommandCategory = 'framework' | 'project' | 'workspace' | 'mcp' | 'toolsmith' | 'catalog' | 'utility' | 'plugin' | 'scaffolding' | 'channel' | 'maintenance' | 'ralph' | 'index' | 'orchestration' | 'daemon' | 'config' | 'ops' | 'sandbox' | 'agentic-tools'; /** * Handler factory function type */ export type HandlerFactory = () => CommandHandler; /** * Script runner options */ export interface ScriptRunnerOptions { /** Working directory */ cwd?: string; /** Additional environment variables */ env?: Record<string, string>; /** Timeout in milliseconds */ timeout?: number; /** Capture stdout/stderr instead of inheriting (for quiet mode) */ capture?: boolean; } /** * Script runner interface for delegating to existing scripts */ export interface ScriptRunner { /** * Run a script from the framework root * * @param scriptPath - Relative path to script from framework root * @param args - Arguments to pass to the script * @param options - Execution options */ run(scriptPath: string, args: string[], options?: ScriptRunnerOptions): Promise<HandlerResult>; } //# sourceMappingURL=types.d.ts.map