Install
Install with PiG
pig install npm:@paulpham157/apply-patchInstall with Pi
pi install npm:@paulpham157/apply-patchPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"extensions": [
"./src/index.ts"
]
}README
Written by the package's publisher, shown as published in version 0.4.0 (README.md). PiG does not review it.
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.87.1 and Node >=22.
pi install npm:@paulpham157/apply-patch
pi install git:github.com/paulpham157/pi-apply-patch
If 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.

