@@ -83,122 +83,126 @@ Add to your MCP client:
8383git diff main..feature-branch > /tmp/changes.diff
8484```
8585
86- 2 . Load in LLM :
86+ 2 . Navigate and analyze (auto-loading) :
8787
8888```
89- load_diff("/tmp/changes.diff", "/path/to/project")
90- → {"chunks": 5, "files": 23, "total_lines": 8432}
91- ```
92-
93- 3 . Navigate and analyze:
94-
95- ```
96- list_chunks()
89+ # Any tool can be called first - they auto-load with sensible defaults
90+ list_chunks("/tmp/changes.diff")
9791→ [{"chunk": 1, "files": ["api/auth.py", "models/user.py"], "lines": 1205}, ...]
9892
99- find_chunks_for_files("*test*")
93+ find_chunks_for_files("/tmp/changes.diff", " *test*")
10094→ [2, 4]
10195
102- get_chunk(1)
96+ get_chunk("/tmp/changes.diff", 1)
10397→ "=== Chunk 1 of 5 ===\ndiff --git a/api/auth.py..."
10498```
10599
100+ 3 . Custom settings (optional):
101+
102+ ```
103+ # Only needed if you want non-default chunking settings
104+ load_diff("/tmp/changes.diff", max_chunk_lines=2000, include_patterns="*.py")
105+ → {"chunks": 8, "files": 15, "total_lines": 8432}
106+ ```
107+
106108## Usage Examples
107109
108110### Large Feature Review
109111
110112``` bash
111- git diff main..feature-auth > auth-changes.diff
113+ git diff main..feature-auth > /tmp/ auth-changes.diff
112114```
113115
114116```
115- load_diff("auth-changes.diff", "/path/to/project")
116- list_chunks() # Overview of all changes
117- find_chunks_for_files("*controller*") # API endpoints → [1, 3]
118- find_chunks_for_files("*test*") # Tests → [2, 5]
119- get_chunk(1) # Analyze API changes
117+ # Auto-loading with default settings
118+ list_chunks("/tmp/auth-changes.diff" ) # Overview of all changes
119+ find_chunks_for_files("/tmp/auth-changes.diff", " *controller*") # API endpoints → [1, 3]
120+ find_chunks_for_files("/tmp/auth-changes.diff", " *test*") # Tests → [2, 5]
121+ get_chunk("/tmp/auth-changes.diff", 1) # Analyze API changes
120122```
121123
122124### Targeted Analysis
123125
124126```
125- # Focus on specific file types
126- find_chunks_for_files("*.py") # Python code → [1, 3, 4]
127- find_chunks_for_files("*.json") # Config files → [2]
128- find_chunks_for_files("src/core/*") # Core module → [1, 4]
127+ # Focus on specific file types (all auto-load)
128+ find_chunks_for_files("/tmp/feature.diff", " *.py") # Python code → [1, 3, 4]
129+ find_chunks_for_files("/tmp/feature.diff", " *.json") # Config files → [2]
130+ find_chunks_for_files("/tmp/feature.diff", " src/core/*") # Core module → [1, 4]
129131
130132# Skip to relevant sections
131- get_chunk(3) # Direct access to specific changes
133+ get_chunk("/tmp/feature.diff", 3) # Direct access to specific changes
134+ ```
135+
136+ ### Multi-File Analysis
137+
138+ ```
139+ # Each file maintains separate state
140+ list_chunks("/tmp/feature-auth.diff") # Auth feature
141+ list_chunks("/tmp/feature-ui.diff") # UI feature
142+ list_chunks("/tmp/bugfix-123.diff") # Bug fix
143+
144+ # Work with different files simultaneously
145+ get_chunk("/tmp/feature-auth.diff", 1)
146+ get_chunk("/tmp/feature-ui.diff", 2)
132147```
133148
134149## Configuration Options
135150
136- ### load_diff Parameters
151+ ### All Tools Require
152+
153+ - ` absolute_file_path ` : ** Required** . Absolute path to diff file for all tools.
154+
155+ ### Auto-Loading Defaults
137156
138- - ` file_path ` : Path to diff file (absolute or relative to working_directory)
139- - ` working_directory ` : ** Required** . Directory to resolve relative file paths from
157+ When tools auto-load diffs (all tools except ` load_diff ` ), they use:
158+ - ` max_chunk_lines ` : 4000 (LLM context optimized)
159+ - ` skip_trivial ` : true (skip whitespace-only changes)
160+ - ` skip_generated ` : true (skip lock files, build artifacts)
161+ - ` include_patterns ` : none (include all files)
162+ - ` exclude_patterns ` : none (exclude no files)
163+
164+ ### load_diff Parameters (Optional)
165+
166+ Use ` load_diff ` only when you need custom settings:
167+ - ` absolute_file_path ` : Absolute path to diff file
140168- ` max_chunk_lines ` : Lines per chunk (default: 4000)
141169- ` skip_trivial ` : Skip whitespace-only changes (default: true)
142170- ` skip_generated ` : Skip build artifacts, lock files (default: true)
143171- ` include_patterns ` : Comma-separated file patterns to include
144172- ` exclude_patterns ` : Comma-separated file patterns to exclude
145173
146- ### Path Resolution
174+ ### Path Requirements
147175
148- The MCP server requires a ` working_directory ` parameter to properly resolve file paths:
149-
150- - ** Absolute paths** : Used directly (e.g., ` /home/user/project/changes.diff ` )
151- - ** Relative paths** : Resolved against ` working_directory ` (e.g., ` changes.diff ` + ` /home/user/project/ ` )
176+ - ** Absolute paths only** : All file paths must be absolute (e.g., ` /home/user/project/changes.diff ` )
152177- ** Cross-platform** : Handles Windows (` C:\path ` ) and Unix (` /path ` ) formats automatically
153- - ** Home directory** : Supports ` ~ ` expansion for both parameters
178+ - ** Home directory** : Supports ` ~ ` expansion (e.g., ` ~/project/changes.diff ` )
179+ - ** Canonical paths** : Automatically resolves symlinks and ` .. ` references
154180
155181### Examples
156182
157- ** Absolute path :**
183+ ** Auto-loading (recommended) :**
158184```
159- load_diff(
160- "/home/user/project/changes.diff",
161- "/home/user/project",
162- max_chunk_lines=2000
163- )
164- ```
165-
166- ** Relative path:**
167- ```
168- load_diff(
169- "changes.diff",
170- "/home/user/project",
171- max_chunk_lines=2000
172- )
173- ```
174-
175- ** Windows paths:**
176- ```
177- load_diff(
178- "changes.diff",
179- "C:\\Users\\user\\project",
180- max_chunk_lines=2000
181- )
185+ # Just provide absolute path - uses sensible defaults
186+ list_chunks("/home/user/project/changes.diff")
187+ get_chunk("/tmp/feature.diff", 1)
188+ find_chunks_for_files("~/project/changes.diff", "*.py")
182189```
183190
184- ** With filtering :**
191+ ** Custom settings :**
185192```
193+ # Use load_diff for non-default settings
186194load_diff(
187195 "/tmp/large.diff",
188- "/path/to/project",
189196 max_chunk_lines=2000,
190197 include_patterns="*.py,*.js",
191198 exclude_patterns="*test*,*spec*"
192199)
193200```
194201
195- ** MCP Client Usage:**
196- When using with Cline or other MCP clients, ensure the client provides both parameters:
197- ``` json
198- {
199- "file_path" : " comparison_diff.patch" ,
200- "working_directory" : " /path/to/your/project"
201- }
202+ ** Windows paths:**
203+ ```
204+ list_chunks("C:\\Users\\user\\project\\changes.diff")
205+ get_chunk("C:\\temp\\feature.diff", 1)
202206```
203207
204208## Supported Formats
@@ -216,11 +220,15 @@ When using with Cline or other MCP clients, ensure the client provides both para
216220
217221## Benefits
218222
223+ - ** Auto-loading** : Seamless UX with no session management complexity
224+ - ** Multi-file support** : Each diff file maintains separate state
225+ - ** Change detection** : Automatic reload when files are modified
219226- ** Cost reduction** : Process only relevant changes, reduce token usage
220227- ** Fast navigation** : Jump directly to files or areas of interest
221228- ** Context preservation** : Maintain file relationships and diff metadata
222229- ** Language agnostic** : Works with any codebase or diff format
223230- ** Enterprise ready** : Handles large feature branches and refactoring diffs
231+ - ** Cross-platform** : Robust path handling for Windows/Unix systems
224232
225233## Development
226234
@@ -435,19 +443,23 @@ uv run python -m src.main
435443** Common issues:**
436444
437445- ** Import errors** : Ensure you're using ` uv run ` for all commands
438- - ** File not found** : Verify both ` file_path ` and ` working_directory ` are correct
439- - ** Path resolution errors** : Use absolute paths or double-check relative path + working directory
440- - ** Permission errors** : Check file permissions for diff files and working directory access
441- - ** Memory issues** : Use smaller ` max_chunk_lines ` for very large diffs
446+ - ** File not found** : Verify the ` absolute_file_path ` exists and is accessible
447+ - ** Path errors** : Use absolute paths only (no relative paths supported)
448+ - ** Permission errors** : Check file permissions for diff files
449+ - ** Memory issues** : Use ` load_diff ` with smaller ` max_chunk_lines ` for very large diffs
450+ - ** File changes** : Tools automatically reload when files change, no manual intervention needed
442451
443452** Path troubleshooting:**
444453``` bash
445- # Check if file exists from working directory
446- cd /your/working/directory
447- ls -la your-diff-file.diff
454+ # Check if file exists
455+ ls -la /absolute/path/to/your-diff-file.diff
456+
457+ # Use absolute paths
458+ list_chunks(" /absolute/path/to/diff.patch" ) # Good
459+ list_chunks(" ./relative/path.patch" ) # Won't work
448460
449- # Use absolute paths to avoid confusion
450- load_diff( " /absolute/path/to/diff.patch " , " /absolute/path/to/project " )
461+ # Home directory works
462+ list_chunks( " ~/project/changes.diff " ) # Good (expands to absolute )
451463```
452464
453465# License
0 commit comments