ID:WORK-148Status:done
Add edge-safe entry points to package.json exports
Wire up new package entry points in runes/plan/package.json for the extracted edge-safe modules: ./diff, ./filter, ./relationships, ./cards. Verify that each entry point can be imported without triggering Node.js API resolution.
Priority:highComplexity:simpleSource:SPEC-040
Acceptance Criteria
runes/plan/package.jsonexports map includes"./diff"pointing to./dist/diff.jswith types at./dist/diff.d.tsrunes/plan/package.jsonexports map includes"./filter"pointing to./dist/filter.jswith types at./dist/filter.d.tsrunes/plan/package.jsonexports map includes"./relationships"pointing to./dist/relationships.jswith types at./dist/relationships.d.tsrunes/plan/package.jsonexports map includes"./cards"pointing to./dist/cards.jswith types at./dist/cards.d.ts- Existing entry points (
.,./scanner,./cli-plugin) are unchanged - Each new entry point's module graph contains zero imports from
node:fs,node:path, ornode:child_process(verified by a build-time or test-time check) - Package builds successfully with
tsc - All existing tests pass
Approach
- Add the four new export entries to the
"exports"field inrunes/plan/package.json, matching the pattern used by existing entries (both"types"and"default"conditions). - After the package builds, verify edge-safety by statically analyzing the import graph of each new entry point. A simple approach: for each entry point, recursively follow imports and assert none resolve to
node:*modules. This can be a test or a build script check. - Run the full test suite to confirm no regressions.
Dependencies
- Extract pure scanner functions into scanner-core module — scanner-core extraction (provides the split scanner)
- Extract pure diffing functions into diff module — diff module extraction
- Extract relationship builder into relationships module — relationships module extraction
- Extract entity card builder and sentiments into cards module — cards module extraction
References
- Edge Runtime Compatibility for Plan Package — Edge Runtime Compatibility for Plan Package
Resolution
Completed: 2026-04-14
Branch: claude/edge-runtime-refactor-HOg8v
What was done
- Added four new entry points to runes/plan/package.json exports map: ./diff, ./filter, ./relationships, ./cards
- Each entry specifies both types (.d.ts) and default (.js) conditions
- Verified all four entry points have zero Node.js imports via grep audit
- Full monorepo build succeeds; all 321 plan tests pass
Notes
- Existing entry points (., ./scanner, ./cli-plugin) are completely unchanged
- Edge consumers can now:
import { diffAttributes } from '@refrakt-md/plan/diff'
Relationships
Depends on
ID:WORK-144Status:done9/9
Extract pure scanner functions into scanner-core module
Priority:highComplexity:moderate
ID:WORK-145Status:done10/10
Extract pure diffing functions into diff module
Priority:highComplexity:simple
ID:WORK-146Status:done11/11
Extract relationship builder into relationships module
Priority:highComplexity:moderate
ID:WORK-147Status:done10/10
Extract entity card builder and sentiments into cards module
Priority:highComplexity:moderate
History
- 888d791statusready→done
- ☑ `runes/plan/package.json` exports map includes `"./diff"` pointing to `./dist/diff.js` with types at `./dist/diff.d.ts`
- ☑ `runes/plan/package.json` exports map includes `"./filter"` pointing to `./dist/filter.js` with types at `./dist/filter.d.ts`
- ☑ `runes/plan/package.json` exports map includes `"./relationships"` pointing to `./dist/relationships.js` with types at `./dist/relationships.d.ts`
- +5 more criteria
- 7340389Created (ready, high, simple, SPEC-040, plan, architecture, edge-runtime)