file_edit
Patch multiple parts of a file in one atomic call: replace, delete, insert, regex, append, or prepend lines/text, with dry-run preview and overlap checks.
Instructions
Patch parts of a file — several edits in ONE call. ops types: replace_lines, delete_lines, insert_before, insert_after, replace_text (exact string), regex_replace, append, prepend. Line numbers in every op refer to the ORIGINAL file and line ranges must not overlap, so you can plan all edits from a single file_read. replace_text fails unless it matches expect_count times (default 1) — pass all=true for every occurrence. Use dry_run=true to preview a diff first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eol | No | Line endings. Default keep. | |
| ops | Yes | Edits applied atomically: nothing is written unless all of them succeed. | |
| path | Yes | File to patch. | |
| dry_run | No | Preview the diff without writing. |