/** * Structural Index Module * Caches file metadata, builds dependency graphs, and clusters related files * for more efficient and accurate code analysis. * * Key features: * - File hashing for change detection * - Import/export extraction for dependency tracking * - Dependency graph construction * - File clustering for grouped analysis * - Persistent caching to ~/.rlm-analyzer/cache/ */ import type { StructuralIndex, StructuralIndexOptions, FileIndexEntry, DependencyEdge, FileCluster, FileChunk } from './types.js'; /** * Calculate SHA-256 hash of file content */ export declare function hashContent(content: string): string; /** * Calculate hash for a project directory (based on file paths and mtimes) */ export declare function hashProject(directory: string): string; /** * Extract imports from file content */ export declare function extractImports(content: string, ext: string): string[]; /** * Extract exports from file content */ export declare function extractExports(content: string, ext: string): string[]; /** * Check if a file needs chunking */ export declare function needsChunking(size: number, maxSize?: number): boolean; /** * Chunk a large file by lines */ export declare function chunkFile(content: string, chunkSize?: number): FileChunk[]; /** * Build dependency graph from file index */ export declare function buildDependencyGraph(fileIndex: Record): DependencyEdge[]; /** * Build file clusters from dependency graph */ export declare function buildClusters(fileIndex: Record, edges: DependencyEdge[]): FileCluster[]; /** * Get cache path for a project */ export declare function getCachePath(directory: string): string; /** * Load cached index if valid */ export declare function loadCachedIndex(directory: string): StructuralIndex | null; /** * Save index to cache */ export declare function saveIndexToCache(index: StructuralIndex): void; /** * Clear cache for a project */ export declare function clearCache(directory: string): void; /** * Build or update structural index for a directory */ export declare function buildStructuralIndex(directory: string, options?: StructuralIndexOptions): Promise; /** * Update index with changed files only */ export declare function updateStructuralIndex(directory: string, options?: StructuralIndexOptions): Promise<{ index: StructuralIndex; changedFiles: string[]; }>; /** * Get files that depend on a given file */ export declare function getDependents(index: StructuralIndex, filePath: string): string[]; /** * Get files that a given file depends on */ export declare function getDependencies(index: StructuralIndex, filePath: string): string[]; /** * Get the cluster containing a file */ export declare function getFileCluster(index: StructuralIndex, filePath: string): FileCluster | undefined; /** * Get files ordered by analysis priority (entry points first) */ export declare function getAnalysisPriority(index: StructuralIndex): string[]; //# sourceMappingURL=structural-index.d.ts.map