/** * Agentic QE v3 - File Reader Module * Safe async file reading with caching and Result pattern */ import { Result } from '../types'; export interface FileReaderOptions { /** Base path for resolving relative paths */ basePath?: string; /** Maximum cache size (number of entries) */ maxCacheSize?: number; /** Cache TTL in milliseconds (default: 5 minutes) */ cacheTtlMs?: number; /** Whether to enable caching (default: true) */ enableCache?: boolean; } export interface CacheEntry { value: T; timestamp: number; size: number; } export interface FileReaderStats { cacheHits: number; cacheMisses: number; totalReads: number; cacheSize: number; cacheEntries: number; } export declare class FileReadError extends Error { readonly filePath: string; readonly code?: string | undefined; readonly cause?: Error | undefined; constructor(message: string, filePath: string, code?: string | undefined, cause?: Error | undefined); } export declare class JsonParseError extends Error { readonly filePath: string; readonly cause?: Error | undefined; constructor(message: string, filePath: string, cause?: Error | undefined); } export declare class FileReader { private readonly basePath; private readonly cache; private readonly enableCache; private stats; constructor(options?: FileReaderOptions); /** * Resolves a path to an absolute path */ private resolvePath; /** * Read file contents as a string */ readFile(filePath: string): Promise>; /** * Read and parse a JSON file */ readJSON(filePath: string): Promise>; /** * Check if a file exists */ fileExists(filePath: string): Promise>; /** * List files matching a glob pattern */ listFiles(pattern: string, basePath?: string): Promise>; /** * Invalidate cache for a specific file */ invalidateCache(filePath: string): void; /** * Clear all cached files */ clearCache(): void; /** * Remove expired entries from cache */ pruneCache(): number; /** * Get file reader statistics */ getStats(): FileReaderStats; /** * Reset statistics */ resetStats(): void; private updateCacheStats; } /** * Get or create the default FileReader instance */ export declare function getFileReader(options?: FileReaderOptions): FileReader; /** * Convenience function: Read file contents */ export declare function readFile(filePath: string): Promise>; /** * Convenience function: Read and parse JSON file */ export declare function readJSON(filePath: string): Promise>; /** * Convenience function: Check if file exists */ export declare function fileExists(filePath: string): Promise>; /** * Convenience function: List files matching pattern */ export declare function listFiles(pattern: string, basePath?: string): Promise>; //# sourceMappingURL=file-reader.d.ts.map