Skip to content

feat(tools): add edit as FFF-backed search-and-replace - #370

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/edit-tool
Aug 16, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/edit-tool

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

Adds a first-class edit tool — exact string replace in an existing file, the same shape Claude Code and OpenCode use.

  • Args: path, old_string, new_string, optional replace_all
  • Also accepts Claude/OpenCode aliases (file_path, old/oldString, new/newString)
  • Fails if the string is empty, missing, identical, or not unique (unless replace_all)
  • Does not create files; stays workspace-confined; refuses .git
  • Shares the FFF index with glob/grep: a miss can hint at other files, and a successful write refreshes the index so the next grep sees the new bytes
  • Inbound names search_replace and edit_file resolve to edit and are not advertised

Use edit for a focused change, write_file to create or replace a whole file, apply_patch for multi-hunk diffs.

Test plan

  • cargo test --package forge-tools --lib edit::
  • cargo test --package forge-tools --test all_tools
  • cargo clippy --package forge-tools --package forge-search --all-targets -- -D warnings
  • CI green on this PR

Add a first-class edit tool (Claude/OpenCode-style exact replace)
that shares the glob/grep index, hints when the string lives in
another file, and refreshes FFF after a write so the next grep
sees the new bytes. Accept inbound search_replace and edit_file.
@github-actions
github-actions Bot enabled auto-merge (squash) August 16, 2026 19:47
@github-actions
github-actions Bot merged commit e0faba6 into main Aug 16, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
Add a first-class edit tool (Claude/OpenCode-style exact replace)
that shares the glob/grep index, hints when the string lives in
another file, and refreshes FFF after a write so the next grep
sees the new bytes. Accept inbound search_replace and edit_file.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Add a first-class edit tool (Claude/OpenCode-style exact replace)
that shares the glob/grep index, hints when the string lives in
another file, and refreshes FFF after a write so the next grep
sees the new bytes. Accept inbound search_replace and edit_file.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Add a first-class edit tool (Claude/OpenCode-style exact replace)
that shares the glob/grep index, hints when the string lives in
another file, and refreshes FFF after a write so the next grep
sees the new bytes. Accept inbound search_replace and edit_file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant