file_apply_patch
Apply unified diffs safely: validate every hunk and file before writing, preview changes with dry_run, and return an undoable operation ID.
Instructions
Apply a unified diff and return operation_id and undo_available. Destructive.
The whole patch is parsed and every hunk is checked against its file
before a byte is written; a failed or ambiguous hunk rejects the patch
with PATCH_FAILED and leaves the pre-patch state intact. A patch is
limited to 1048576 bytes here. A multi-file patch is recorded as one
logical operation and is undoable, but its application is recoverable,
not atomic across files. dry_run validates and reports every file and
hunk without touching the tree. Renaming patches are refused.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| patch | Yes | ||
| dry_run | No | ||
| i_accept_secret_write_risk | No |