pub fn chunk_diff(diff: &str, max_tokens: usize) -> StringExpand description
Performs multi-level diff chunking for large diffs.
This function implements a three-tier approach to chunking:
- File-level merging: Greedily combine entire file diffs until token limit
- Hunk-level splitting: If a single file is too large, split by hunks
- Line-level splitting: For extremely large hunks, split by lines
§Arguments
diff- The full git diff stringmax_tokens- Maximum tokens allowed per chunk (prompt overhead will be subtracted)
§Returns
A single string containing the chunked diff, with separators between chunks