/** * Chunk Context Preparation Service * * Provides a unified utility for preparing chunk content with path context * for embedding. This ensures consistent behavior across all indexing modules. * * The path context helps embeddings understand the structural location of code, * improving search relevance for queries that reference file paths or domains. */ /** * Options for preparing a chunk for embedding. */ export interface ChunkContextOptions { /** Relative file path (from project root) */ filepath: string; /** The chunk content to embed */ content: string; /** Optional name for the chunk (e.g., function name, heading) */ name?: string; /** Optional documentation comment (e.g., JSDoc, docstring) */ docComment?: string; } /** * Prepare chunk content for embedding by injecting path context. * * This function should be used by ALL indexing modules to ensure consistent * path context injection. The path context is prepended to the content to * give the embedding model awareness of the file's location in the project. * * Format: `[domain layer segment1 segment2] [name:] [docComment] content` * * @param options - Chunk context options * @returns Content string ready for embedding * * @example * ```typescript * const embeddingContent = prepareChunkForEmbedding({ * filepath: 'services/dynamodb/streams/handler.ts', * content: 'export function processStream() { ... }', * name: 'processStream', * }); * // Returns: "[dynamodb service streams] processStream: export function processStream() { ... }" * ``` */ export declare function prepareChunkForEmbedding(options: ChunkContextOptions): string; /** * Extract path keywords for inclusion in FileSummary. * * This provides a deduplicated list of keywords extracted from the file path, * suitable for BM25 and other keyword-based search mechanisms. * * @param filepath - Relative file path * @returns Array of deduplicated lowercase keywords * * @example * ```typescript * const keywords = extractPathKeywordsForFileSummary('services/dynamodb/streams/handler.ts'); * // Returns: ['services', 'dynamodb', 'streams', 'handler'] * ``` */ export declare function extractPathKeywordsForFileSummary(filepath: string): string[]; /** * Get path context data for inclusion in FileSummary. * * This returns the parsed path context that can be stored in FileSummary * for later use during search scoring. * * @param filepath - Relative file path * @returns Path context object */ export declare function getPathContextForFileSummary(filepath: string): { segments: string[]; layer?: string; domain?: string; depth: number; };