UNPKG

askeroo

Version:

A modern CLI prompt library with flow control, history navigation, and conditional prompts

76 lines 2.61 kB
/** * RuntimeState - Manages all runtime state for the prompt flow * * Consolidated state management with clear, descriptive method names. * Handles answers, navigation, group context, and flow control. */ import { Answers } from "../types/index.js"; export declare class RuntimeState { private answers; private interactivePrompts; private currentPromptIndex; private isInFlowExecution; private groupHierarchy; private processedGroups; storeAnswer(promptId: string, value: any): void; retrieveAnswer(promptId: string): any | undefined; hasStoredAnswer(promptId: string): boolean; getAllAnswers(): Answers; getAnswerCount(): number; removeAnswer(promptId: string): void; clearAllAnswers(): void; registerPrompt(promptId: string): void; getPromptHistory(): string[]; getTotalPromptCount(): number; clearPromptHistory(): void; getCurrentPromptIndex(): number; advanceToNextPrompt(): number; returnToPreviousPrompt(): number; setPromptIndex(index: number): void; isReplayingAnswers(): boolean; hasReachedEndOfFlow(): boolean; enterGroup(groupId: string): void; exitGroup(): string | undefined; getCurrentGroupId(): string | undefined; getGroupHierarchy(): string[]; getGroupDepth(): number; clearGroupHierarchy(): void; markGroupAsProcessed(groupId: string): void; isGroupProcessed(groupId: string): boolean; clearProcessedGroups(): void; beginFlowExecution(): void; endFlowExecution(): void; isExecutingFlow(): boolean; /** * Remove answers for prompts that come after the current position * Used for back navigation to clear future answers */ clearAnswersAfterCurrentPosition(): void; /** * Remove answers for prompts that are no longer in the flow * Used after replay to clean up unreachable answers */ clearUnreachableAnswers(): void; /** * Reset state for a new replay cycle * Clears prompts, groups, and processed groups tracking * Keeps answers and currentPromptIndex intact */ prepareForReplay(): void; /** * Complete reset of all state * Use with caution - typically only needed when creating a fresh runtime */ resetAll(): void; getDebugInfo(): { answerCount: number; totalPrompts: number; currentIndex: number; isExecuting: boolean; isReplaying: boolean; groupDepth: number; currentGroup: string | undefined; processedGroupsCount: number; }; } //# sourceMappingURL=runtime-state.d.ts.map