/** * TypeScript/JavaScript Language Index Module * * Provides TypeScript/JavaScript-aware code search using: * - AST parsing via TypeScript Compiler API * - Local text embeddings for semantic similarity * - BM25 keyword matching for fast filtering * * Supported file types: .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts * * Index location: .raggrep/index/language/typescript/ */ import { IndexModule, IndexContext, SearchContext, SearchOptions, FileIndex, SearchResult, ModuleConfig } from "../../../types"; /** Default minimum similarity score for search results */ export declare const DEFAULT_MIN_SCORE = 0.15; /** Default number of results to return */ export declare const DEFAULT_TOP_K = 10; /** File extensions supported by this module */ export declare const TYPESCRIPT_EXTENSIONS: string[]; /** * Check if a file is supported by this module. */ export declare function isTypeScriptFile(filepath: string): boolean; export declare const supportsFile: typeof isTypeScriptFile; /** * Module-specific data stored alongside file index */ export interface SemanticModuleData { embeddings: number[][]; /** Store the model used for these embeddings for compatibility checking */ embeddingModel: string; [key: string]: unknown; } export declare class TypeScriptModule implements IndexModule { readonly id = "language/typescript"; readonly name = "TypeScript Search"; readonly description = "TypeScript-aware code search with AST parsing and semantic embeddings"; readonly version = "1.0.0"; supportsFile(filepath: string): boolean; private embeddingConfig; private symbolicIndex; private literalIndex; private pendingSummaries; /** Map from chunkId → { filepath, literals } for building literal index */ private pendingLiterals; private rootDir; private logger; initialize(config: ModuleConfig): Promise; indexFile(filepath: string, content: string, ctx: IndexContext): Promise; /** * Finalize indexing by building and saving the symbolic and literal indexes. * Uses incremental updates when possible to avoid full rebuilds. */ finalize(ctx: IndexContext): Promise; /** * Search the semantic index for chunks matching the query. * * Uses a three-source approach: * 1. Semantic search with embeddings * 2. BM25 keyword search * 3. Literal index for exact-match boosting * * @param query - Natural language search query * @param ctx - Search context with index access * @param options - Search options (topK, minScore, filePatterns) * @returns Array of search results sorted by relevance */ search(query: string, ctx: SearchContext, options?: SearchOptions): Promise; private extractReferences; }