-
Notifications
You must be signed in to change notification settings - Fork 2
Labels
Description
Summary
Introduce MultiEdit, a batch editing tool built on top of Edit to perform multiple exact find-and-replace operations on a single file in one atomic action. Prefer MultiEdit over Edit when changing several parts of the same file.
Why
Reduces round trips and risk of partial edits; guarantees all-or-nothing changes when multiple replacements are needed.
Spec (condensed)
-
name:
MultiEdit -
input:
file_path(string, absolute)edits(array, min 1) of objects:old_string(string, exact match incl. whitespace)new_string(string)replace_all(boolean, defaultfalse)
-
Preconditions: Must use
Readfirst; verify directory path. -
Behavior:
- Apply edits in order, each on the result of previous.
- Atomic: if any edit fails, none are applied.
- Same requirements as
Edit.
-
Warnings / Failures:
- Fail if
old_stringdoesn’t match exactly. - Fail if
old_string == new_string. - Earlier edits may affect later matches—caller must plan accordingly.
- Fail if
-
Guidelines:
- Keep code idiomatic and unbroken.
- Always use absolute paths.
- Use
replace_allfor broad renames. - No emojis unless explicitly requested.
- To create a new file: supply a new absolute path; first edit uses empty
old_stringand full file content innew_string.
Acceptance Criteria
- CLI exposes
MultiEditadhering to the above spec. - Edits execute sequentially and transactionally (all-or-nothing).
- Proper error messages for mismatches, identical old/new strings, and partial-failure scenarios.
- Verified workflow:
Read→MultiEditon existing file and on new-file creation path. - Tests cover ordered edits,
replace_all, rollback on failure, and.ipynbguard.
Reactions are currently unavailable