singularity-forge/packages/pi-coding-agent/src
Lex Christopherson 4c97d59536 feat: add native Rust diff engine for edit tool
Move the edit tool's hot-path diffing operations from JS to native Rust:
- `normalizeForFuzzyMatch`: single-pass Unicode normalization (smart quotes,
  dashes, special spaces, trailing whitespace)
- `fuzzyFindText`: exact-then-fuzzy substring search with UTF-16 index
  conversion for JS compatibility
- `generateDiff`: unified diff generation using the `similar` crate
  (Myers' algorithm with optimizations)

The Rust module at `native/crates/engine/src/diff.rs` exposes three napi
functions. The TypeScript wrapper at `packages/native/src/diff/` follows
the existing module pattern. `edit-diff.ts` now delegates to native
implementations while keeping line-ending handling and file I/O in JS.

18 tests covering normalization, fuzzy matching (including UTF-16 index
correctness with emoji/surrogate pairs), and diff generation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:11:40 -06:00
..
cli feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
core feat: add native Rust diff engine for edit tool 2026-03-13 14:11:40 -06:00
modes feat: wire native Rust image module into image processing pipeline 2026-03-13 13:41:53 -06:00
utils feat: wire native Rust image module into image processing pipeline 2026-03-13 13:41:53 -06:00
cli.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
config.ts feat: TTSR + blob/artifact storage (ported from oh-my-pi) 2026-03-13 08:43:56 -06:00
index.ts fix: sanitize Windows NUL redirects to /dev/null in Git Bash (#157) 2026-03-13 09:33:28 -06:00
main.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
migrations.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00