@paulpham157/apply-patch
v0.3.1
Published
Universal apply_patch for every model on Pi, not just gpt-*: GPT, Claude, Gemini, DeepSeek, Kimi, GLM, Qwen, and more. One patch tool across providers with grammar support and JSON fallback.
Maintainers
Readme
apply-patch
One apply_patch for every model on Pi: GPT, Claude, Gemini, DeepSeek, Kimi, GLM, Qwen, and others. The extension replaces edit/write, choosing the grammar or JSON function tool based on provider capability.
Repo: https://github.com/paulpham157/pi-apply-patch
Why apply-patch
Native edit fails when the exact match string is off, while apply_patch applies the same intent with context matching:
Install
Requires Pi >=0.85.1 and Node >=22.
pi install npm:@paulpham157/apply-patchIf Pi is running, use /reload. The extension activates automatically and keeps working across model switches.
Features
- Create, edit, delete, and move files with a single patch tool.
- Confines paths to
cwd; rejects symlinks, existing destinations on create/move, and overlapping path operations. - Validates the full patch before writing; no full rollback on filesystem write errors.
Read a file before editing it; on patch failure, re-read the relevant region and generate a new patch. Patch usage quality varies by model. bash still works and is not subject to this tool's path limits.
Contributing and support
Read CONTRIBUTION.md, AGENTS.md, and run the required tests before opening a PR. See live testing with Pi and releasing.
Issues? Open one here with the Pi version, provider/model, and reproduction steps. Do not attach API keys.
Quick create: Bug report · Model/provider issue · Feature request.
Forked from code-yeongyu/pi-apply-patch: at the time, upstream had no updates for ~2 months and only supported gpt-* models, so this fork was created for personal use. MIT license.
