UNPKG

@vigilbase/cli

Version:

Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.

41 lines (40 loc) • 1.91 kB
/** One piped answer is at most this long (an email address is at most 254 bytes). */ export declare const MAX_ANSWER_BYTES = 256; export type PromptIO = { stdin?: NodeJS.ReadableStream; stderr: NodeJS.WritableStream; }; export declare function hasInteractiveInput(stdin: NodeJS.ReadableStream | undefined): boolean; /** * A visible one-line prompt on a TTY (account picker, confirmations): the * trimmed answer, or null when the input ended (Ctrl-D) before one. */ export declare function promptLine(io: PromptIO, label: string): Promise<string | null>; /** * One line of piped input, without consuming the next one: whatever follows * the newline is pushed back onto the stream for the next prompt. Bytes past * `MAX_ANSWER_BYTES` are dropped up to the newline, so an overlong line comes * back too long and fails validation. Null at the end of the input. */ export declare function readPipedLine(stdin: NodeJS.ReadableStream): Promise<string | null>; /** * A visible prompt for the email verification. On a terminal it is * `promptLine`; without one the label still goes to stderr and the answer is * one line of piped stdin. Null when the input ended without an answer. */ export declare function promptAnswer(io: PromptIO, label: string): Promise<string | null>; /** * `[y/N]` upload confirmation: an explicit `y` is required. `--yes` (or its * alias `--confirm`) answers yes; without a terminal and without them it is * CONFIRMATION_REQUIRED. */ export declare function confirmUpload(io: PromptIO, question: string, options: { isConfirmed: boolean; flag?: string; }): Promise<boolean>; /** * `[Y/n]` question where Enter means yes (installing cf). The caller handles * `--yes` and the no-terminal case; an input that ends before an answer is * CONFIRMATION_REQUIRED. */ export declare function confirmDefaultYes(io: PromptIO, question: string): Promise<boolean>;