WORK-148
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
claude/file-naming-convention-LJdwR View source

Criteria completion

No incremental history — criteria tracking started on Apr 21.

Branches 1
claude/file-naming-convention-LJdwR current done
main done
History 1
  1. f2b3512
    Created (done)by Claude
    Add {ID}-{slug}.md filename convention + migrate filenames subcommand

Acceptance Criteria

  • 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
  • runes/plan/package.json exports map includes "./cards" pointing to ./dist/cards.js with 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, or node:child_process (verified by a build-time or test-time check)
  • Package builds successfully with tsc
  • All existing tests pass

Approach

  1. Add the four new export entries to the "exports" field in runes/plan/package.json, matching the pattern used by existing entries (both "types" and "default" conditions).
  2. 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.
  3. Run the full test suite to confirm no regressions.

Dependencies

  • WORK-144 — scanner-core extraction (provides the split scanner)
  • WORK-145 — diff module extraction
  • WORK-146 — relationships module extraction
  • WORK-147 — cards module extraction

References

  • SPEC-040 — 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'