Repository navigation
feat(core): port V1 fuzzy edit matching to V2 core edit tool - #32761
Closed
Robin1987China wants to merge 1 commit into
Closed
Robin1987China wants to merge 1 commit into
Robin1987China wants to merge 1 commit into
Conversation
Contributor
Author
|
Note: This is a |
Robin1987China
force-pushed
the
fuzzy-edit-v2
branch
from
June 22, 2026 02:33
017492f to
4795765
Compare
Robin1987China
force-pushed
the
fuzzy-edit-v2
branch
from
June 22, 2026 08:34
4795765 to
fdc508f
Compare
Contributor
Author
|
Closing — this was a large feat PR in a hot area that didn't follow issue-first. Will re-approach after upstream design discussion if there's interest. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
N/A — feat PR (feature PRs skip issue requirement per contributing guidelines)
Type of change
What does this PR do?
Ports 9 fuzzy replacer strategies from V1 (
packages/opencode/src/tool/edit.ts) to V2 core (packages/core/src/tool/edit.ts), plus Levenshtein distance, similarity thresholds, and the disproportionate-match safety guard.The V2 core edit tool currently only supports exact string matching. This change adds fuzzy fallback strategies tried in order after exact match fails: line-trimmed, block-anchor (Levenshtein similarity), whitespace-normalized, indentation-flexible, escape-normalized, trimmed-boundary, context-aware, multi-occurrence.
How did you verify your code works?
bun turbo typecheck: all 29 packages passbun test test/tool-edit.test.ts: 19/19 tests pass (9 existing + 10 new)Screenshots / recordings
N/A (non-UI change)
Checklist