Skip to content

sld0Ant/pi-diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@sld0ant/pi-diff

High-performance diff patch for pi-agent with Patience algorithm and WASM acceleration.

Quick Install

bunx @sld0ant/pi-diff install

Uninstall

bunx @sld0ant/pi-diff uninstall

Check Status

bunx @sld0ant/pi-diff status

Features

  • Patience algorithm for code — better structure preservation (functions, classes)
  • Myers algorithm for data — faster for JSON, YAML, Markdown
  • WASM acceleration — 5-8x faster on large files (>1000 lines)
  • 80 KB — compact universal WASM bundle

How It Works

Auto Algorithm Selection

File Type Algorithm Reason
.ts, .js, .py, .rs, .go Patience Preserves code structure
.json, .yaml, .md, .txt Myers Faster for data
>10000 lines Myers Performance

Example Difference

Refactoring: moving a function

Myers shows:

-function hello() { ... }
+function world() { ... }

(thinks hello was replaced with world)

Patience shows:

+function world() { ... }
 
 function hello() { ... }

(understands world was added, hello stayed)

Performance

File Size JS (diff) WASM (@sld0ant/pi-diff) Speedup
1000 lines 4ms 2.5ms 1.6x
5000 lines 119ms 21ms 5.6x
10000 lines 520ms 64ms 8.1x

Build from Source

Prerequisites

  • Rust + cargo
  • wasm-pack (cargo install wasm-pack)
  • Bun

Build

bun install
bun run build

Local Install

bun run install-patch

After Updating pi-agent

When pi-agent is updated, the patch will be overwritten. Reinstall:

bunx @sld0ant/pi-diff install

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published