UNPKG

askeroo

Version:

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

51 lines 1.46 kB
/** * IdGenerator - Handles generation of stable, deterministic IDs for prompts and groups * * This class encapsulates all ID generation logic, making it easier to test and maintain. * IDs are generated based on the context (type, message, group stack, etc.) to ensure * that the same prompt in the same context always gets the same ID. */ export interface FieldIdContext { kind: string; message?: string; groupStack: string[]; stepIndex?: number; customId?: string; } export interface GroupIdContext { groupStack: string[]; groupCount: number; flowType?: string; customId?: string; } export declare class IdGenerator { private groupCounter; /** * Generate a stable ID for a field (prompt) */ generateFieldId(context: FieldIdContext): string; /** * Generate a stable ID for a group */ generateGroupId(context: GroupIdContext): string; /** * Increment and return the current group count * This is used to generate unique group IDs */ incrementGroupCount(): number; /** * Get the current group count without incrementing */ getGroupCount(): number; /** * Reset the group counter * Called when starting a new flow or replay */ reset(): void; /** * Simple hash function for generating short, stable hashes from strings * @private */ private simpleHash; } //# sourceMappingURL=id-generator.d.ts.map