/** * Prompt service for CLI user input operations * * Abstracts user prompts to enable testing with scripted responses * and maintain explicit effect tracking for all IO operations. */ import type { SelectOptions as ClackSelectOptions } from "@clack/prompts"; import { Effect } from "effect"; declare const CancelledError_base: new = {}>(args: import("effect/Types").Equals extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & { readonly _tag: "CancelledError"; } & Readonly; /** * Error thrown when user cancels an operation (e.g., Ctrl+C in prompts) * * This error should be caught at the CLI entry point and result in a * graceful exit with code 0 (not an error condition). */ export declare class CancelledError extends CancelledError_base<{ readonly message: string; }> { } /** Text prompt options */ export type TextOptions = { readonly message: string; readonly placeholder?: string | undefined; readonly defaultValue?: string | undefined; readonly validate?: ((value: string) => string | undefined) | undefined; }; /** Re-export clack's SelectOptions for select prompts */ export type SelectOptions = ClackSelectOptions; /** Confirm prompt options */ export type ConfirmOptions = { readonly message: string; readonly initialValue?: boolean | undefined; }; /** Scripted responses for test mode */ export type ScriptedResponses = { readonly textResponses: ReadonlyArray; readonly selectResponses: ReadonlyArray; readonly confirmResponses: ReadonlyArray; }; /** Service API interface for documentation and extension */ export interface PromptServiceApi { readonly text: (options: TextOptions) => Effect.Effect; readonly select: (options: SelectOptions) => Effect.Effect; readonly confirm: (options: ConfirmOptions) => Effect.Effect; } declare const PromptService_base: Effect.Service.Class Effect.Effect; /** Select from options prompt */ select: (options: SelectOptions) => Effect.Effect; /** Yes/no confirmation prompt */ confirm: (options: ConfirmOptions) => Effect.Effect; }, never, never>; }>; /** * Service for handling interactive command-line prompts. * * Provides methods for text input, selection, and confirmation prompts using the clack library. * All prompts return Effects that may fail with CancelledError if the user cancels the prompt. */ export declare class PromptService extends PromptService_base { /** * Create a test layer with scripted responses * * Responses are consumed in order. If responses run out, fails with CancelledError. * This ensures tests explicitly provide all expected responses. * * Note: Select responses use `unknown` internally. Test callers must ensure * provided values match the expected select types at runtime. */ static readonly makeTest: (responses: ScriptedResponses) => import("effect/Layer").Layer; /** * Default test layer with empty responses (fails immediately on any prompt) */ static readonly Test: import("effect/Layer").Layer; } export {}; //# sourceMappingURL=PromptService.d.ts.map