edit_batch
Apply multiple text edits to one file atomically, preview unified diffs with dry-run, and continue on partial failures. Use for batch modifications with validation.
Instructions
MUST USE for all file edits. PREFERRED single-file edit path. Read first, then edit. Multiple edits, atomic, dry_run previews diff. Rollback/multi-file? edit_transaction.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | Path to the file to edit, relative to workspace_dir (e.g. "src/auth.py") | |
| edits | Yes | Array of edits to apply. Example: [{"old_string": "foo", "new_string": "bar"}] | |
| dry_run | No | Preview changes as unified diff, do not apply | |
| partial | No | Apply successful edits even if some fail (returns applied/failed indices) | |
| verbose | No | Return original_content/final_content full text (default: false — diff only) | |
| file_path | No | DEPRECATED: abs path alias, only inside workspace | |
| workspace_dir | No | REQUIRED: project root (abs). reindex first if new. |