codevault
Version:
AI-powered semantic code search via Model Context Protocol
37 lines • 1.76 kB
TypeScript
import type { ModelProfile } from '../providers/base.js';
import type { TreeSitterNode } from '../types/ast.js';
interface LanguageRule {
subdivisionTypes?: Record<string, string[]>;
[key: string]: any;
}
export declare function findSemanticSubdivisions(node: TreeSitterNode, rule: LanguageRule): TreeSitterNode[];
export declare function findLastCompleteBoundary(code: string, maxSize: number): number;
export declare function extractSignature(node: TreeSitterNode, source: string): string;
export declare function extractLinesBeforeNode(node: TreeSitterNode, source: string, numLines: number): string;
export declare function extractParentContext(node: TreeSitterNode, source: string): {
signature: string;
startLine: number;
endLine: number;
};
export declare function getLineNumber(byteOffset: number, source: string): number;
export interface NodeAnalysis {
isSingleChunk: boolean;
needsSubdivision: boolean;
subdivisionCandidates: TreeSitterNode[];
size: number;
unit: string;
method: string;
estimatedSubchunks: number;
}
export declare function analyzeNodeForChunking(node: TreeSitterNode, source: string, rule: LanguageRule, profile: ModelProfile): Promise<NodeAnalysis>;
export declare function batchAnalyzeNodes(nodes: TreeSitterNode[], source: string, rule: LanguageRule, profile: ModelProfile, isSubdivision?: boolean): Promise<Array<NodeAnalysis & {
node: TreeSitterNode;
}>>;
export interface StatementChunk {
code: string;
size: number;
unit: string;
}
export declare function yieldStatementChunks(node: TreeSitterNode, source: string, maxSize: number, overlapSize: number, profile: ModelProfile): Promise<StatementChunk[]>;
export {};
//# sourceMappingURL=semantic-chunker.d.ts.map