file_write
Replace an entire file atomically with new content, using expected hash and dry-run checks to prevent conflicts. Returns an operation ID and undo availability.
Instructions
Replace a whole file with new content and return operation_id and undo_available.
The replacement is atomic: a crash leaves the complete previous content.
expected_hash guards against clobbering a file that changed since it was
read; a mismatch is CONTENT_CONFLICT and nothing is written. The file's
encoding and byte-order mark are inherited unless encoding is named.
Credential-shaped targets are refused unless i_accept_secret_write_risk
is true. dry_run validates and writes nothing. Otherwise the operation is
recorded and undoable. Not idempotent: each successful call adds a
history record.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| content | Yes | ||
| dry_run | No | ||
| encoding | No | ||
| expected_hash | No | ||
| i_accept_secret_write_risk | No |