Skip to content

Commit 3ad3ee1

Browse files
committed
doc: Provide usage examples in README
1 parent 025ebce commit 3ad3ee1

File tree

1 file changed

+52
-29
lines changed

1 file changed

+52
-29
lines changed

README.md

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ MCP server with 4 navigation tools:
2020

2121
- `load_diff` - Parse diff file with custom settings (optional)
2222
- `list_chunks` - Show chunk overview with file mappings (auto-loads)
23-
- `get_chunk` - Retrieve specific chunk content (auto-loads)
23+
- `get_chunk` - Retrieve specific chunk content (auto-loads)
2424
- `find_chunks_for_files` - Locate chunks by file patterns (auto-loads)
2525

2626
## Setup
@@ -42,51 +42,72 @@ Add to your MCP client configuration:
4242

4343
## Usage
4444

45-
### Basic Workflow
45+
Your AI assistant can now handle massive changesets that previously caused failures in Cline, Roocode, Cursor, and other tools.
4646

47-
```bash
48-
# Generate diff file
49-
git diff main..feature-branch > /tmp/changes.diff
50-
```
47+
### Using with AI Assistant
5148

52-
```
53-
# LLM analyzes using diffchunk tools
54-
Use diffchunk to analyze the diff at /tmp/changes.diff and find any bugs.
55-
```
49+
Once configured, your AI assistant can analyze large commits, branches, or diffs using diffchunk.
5650

57-
### Tracking Analysis Progress
51+
Here are some example use cases:
5852

59-
For large diffs requiring systematic analysis, LLMs can maintain tracking documents to resume work:
53+
**Branch comparisons:**
6054

61-
```
62-
# Initial analysis with tracking
63-
Use diffchunk to analyze /tmp/large-feature.diff. Create a tracking document
64-
to monitor progress through all chunks, then provide final summary.
55+
- _"Review all changes in develop not in the main branch for any bugs"_
56+
- _"Tell me about all the changes I have yet to merge"_
57+
- _"What new features were added to the staging branch?"_
58+
- _"Summarize all changes to this repo in the last 2 weeks"_
59+
60+
**Code review:**
61+
62+
- _"Use diffchunk to check my feature branch for security vulnerabilities"_
63+
- _"Use diffchunk to find any breaking changes before I merge to production"_
64+
- _"Use diffchunk to review this large refactor for potential issues"_
65+
66+
**Change analysis:**
67+
68+
- _"Use diffchunk to show me all database migrations that need to be run"_
69+
- _"Use diffchunk to find what API changes might affect our mobile app"_
70+
- _"Use diffchunk to analyze all new dependencies added recently"_
71+
72+
**Direct file analysis:**
73+
74+
- _"Use diffchunk to analyze the diff at /tmp/changes.diff and find any bugs"_
75+
- _"Create a diff of my uncommitted changes and review it"_
76+
- _"Compare my local branch with origin and highlight conflicts"_
6577

66-
# LLM maintains internal tracking:
67-
# - Chunk 1/15: API endpoints - ANALYZED
68-
# - Chunk 2/15: Database models - ANALYZED
69-
# - Chunk 3/15: Tests - IN PROGRESS
70-
# - Chunks 4-15: PENDING
78+
### Tip: AI Assistant Rules
7179

72-
# Clean up tracking before final results
80+
Add to your AI assistant's custom instructions for automatic usage:
81+
82+
```
83+
When reviewing large changesets or git commits, use diffchunk to handle large diff files.
84+
Create temporary diff files and tracking files as needed and clean up after analysis.
7385
```
7486

75-
The tracking document concept allows LLMs to:
76-
- Resume analysis where they left off
77-
- Ensure comprehensive coverage of large diffs
78-
- Maintain context across multiple chunks
79-
- Provide complete analysis results
87+
## How It Works
88+
89+
When you ask your AI assistant to analyze changes, it uses diffchunk's tools strategically:
90+
91+
1. **Creates the diff file** (e.g., `git diff main..develop > /tmp/changes.diff`) based on your question
92+
2. **Uses `list_chunks`** to get an overview of the diff structure and total scope
93+
3. **Uses `find_chunks_for_files`** to locate relevant sections when you ask about specific file types
94+
4. **Uses `get_chunk`** to examine specific sections without loading the entire diff into context
95+
5. **Tracks progress systematically** through large changesets, analyzing chunk by chunk
96+
6. **Cleans up temporary files** after completing the analysis
97+
98+
This lets your AI assistant handle massive diffs that would normally crash other tools, while providing thorough analysis without losing context.
8099

81100
### Tool Usage Patterns
82101

83102
**Overview first:**
103+
84104
```python
85105
list_chunks("/tmp/changes.diff")
86106
# → 5 chunks across 12 files, 3,847 total lines
87107
```
88108

89109
**Target specific files:**
110+
90111
```python
91112
find_chunks_for_files("/tmp/changes.diff", "*.py")
92113
# → [1, 3, 5] - Python file chunks
@@ -96,6 +117,7 @@ get_chunk("/tmp/changes.diff", 1)
96117
```
97118

98119
**Systematic analysis:**
120+
99121
```python
100122
# Process each chunk in sequence
101123
get_chunk("/tmp/changes.diff", 1)
@@ -108,12 +130,13 @@ get_chunk("/tmp/changes.diff", 2)
108130
### Path Requirements
109131

110132
- **Absolute paths only**: `/home/user/project/changes.diff`
111-
- **Cross-platform**: Windows (`C:\path`) and Unix (`/path`)
133+
- **Cross-platform**: Windows (`C:\path`) and Unix (`/path`)
112134
- **Home expansion**: `~/project/changes.diff`
113135

114136
### Auto-Loading Defaults
115137

116138
Tools auto-load with optimized settings:
139+
117140
- `max_chunk_lines`: 1000
118141
- `skip_trivial`: true (whitespace-only)
119142
- `skip_generated`: true (lock files, build artifacts)
@@ -151,4 +174,4 @@ load_diff(
151174

152175
## License
153176

154-
[MIT](./LICENSE)
177+
[MIT](./LICENSE)

0 commit comments

Comments
 (0)