Skip to content

v2.16.6 — ctx_edit CRLF fix for Windows

Choose a tag to compare

@yvgude yvgude released this 04 Apr 15:41

ctx_edit: Windows CRLF support

ctx_edit failed on Windows because files use \r\n (CRLF) but agents send old_string with \n (LF). The exact string match failed silently, causing fallback to Write (full-file rewrite) or Bash.

Fixed

  • CRLF/LF auto-normalizationctx_edit detects the file's line ending style and converts old_string/new_string to match. CRLF ↔ LF works transparently in both directions.
  • Trailing whitespace tolerance — If exact match fails, ctx_edit retries after trimming trailing whitespace per line, matching the original span.
  • Better error messages — Failed matches on CRLF files now show "(file uses CRLF line endings)".
  • 9 unit tests covering CRLF→LF, LF→CRLF, trailing whitespace, and combined scenarios.

Also in v2.16.5 (same session)

  • ctx_edit MCP tool — Search-and-replace without native Read/Edit dependency.
  • Instructions v7 — Anti-loop guidance: "NEVER loop on Edit failures — use ctx_edit."
  • PREFER over NEVER — Native tools allowed as fallback.

Upgrade

cargo install lean-ctx    # or
npm i -g lean-ctx-bin     # or
brew upgrade lean-ctx     # then:
lean-ctx setup            # re-install rules (v7)

Full Changelog: v2.16.5...v2.16.6