write_files
Apply coordinated edits across multiple files atomically, validating each change before writing and restoring files if any write fails.
Instructions
Apply a coordinated change across SEVERAL files, all-or-nothing. Use this instead of calling edit_file/rewrite_file in a loop whenever the edits belong together — converting call sites to a new helper, renaming a symbol across chapters, updating a template and its users. A loop that fails halfway leaves the project in a state that is neither old nor new, and you find out when the compile breaks.
Every edit is validated and resolved BEFORE anything is written, so the common failures (missing file, search string matching twice or not at all, bad path) touch nothing. If a write still fails, the files already written are restored. Each entry takes either content (full replacement) or old_string+new_string (surgical, must match exactly once).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | The edits to apply together. | |
| project_id | Yes | Typleaf project ID — a 24-character lowercase hex string (e.g. '692a83fb82feceb233c4b0e7'), obtained from list_projects or the project URL. NOT a local filesystem path, NOT '.', NOT a project name or title. These tools operate on the REMOTE Typleaf project. Only call these tools when the user explicitly asks to work with a Typleaf project — never for general local file I/O. If you already have a copy of THIS project checked out on the local filesystem, prefer the standard read/grep tools against that path. Always call list_projects first when unsure. | |
| commit_message | No |