2.3 KiB
@suaveplan/diff
Zero-dependency RFC 6902 JSON Patch engine for computing, applying, and inverting structural differences between JSON documents. The diff(a, b) function produces a minimal patch using index-based or LCS array strategies; applyPatch applies it; revertPatch undoes it; and invertPatch creates an inverse patch. A HistoryManager provides undo/redo with configurable depth and branch truncation on new edits. A SyncManager handles optimistic concurrency: apply local changes speculatively, then reconcile when the server responds. RFC 6901 JSON Pointer parsing and formatting is exposed as a standalone path module. Use this package for collaborative editing, undo/redo stacks, change-event streams, and any system where you need to track or transmit the delta between two object states rather than the full state itself.
When to use this skill
- Implementing or debugging code that imports
@suaveplan/diff. - The task touches: see package README.
- You need API guidance for this package's exports.
Quick reference
import { /* see API Reference below */ } from "@suaveplan/diff";
Dependencies
Workspace dependencies: none
Where to read more
This skill is intentionally short. The package's own documentation is the authoritative source — read these in order:
packages/foundation/diff/README.md— overview, install, quick-start, module indexpackages/foundation/diff/src/**/*.md— co-located docs per implementation file (Purpose, Features, Basic + Advanced examples, full API reference, Implementation notes — all packages ship ≥200 words per module)packages/foundation/diff/package.jsonexportsmap — every subpath you can import from
When the user asks an API question, read the relevant co-located .md first; do not answer from training-data memory.
See also
- The marketplace root:
../../../README.md
This SKILL.md is auto-generated by suaveplan-skills/scripts/generate-skills.ts from the package's README. Do not edit by hand — re-run the generator after the README changes.