/** * File Watcher Module v3 * * @deprecated This module is deprecated. Use checkpoint.ts instead. * * The file watcher approach is not bulletproof because: * 1. File watchers can miss rapid changes * 2. Race conditions between AI edits and human edits * 3. Platform-specific behavior differences * * The checkpoint-based approach (checkpoint.ts) is bulletproof because: * 1. beforeSubmitPrompt/PreToolUse captures state BEFORE AI acts * 2. afterFileEdit/PostToolUse captures state AFTER AI acts * 3. No race conditions - deterministic capture at hook boundaries * * This module is kept for backward compatibility but should not be used. */ export declare class FileWatcher { private watcher; private repoRoot; private aiEditInProgress; private debounceTimers; private debounceMs; private lastCapturedBlobs; constructor(repoRoot: string, options?: { debounceMs?: number; }); /** * Start watching the repository for file changes */ start(): void; /** * Stop watching */ stop(): void; /** * Mark a file as being edited by AI (called by capture hook) */ markAIEditStart(filePath: string): void; /** * Mark AI edit as complete */ markAIEditEnd(filePath: string): void; /** * Check if an AI edit is in progress for a file */ isAIEditInProgress(filePath: string): boolean; /** * Handle a file change event */ private handleFileChange; /** * Check if a path should be ignored */ private shouldIgnore; /** * Debounce a function call for a specific key */ private debounce; /** * Normalize path for comparison */ private normalizePath; } /** * Start the global file watcher for a repository */ export declare function startWatcher(repoRoot: string): FileWatcher; /** * Stop the global file watcher */ export declare function stopWatcher(): void; /** * Get the global file watcher */ export declare function getWatcher(): FileWatcher | null; /** * Mark AI edit start (for coordination with capture hook) */ export declare function markAIEditStart(filePath: string): void; /** * Mark AI edit end */ export declare function markAIEditEnd(filePath: string): void; /** * Save watcher state to disk (for daemon mode) */ export declare function saveWatcherState(repoRoot: string): void; /** * Load watcher state from disk */ export declare function loadWatcherState(repoRoot: string): { running: boolean; pid: number; startedAt: string; } | null; /** * Clear watcher state */ export declare function clearWatcherState(repoRoot: string): void; /** * Check if another watcher process is running */ export declare function isWatcherRunning(repoRoot: string): boolean;