interface CodeChunk { content: string; filePath: string; startLine: number; endLine: number; language: string; /** Name of the top-level symbol (function, class, etc.) this chunk represents. */ symbolName?: string; /** Dot-separated scope chain, e.g. "UserService.login". */ scopeChain?: string; /** What kind of AST node this chunk represents. */ chunkType?: "function" | "class" | "module" | "block" | "mixed"; } interface ChunkOptions { /** Max characters per chunk (default: 1500). */ maxChunkChars?: number; /** Min characters to avoid tiny chunks (default: 100). */ minChunkChars?: number; /** Number of overlap lines for line-based fallback (default: 10). */ overlapLines?: number; /** Max lines per chunk for line-based fallback (default: 50). */ maxChunkLines?: number; } interface ASTChunkerOptions extends ChunkOptions { /** Base path for WASM grammar files. If not set, resolves from node_modules. */ wasmBasePath?: string; } /** * AST-aware chunker using tree-sitter. * * Algorithm: parse AST → if node fits budget, keep as one chunk → * if too large, recurse into children → greedily merge adjacent small siblings. * * Each chunk is enriched with file path, scope chain, and symbol name. */ declare function chunkByAST(content: string, filePath: string, language: string, grammarName: string, options?: ASTChunkerOptions): Promise; /** * Line-based chunker — splits file content into fixed-size chunks with overlap. * Used as fallback when AST parsing is unavailable for a language. */ declare function chunkByLines(content: string, filePath: string, language: string, options?: ChunkOptions): CodeChunk[]; /** * Main entry point for chunking a file. * * Tries AST-aware chunking if tree-sitter supports the language, * falls back to line-based chunking otherwise. */ declare function chunkFile(content: string, filePath: string, language: string, options?: ASTChunkerOptions): Promise; export { type ASTChunkerOptions, type ChunkOptions, type CodeChunk, chunkByAST, chunkByLines, chunkFile };