apply_patch
Apply unified diffs to files using git apply, with directory boundary protection. Run with check_only to validate before applying changes.
Instructions
Apply an agent-generated unified diff to files under target_path.
Uses git apply, which refuses paths that escape the target directory.
Run with check_only=True first to verify the patch applies cleanly
before writing changes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target_path | Yes | Directory the patch paths are relative to. | |
| patch | Yes | The unified diff text to apply. | |
| check_only | No | If True, validate without modifying any files. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |