UNPKG

@catladder/cli

Version:

Panter cli tool for cloud CI/CD and DevOps

26 lines 1.23 kB
import type { CommandDef, IO, InputDef, InputResultType, InputsSchema } from "../core/types"; import { BaseContext } from "./baseContext"; export interface ProgrammaticOptions { /** Pre-supplied values keyed by input name */ inputs?: Record<string, unknown>; /** Called on every log message. Defaults to no-op. */ onLog?: (message: string) => void; } declare class ProgrammaticContext<TInputs extends InputsSchema> extends BaseContext<TInputs> { private inputs; private onLog?; constructor(command: CommandDef<TInputs>, options: ProgrammaticOptions); log(message: string): void; confirm(): Promise<boolean>; protected resolveInput<P extends InputDef>(name: string, spec: P): Promise<InputResultType<P>>; } /** * Create a CommandContext that resolves inputs from pre-supplied values. * Used for non-interactive CLI mode and programmatic invocation. */ export declare function createProgrammaticContext<TInputs extends InputsSchema>(command: CommandDef<TInputs>, options?: ProgrammaticOptions): ProgrammaticContext<TInputs>; /** * Create a bare IO instance for helper functions that only need log + promptDirect. */ export declare function createProgrammaticIO(options?: ProgrammaticOptions): IO; export {};