@re-shell/cli
Version:
Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja
117 lines (116 loc) • 3.81 kB
TypeScript
export interface PromptChoice {
title: string;
value: any;
description?: string;
disabled?: boolean | string;
}
export interface PromptValidator {
(value: any): boolean | string | Promise<boolean | string>;
}
export interface PromptTransformer {
(value: any): any;
}
export interface PromptSuggestion {
title: string;
value: string;
description?: string;
}
export interface PromptConfig {
type: 'text' | 'password' | 'confirm' | 'number' | 'select' | 'multiselect' | 'autocomplete' | 'list';
name: string;
message: string;
initial?: any;
choices?: PromptChoice[];
validate?: PromptValidator;
format?: PromptTransformer;
min?: number;
max?: number;
separator?: string;
suggest?: (input: string) => Promise<PromptSuggestion[]> | PromptSuggestion[];
limit?: number;
instructions?: boolean;
hint?: string;
warn?: string;
onCancel?: () => void;
}
export interface EnhancedPromptOptions {
nonInteractive?: boolean;
defaults?: Record<string, any>;
skipValidation?: boolean;
theme?: PromptTheme;
timeout?: number;
saveResponses?: boolean;
responseFile?: string;
}
export interface PromptTheme {
prefix: string;
suffix: string;
separator: string;
errorPrefix: string;
successPrefix: string;
warningPrefix: string;
infoPrefix: string;
}
export interface PromptHistory {
timestamp: Date;
prompts: Array<{
name: string;
value: any;
duration: number;
}>;
}
export declare class InteractivePrompter {
private theme;
private history;
private responseCache;
private suggestions;
constructor(options?: EnhancedPromptOptions);
private getDefaultTheme;
private setupPromptTheme;
private loadSuggestions;
prompt<T = any>(config: PromptConfig | PromptConfig[], options?: EnhancedPromptOptions): Promise<T>;
private enhancePromptConfig;
private handleNonInteractive;
private recordHistory;
private saveResponses;
promptProjectSetup(): Promise<{
name: string;
framework: string;
typescript: boolean;
packageManager: string;
template: string;
installDependencies: boolean;
}>;
promptMicrofrontendConfig(): Promise<{
name: string;
framework: string;
port: number;
exposed: string[];
typescript: boolean;
}>;
promptConfigurationUpdate(): Promise<{
updateGlobal: boolean;
updateProject: boolean;
backupExisting: boolean;
}>;
getCachedResponse(name: string): any;
setCachedResponse(name: string, value: any): void;
clearCache(): void;
getHistory(): PromptHistory[];
clearHistory(): void;
addSuggestion(category: string, suggestion: PromptSuggestion): void;
getSuggestions(category: string): PromptSuggestion[];
static validators: {
required: (message?: string) => (value: any) => string | true;
minLength: (min: number, message?: string) => (value: string) => string | true;
maxLength: (max: number, message?: string) => (value: string) => string | true;
pattern: (pattern: RegExp, message?: string) => (value: string) => string | true;
email: (message?: string) => (value: string) => string | true;
url: (message?: string) => (value: string) => string | true;
port: (message?: string) => (value: number) => string | true;
combine: (...validators: PromptValidator[]) => (value: any) => Promise<string | boolean>;
};
}
export declare function createPrompter(options?: EnhancedPromptOptions): InteractivePrompter;
export declare function getGlobalPrompter(): InteractivePrompter;
export declare function setGlobalPrompter(prompter: InteractivePrompter): void;