Project conventions and architecture for AI-assisted development.
npm run build # tsup --format cjs,esm (outputs to dist/)
npm run lint # eslint src/**/*.ts
npm test # jest --config jest.config.mjs
npx tsc --noEmit # type check without emittingsrc/
index.ts # Re-exports from all modules
jsonDiff.ts # Core diff engine: diff, applyChangeset, revertChangeset,
# atomizeChangeset, unatomizeChangeset
jsonCompare.ts # Enriched comparison: compare, enrich, applyChangelist
helpers.ts # Shared utilities: splitJSONPath, keyBy, setByPath
atomPath.ts # JSON Atom path parsing, canonicalization, conversion
jsonAtom.ts # JSON Atom APIs: diffAtom, applyAtom, revertAtom,
# invertAtom, toAtom, fromAtom, validateAtom
tests/
__fixtures__/ # Test fixtures (jsonDiff fixtures + json-atom conformance)
- Internal format: Hierarchical
IChange[]tree (v4). FlatIAtomicChange[]via atomize/unatomize. - JSON Atom format: Flat
IAtomOperation[]in anIJsonAtomenvelope. Spec at json-atom-format. - Adapter pattern:
jsonAtom.tsconverts between internal and atom formats. No changes tojsonDiff.ts. diffAtomalways usestreatTypeChangeAsReplace: trueand merges REMOVE+ADD pairs into singlereplaceops.applyAtomprocesses operations sequentially with dedicated root ($) handling.fromAtomreturnsIAtomicChange[](1:1 mapping), NOTChangeset.- Path differences: Internal uses
$[a.b](no quotes); atom spec requires$['a.b'](single-quoted). Internal always string-quotes filter literals; spec requires type-correct literals.
unatomizeChangesetregex only matches string-quoted filter literals (B.2 in plan)applyChangesetdoesn't handle$rootleaf operations correctly (B.4)atomizeChangesethasisTestEnvcheck (lines 175-178) — orthogonal smellfilterExpressionnumeric branch is dead code (B.8)
- ESM-first (
"type": "module"in package.json), dual CJS/ESM output via tsup - TypeScript strict mode (
noImplicitAny,noUnusedLocals,noUnusedParameters) strictNullChecksis OFF (tsconfig)- Zero runtime dependencies
- Tests use Jest with ts-jest
- Existing tests use snapshots — don't update snapshots without verifying changes