Diff Applier
Purpose
Apply code changes ("patches") safely, saving tokens by not rewriting the whole file. Automatically checks for lint errors and updates the codebase index.
Usage
1. Create a Patch File
The patch file must use SEARCH/REPLACE blocks:
text
<<<<<<< SEARCH
def old_function():
return True
=======
def new_function():
return False
>>>>>>> REPLACE
2. Apply Patch
bash
python .agent/skills/diff-applier/scripts/apply_patch.py src/main.py my_patch.txt
Workflow
- •Backup: Creates
src/main.py.bak. - •Apply: Replaces exact text matches.
- •Lint: Runs
flake8(Python) oreslint(JS) if available. - •Index: Calls
codebase-navigatorto update the project index.