transaction_apply
Apply multi-file edits atomically: every replacement is validated before any write, and partial failures roll back to keep refactors consistent.
Instructions
Apply str_replace edits across multiple files atomically. Every operation is validated against the on-disk content first; if any old_string is missing or ambiguous, NO files are written. If writes start succeeding but one fails partway, the already-written files are rolled back to their pre-transaction content. Per-path locks prevent interleaving with other write tools. Use for refactors that must land as one unit. Up to 50 operations per call; the response lists each file with a unified diff unless show_write_diff is off.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dirty_ok | No | Allow editing files that have uncommitted changes in their git repository. Default false — the transaction is refused if any target file is dirty. Pass true to proceed anyway. | |
| operations | No | Ordered list of per-file edit groups. Every file is validated first; only if all validate do any writes happen. | |
| await_diagnostics | No | When true, wait for the language server to re-analyse each written file and append a labelled per-file diagnostics block with a machine-readable 'diagnostics delta' line. Default false. | |
| fail_on_new_errors | No | When true (implies await_diagnostics), roll the WHOLE transaction back if any written file is CONFIRMED to have gained new errors — all-or-nothing. An unconfirmed check never rolls back; nor do warnings or pre-existing errors. Default false. |