import { type Command } from 'commander'; /** Thrown in place of a handler's process.exit() call while in the shell. */ export declare class TrappedExitError extends Error { readonly code: number; constructor(code: number); } /** * Return every option on the tree to its post-registration value, so one shell * line cannot leak flags into the next. Iterating in registration order * reproduces Commander's own resolution for keys owned by several flags. */ export declare function resetCommandState(program: Command): void; /** * Make the whole command tree throw instead of exiting, and route help/error * text through the supplied writers. Call once before the first shell line. */ export declare function configureForRepl(program: Command, output: { writeOut: (s: string) => void; writeErr: (s: string) => void; }): void; export declare function isBenignCommanderError(error: unknown): boolean; /** * Parse and run one command line against the shared program. * * Resets sticky option state first and traps process.exit for the duration, so * a handler that bails with exit(1) reports an error instead of killing the * session. Returns the exit code the equivalent one-shot invocation would have. */ export declare function runProgramLine(program: Command, argv: string[]): Promise; export interface CommandSpec { /** Space-joined path, e.g. 'config show'. */ path: string; description: string; /** Long flags including leading dashes, e.g. '--force'. */ flags: string[]; } /** Flatten the tree for tab completion and the shell's own help listing. */ export declare function collectCommandSpecs(program: Command): CommandSpec[]; //# sourceMappingURL=program-runtime.d.ts.map