/** * Graceful shutdown handling for openlore CLI */ export interface ShutdownState { /** Current phase when interrupted */ phase: 'init' | 'analyze' | 'generate' | 'verify'; /** Files that were being processed */ currentFiles?: string[]; /** Partial results that were saved */ savedResults?: string; /** Timestamp of interruption */ timestamp: number; } type CleanupCallback = () => void | Promise; /** * Manages graceful shutdown with cleanup callbacks */ export declare class ShutdownManager { private callbacks; private isShuttingDown; private state; private stateFile; private handlers; private handlersAttached; constructor(projectPath?: string, options?: { skipHandlers?: boolean; }); private setupHandlers; /** * Remove all registered signal handlers (for testing) */ removeHandlers(): void; private handleShutdown; /** * Register a cleanup callback to run on shutdown */ onCleanup(callback: CleanupCallback): void; /** * Remove a cleanup callback */ removeCleanup(callback: CleanupCallback): void; /** * Set the current state for potential resume */ setState(state: Partial): void; /** * Clear state (call on successful completion) */ clearState(): void; /** * Save state to file for potential resume */ private saveState; /** * Load previous shutdown state */ loadState(): ShutdownState | null; /** * Check if there's a previous interrupted session */ hasPreviousState(): boolean; private showResumeSuggestion; /** * Check if shutdown is in progress */ isInProgress(): boolean; } /** * Get or create the global shutdown manager */ export declare function getShutdownManager(projectPath?: string): ShutdownManager; /** * Register a cleanup callback with the global manager */ export declare function onShutdown(callback: CleanupCallback): void; /** * Set current state for potential resume */ export declare function setShutdownState(state: Partial): void; /** * Clear shutdown state (call on successful completion) */ export declare function clearShutdownState(): void; /** * Create a scope that sets/clears state automatically */ export declare function withShutdownState(state: Partial, fn: () => Promise): Promise; export {}; //# sourceMappingURL=shutdown.d.ts.map