Acceptance Criteria
- New file
runes/plan/src/diff.ts exists and contains all pure diffing functions diff.ts has zero imports from node:fs, node:path, or node:child_processdiffAttributes(prev, curr) is exported from diff.ts with AttributeChange typediffCriteria(prev, curr) is exported from diff.ts with CriteriaChange typeparseTagAttributes(line) is exported from diff.tsparseCheckboxes(content) is exported from diff.ts with ParsedCheckbox typehasResolutionSection(content) is exported from diff.tshistory.ts imports from diff.ts and re-exports the types for backwards compatibility- All existing imports from
./history continue to work (no breaking changes) - Existing history tests pass without modification
Approach
- Create
diff.ts and move the five pure functions plus their types (AttributeChange, CriteriaChange, ParsedCheckbox) and supporting regex constants (TAG_ATTR_RE, CHECKBOX_RE, RESOLUTION_RE). - In
history.ts, replace the moved code with imports: import { diffAttributes, diffCriteria, parseTagAttributes, parseCheckboxes, hasResolutionSection, type AttributeChange, type CriteriaChange, type ParsedCheckbox } from './diff.js' and re-export them. - Git transport functions (
getFileCommits, getFileAtCommit, extractEntityHistory, getBatchCommits, extractBatchHistory, isShallowClone) and cache functions stay in history.ts. - Run existing tests to confirm no regressions.
Dependencies
None — independent of the scanner-core extraction.
References
- SPEC-040 — Edge Runtime Compatibility for Plan Package
- SPEC-038 — Git-Native Entity History
Resolution
Completed: 2026-04-14
Branch: claude/edge-runtime-refactor-HOg8v
What was done
- Created
runes/plan/src/diff.ts with all pure diffing functions (diffAttributes, diffCriteria, parseTagAttributes, parseCheckboxes, hasResolutionSection) and their types (AttributeChange, CriteriaChange, ParsedCheckbox) - Updated
runes/plan/src/history.ts to import from diff.ts and re-export all functions and types for backwards compatibility
Notes
- diff.ts has zero dependencies on Node.js APIs — only pure TypeScript
- All 31 history tests pass without modification