patch
Apply unified diff patches to files while preserving original encoding and verifying context lines. Use dry_run mode to preview changes before applying them.
Instructions
Applies a unified diff patch to a file. Parses @@ hunk headers, verifies context lines, and applies changes. Encoding-aware: preserves original file encoding. Use dry_run=true to preview without modifying the file.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Absolute path to the file to patch | |
| patch | Yes | Unified diff text (output of the diff tool) | |
| dry_run | No | Preview patch result without modifying the file (default false) |