UNPKG

@catladder/cli

Version:

Panter cli tool for cloud CI/CD and DevOps

22 lines 1.11 kB
import type { CommandContext, CommandDef, InputDef, InputResultType, InputsSchema, OptionalInput } from "../core/types"; /** * Base class for CommandContext implementations. * Handles caching, the `get()` method, and `promptDirect` delegation. * Subclasses only implement the adapter-specific resolution logic. */ export declare abstract class BaseContext<TInputs extends InputsSchema> implements CommandContext<TInputs> { protected readonly command: CommandDef<TInputs>; private cache; constructor(command: CommandDef<TInputs>); abstract log(message: string): void; abstract confirm(message: string): Promise<boolean>; /** * Resolve a single input value. Called once per input (result is cached). * Implementations check pre-supplied values, prompt interactively, use defaults, or throw. */ protected abstract resolveInput<P extends InputDef>(name: string, spec: P): Promise<InputResultType<P>>; get<K extends keyof TInputs & string>(name: K): Promise<OptionalInput<TInputs[K]>>; promptDirect<P extends InputDef>(spec: P & { name: string; }): Promise<InputResultType<P>>; }