/** * Text Chunking Service * * Provides generic text chunking strategies for indexing. * These are language-agnostic and work with any text content. */ import type { ChunkType } from "../entities"; /** * Represents a chunk of text with location information. */ export interface TextChunk { /** The text content */ content: string; /** 1-based start line number */ startLine: number; /** 1-based end line number */ endLine: number; /** The type of chunk */ type: ChunkType; /** Optional name for the chunk */ name?: string; } /** * Options for line-based chunking. */ export interface ChunkingOptions { /** Lines per chunk (default: 30) */ chunkSize?: number; /** Overlap between chunks (default: 5) */ overlap?: number; /** Minimum lines to create multiple chunks (default: chunkSize) */ minLinesForMultipleChunks?: number; } /** Default lines per chunk */ export declare const DEFAULT_CHUNK_SIZE = 30; /** Default overlap between chunks */ export declare const DEFAULT_OVERLAP = 5; /** * Split text into overlapping chunks based on line boundaries. * * This is a generic chunking strategy that works with any text content. * It creates overlapping chunks to ensure context is preserved across * chunk boundaries. * * @param content - The text content to chunk * @param options - Chunking options * @returns Array of text chunks */ export declare function createLineBasedChunks(content: string, options?: ChunkingOptions): TextChunk[]; /** * Create a single chunk from entire content. * Useful for small files or when chunking isn't needed. * * @param content - The text content * @returns A single file chunk */ export declare function createSingleChunk(content: string): TextChunk; /** * Generate a unique chunk ID from filepath and line numbers. * * @param filepath - The source file path * @param startLine - Start line number * @param endLine - End line number * @returns Unique chunk identifier */ export declare function generateChunkId(filepath: string, startLine: number, endLine: number): string;