diff
Compare files or text and apply unified patches, matching hunks by context so patches still apply after unrelated edits.
Instructions
Compare and patch text: files (unified diff between two files), text (between two inline strings), apply (apply a unified diff to a file — hunk line numbers are matched by context, so a patch still applies after unrelated edits shifted the file).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | No | text: the "before" string. | |
| b | No | text: the "after" string. | |
| to | No | files: the second file. | |
| path | No | files: the first file. apply: the file to patch. | |
| stat | No | Report only the added/removed line counts. | |
| patch | No | apply: the unified diff to apply. | |
| action | Yes | What to do. | |
| context | No | Lines of context per hunk. Default 3. | |
| dry_run | No | apply: report what would happen without writing. | |
| max_bytes | No | Byte cap on returned output. |