Performs exact string replacements in files. Transactional with automatic rollback on failure.

Usage:
- You must use `read` before editing. This tool will reject edits on unread or stale files.
- When editing text from `read` output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + arrow (→). Everything after that arrow is the actual file content to match. Never include any part of the line number prefix in the `before` or `after` strings.
- ALWAYS prefer editing existing files. NEVER write new files unless explicitly required.
- Only use emojis if the user explicitly requests it.
- The edit will FAIL if `before` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replace_all` to change every instance.
- Use `replace_all` for replacing and renaming strings across the file. This parameter is useful for renaming a variable, function, or class.

Parameters:
- path (required): file path
- before (required): exact text to find in the file
- after (required): replacement text (must be different from before)
- replace_all (optional, default false): replace all occurrences instead of requiring unique match

When to use replace_all:
- Renaming a variable, function, or class across a file
- Changing an import path that appears multiple times
- Updating a repeated pattern (e.g. changing all "http://" to "https://")

Common mistakes and how to avoid them:
- Editing without reading first → always `read` before `edit`
- `before` too short, matches multiple locations → include surrounding lines for uniqueness
- Stale content after failed edit → re-read the file, it may have changed; stale edits are rejected
- Including line number prefixes in `before` → only use actual file content, not the "     1→" prefix
- Using `edit` for whole-file replacement → use `write` instead for complete rewrites
