/** * TextLineIndex * * A literal-text line index kept **separate** from the symbol (call-graph / * signature) index in `vector-index.ts`. It stores raw lines of walked files — * markup, stylesheets, templates, plain text, and the non-symbol remainder of * code files — so that literal strings the user can see on screen (UI copy, * error messages, hard-coded labels) are findable even when they live in static * markup that extracts no symbols (e.g. a "Message completed" banner in * index.html). * * Design (decision fd256fde): * - **Separate LanceDB table** (`text_lines`), never the call graph. Text lines * are never nodes and never contribute to fanIn/fanOut, hubs, entrypoints, * communities or PageRank — graph purity by construction, not by per-call-site * filtering. * - **BM25-only, no embeddings.** Literal lookup wants exact lexical match, not * vector similarity; this keeps build cost and index size bounded and results * deterministic. * - Reuses the BM25 machinery already in `vector-index.ts` * (`buildBm25Corpus` / `tokenize` / `bm25Score`) rather than reimplementing it. * * Storage: /text-line-index/ (LanceDB database folder) * Table name: "text_lines" */ /** One indexed line of a text file. */ export interface TextLineRecord { /** `${filePath}:${lineNumber}` — unique per line. */ id: string; filePath: string; /** 1-based line number. */ lineNumber: number; /** The raw line text (truncated if very long). */ text: string; } export interface TextSearchResult { filePath: string; lineNumber: number; text: string; /** BM25 relevance score, higher = more relevant. */ score: number; } /** A file to index: its repo-relative path and full content. */ export interface TextFileInput { filePath: string; content: string; } /** Test-only: clear the in-memory BM25 cache to force the cold path. */ export declare function _resetTextLineIndexCachesForTesting(): void; /** * Split a file into indexable line records. Blank / whitespace-only lines are * skipped; over-long lines are truncated, never dropped. */ export declare function extractLines(filePath: string, content: string): TextLineRecord[]; export declare class TextLineIndex { /** Returns true if a text-line index has been built for this output dir. */ static exists(outputDir: string): boolean; /** * Build (or rebuild) the text-line index from a set of files. Overwrites any * existing table. Files that yield no indexable lines contribute nothing. * Returns the number of lines indexed. */ static build(outputDir: string, files: TextFileInput[]): Promise<{ lines: number; files: number; }>; /** * Incrementally update the index for changed and deleted files. Changed files * have their old lines replaced; deleted files have their lines removed. The * cached BM25 corpus is patched in place. No-op if the index does not exist. */ static updateFiles(outputDir: string, changed: TextFileInput[], deletedPaths?: string[]): Promise<{ lines: number; }>; /** * BM25-only search over the text lines. Returns up to `limit` `file:line` * matches ordered by relevance. Optionally restrict to a single file. */ static searchText(outputDir: string, query: string, opts?: { limit?: number; filePath?: string; }): Promise; /** * Patch the cached BM25 corpus: drop rows for `affectedPaths`, splice in * `newRecords`, rebuild the corpus. No-op when nothing is cached (the next * search rebuilds from the table). */ private static _patchCache; } //# sourceMappingURL=text-line-index.d.ts.map