/** * @fileoverview In-memory file cache for fitness checks * * Simple file content cache with optional prewarming. * Used by all checks during a run for efficient file access. */ /** * Prewarm statistics. */ interface PrewarmStats { /** Number of files loaded */ readonly filesLoaded: number; /** Duration in milliseconds */ readonly durationMs: number; /** Total bytes loaded */ readonly totalBytes: number; } /** In-memory file cache with optional prewarm for fitness check runs. */ export declare class FileCache { private readonly cache; private _prewarmed; private _cleared; private _autoClearTimer; /** * Prewarm the cache by loading all files matching patterns. * @param cwd - Working directory for file resolution * @param patterns - Glob patterns to prewarm file contents for * @returns Prewarm statistics */ prewarm(cwd: string, patterns: readonly string[]): Promise; /** * Get file content from cache, falling back to disk if not cached. * @throws {Error} If the path is a directory instead of a file */ /** Synchronously check if a file is in cache. Returns content or undefined. */ getCached(filePath: string): string | undefined; get(filePath: string): Promise; /** * Check if a file exists (in cache or on disk). */ exists(filePath: string): Promise; /** * Clear the cache. Must be called after checks complete. */ clear(): void; /** * Get all cached file paths. * Returns the paths of all files loaded during prewarm or on-demand reads. */ paths(): readonly string[]; /** * Get cache statistics. */ /** Auto-clear after timeout to prevent memory leaks from missed lifecycle cleanup */ private scheduleAutoClear; get stats(): { size: number; prewarmed: boolean; cleared: boolean; }; } /** * TEST-ONLY shared file cache instance. * * Production resolves the per-run cache from `currentScope()?.fitness?.fileCache` * (created once per run by the fitness tool's `contributeScope()`); after * parallel-tool-invocations Phase 1, ZERO production code reads this singleton. * It is retained solely for isolated unit tests that exercise the cache without * a scope (they seed/clear it directly, or pass it explicitly as * `options.fileCache`). New production imports are forbidden by the * `no-module-level-run-state` dogfood check (Phase 3). * `no-module-singleton.mjs` keeps a definition-file exemption for this symbol * only (`EXEMPT_BY_FILE`). */ export declare const fileCache: FileCache; /** * Default patterns to prewarm for fitness checks. */ export declare const DEFAULT_PREWARM_PATTERNS: readonly ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.json", "**/*.md"]; export {}; //# sourceMappingURL=file-cache.d.ts.map