Edit file
project_edit_fileEdit a file by replacing exact text sections, using one old/new pair or multiple edits and an optional SHA-256 guard to prevent overwriting unintended changes.
Instructions
Edit a file by exact text replacement: one old_text/new_text pair, or edits[] for multiple sections. Use when: change one or a few text sections whose exact content you know; pair with expected_sha256 to guard against blind overwrites. Avoid when: the whole file must change (project_write_file), or you have not read the file to know old_text. Speed: fast; clears the read/list/search cache for the affected path. Output: file_written: replacements, sha256_before/after. Batch-safe: no
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| edits | No | ||
| new_text | No | ||
| old_text | No | ||
| replace_all | No | ||
| relative_path | Yes | Path inside the workspace (relative, or absolute inside the workspace) | |
| expected_sha256 | No |