Skip to content

v0.6.0 — Cascading replace engine for smarter edits

Choose a tag to compare

@buddingnewinsights buddingnewinsights released this 10 Jun 14:55
· 1 commit to main since this release

Added

  • replace() module — cascading text replacement engine with 6 strategies for smarter edit matching. Handles the common failure modes when LLMs generate oldText with mismatched whitespace, escape sequences, or minor formatting drift.

Strategies (in order)

Strategy What it handles
Simple Exact substring match (fast path)
EscapeNormalized LLM-escaped \n, \t, \r, quotes, backticks, \$, \\
LineTrimmed Per-line whitespace differences (indentation drift, trailing space)
BlockAnchor Multi-line blocks with minor line differences (Levenshtein similarity)
WhitespaceNormalized Collapsed or expanded whitespace between tokens
TrimmedBoundary Leading/trailing whitespace in oldText

Changed

  • Edit tool now tries replace() before falling back to SDK edit tool — most edits are applied directly without SDK round-trip
  • BlockAnchor threshold: dual threshold (single candidate=0.25, multiple=0.4) for better precision

Fixed

  • Test: review-command — mock hunk-bridge.ts returning available: false to prevent blocking on local hunk CLI
  • Test: interactive — replace nonexistent review_git_comment assertion with actual output

Testing

  • 23 new e2e integration tests simulating full edit-tool flow (read → replace → write → verify on disk)
  • Covers every strategy with real file I/O across TS, Python, JSON, Markdown
  • 166 total tests, all passing