Overview
Improve the diff engine and write-permission flow for more accurate, readable code change previews.
Current State
diff.rs uses a basic LCS diff with ±3 line context windows. It works for small edits but has gaps:
- No syntax-aware diffing (a renamed variable shows as full remove + add)
- Context window is fixed at 3 lines regardless of change density
- No line number display in the diff box
- Multi-file responses with partial rewrites aren't handled well
Proposed Work
- Add line numbers to the diff output (
│ 42 + new line)
- Make context window size configurable (default 3, expand when changes are dense)
- Handle partial file rewrites: if the model returns only a function body, apply it as a targeted patch rather than replacing the whole file
- Add a dry-run mode that prints the would-be diff without prompting
- Improve
parse_blocks to detect more filename hint patterns (e.g., # filename, /* path */, fenced info strings like ```rust src/main.rs)
Notes
compute_diff and with_context in diff.rs are the main targets
- Keep the LCS core — just improve the rendering and partial-apply logic
Overview
Improve the diff engine and write-permission flow for more accurate, readable code change previews.
Current State
diff.rsuses a basic LCS diff with ±3 line context windows. It works for small edits but has gaps:Proposed Work
│ 42 + new line)parse_blocksto detect more filename hint patterns (e.g.,# filename,/* path */, fenced info strings like```rust src/main.rs)Notes
compute_diffandwith_contextindiff.rsare the main targets