type ValidateInput = (value: string) => boolean | string; export type PromptLinePrinter = (line: string) => void; interface PromptOption { hint?: string; label: string; value: T; } /** * Prompt adapter used by CLI scaffold flows and migration wizard flows. */ export interface ReadlinePrompt { close(): void; select(message: string, options: PromptOption[], defaultValue?: number): Promise; text(message: string, defaultValue: string, validate?: ValidateInput): Promise; } /** * Output adapters used by prompt rendering and validation feedback. */ export interface ReadlinePromptOutput { /** Render one informational prompt line. */ printLine?: PromptLinePrinter; /** Render one validation or selection error line. */ errorLine?: PromptLinePrinter; } /** * Adapter interface for readline-style prompt interactions. * * Public CLI code uses the native readline implementation, while tests can * substitute lightweight doubles that expose the same `question` and `close` * methods. */ export interface ReadlineQuestionAdapter { /** Close the underlying prompt interface and release any open handles. */ close(): void; /** * Render one prompt and resolve with the collected answer string. * * @param query Prompt text written to the active output stream. * @param callback Callback that receives the entered answer. */ question(query: string, callback: (answer: string) => void): void; } /** * Create the default readline-backed prompt implementation for the CLI. * * @param output Optional line printers for prompt and validation output. * @returns A prompt adapter that reads from stdin and writes to stdout. */ export declare function createReadlinePrompt(output?: ReadlinePromptOutput): ReadlinePrompt; /** * Build a prompt adapter around a supplied readline-style question interface. * * This keeps the production CLI path unchanged while letting tests validate * retry behavior without stubbing global stdin/stdout. * * @param rl Readline-compatible question adapter. * @param output Optional line printers for prompt and validation output. */ export declare function createReadlinePromptWithInterface(rl: ReadlineQuestionAdapter, output?: ReadlinePromptOutput): ReadlinePrompt; export {};