Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
938 B
938 B
String Diff
Path: src/string-diff.ts
Export: calculateStringDiff, applyStringDiff, calculateDiffSavings, shouldUseDiff, StringDiff
What it does
Efficiently encodes string changes by finding common prefix and suffix, only encoding the differing middle section.
Key API
| Function | Description |
|---|---|
calculateStringDiff(previous, current) |
Compute { prefixLen, suffixLen, middleLen, middle } |
applyStringDiff(previous, diff) |
Reconstruct current string from diff |
calculateDiffSavings(previous, current, diff) |
Percentage savings from diff encoding |
shouldUseDiff(previous, current, threshold?) |
Decide whether diff encoding is worthwhile |
Format
[prefixLen][suffixLen][middleLen][middleChars...] — each length field is 1 byte.
Used by
- Delta compression for string fields in game state
- Network protocols with repetitive string data