Built-in tool: search-and-replace edits on files.
Finds old_string in the file and replaces it with new_string.
By default, the match must be unique (appears exactly once). Set
replace_all: true to replace all occurrences. Returns an error
if no match is found, if the match is ambiguous, if old_string is
empty, or if the edit would change nothing.
Matching ignores the difference between CRLF and LF, and the file keeps its line endings and any UTF-8 byte order mark.
Usage
config = %{tools: [Alloy.Tool.Core.Edit], ...}The agent can then call:
%{file_path: "lib/app.ex", old_string: "v1", new_string: "v2"}