@capgo/cli
Version:
A CLI to upload to capgo servers
74 lines (73 loc) • 2.66 kB
TypeScript
export declare const INIT_CANCEL: unique symbol;
export type InitLogTone = 'cyan' | 'yellow' | 'green' | 'red';
export type InitScreenTone = 'cyan' | 'blue' | 'green' | 'yellow';
export interface InitScreen {
title?: string;
introLines?: string[];
phaseLabel?: string;
progress?: number;
stepLabel?: string;
stepSummary?: string;
roadmapLine?: string;
statusLine?: string;
resumeLine?: string;
completionLines?: string[];
tone?: InitScreenTone;
}
export interface ConfirmPrompt {
kind: 'confirm';
message: string;
initialValue?: boolean;
resolve: (value: boolean | symbol) => void;
}
export interface TextPrompt {
kind: 'text';
message: string;
placeholder?: string;
validate?: (value: string | undefined) => string | undefined;
error?: string;
resolve: (value: string | symbol) => void;
}
export interface SelectPromptOption {
label: string;
hint?: string;
value: string;
}
export interface SelectPrompt {
kind: 'select';
message: string;
options: SelectPromptOption[];
resolve: (value: string | symbol) => void;
}
export type PromptRequest = ConfirmPrompt | TextPrompt | SelectPrompt;
export interface InitLogEntry {
message: string;
tone: InitLogTone;
}
export interface InitVersionWarning {
currentVersion: string;
latestVersion: string;
majorVersion: string;
}
export interface InitRuntimeState {
screen?: InitScreen;
logs: InitLogEntry[];
spinner?: string;
prompt?: PromptRequest;
versionWarning?: InitVersionWarning;
}
export declare function subscribe(listener: () => void): () => boolean;
export declare function getInitSnapshot(): InitRuntimeState;
export declare function ensureInitInkSession(): void;
export declare function stopInitInkSession(finalMessage?: {
text: string;
tone: 'green' | 'yellow';
}): void;
export declare function setInitScreen(screen: InitScreen): void;
export declare function pushInitLog(message: string, tone: InitLogTone): void;
export declare function clearInitLogs(): void;
export declare function setInitSpinner(message?: string): void;
export declare function requestInitConfirm(message: string, initialValue?: boolean): Promise<boolean | symbol>;
export declare function requestInitText(message: string, placeholder?: string, validate?: (value: string | undefined) => string | undefined): Promise<string | symbol>;
export declare function requestInitSelect(message: string, options: SelectPromptOption[]): Promise<string | symbol>;
export declare function setInitVersionWarning(currentVersion: string, latestVersion: string, majorVersion: string): void;