Skip to content

v1.9.1: Show closest match on replace failure

Choose a tag to compare

@Draco-Cheng Draco-Cheng released this 23 Jul 02:29
· 4 commits to main since this release

Improvement

update_ai_readme's `replace` operation fails when `searchText` doesn't match anything in the file — and this happens a lot, because the caller (an LLM) is usually re-typing a remembered version of the content rather than copying it exactly. One changed word, dash, or dropped clause and the operation fails with nothing to go on but the text you sent.

The error now also shows the actual closest-matching lines from the file — same line count as your `searchText`, picked by line-level similarity — so the difference is visible at a glance instead of requiring a re-read of the whole file:

Text not found: - mat-autocomplete: never combine manual string [ngModel] with [displayWith] — displayWith changed the string, not the option object.

Closest match in the file (searchText must match this EXACTLY, including punctuation/whitespace):
- mat-autocomplete: never combine manual string [ngModel] with [displayWith] — displayWith receives the string, not the option object.

If nothing in the file is a close enough match (similarity below 0.3), the hint is omitted rather than showing something misleading.

No API changes.