Acceptance Criteria
- New file
runes/plan/src/cards.ts exists cards.ts has zero imports from node:fs, node:path, or node:child_processcards.ts only depends on @markdoc/markdoc (pure JS) and @refrakt-md/types (type-only imports)buildEntityCard(entity) is exported and produces the same Tag structure as the current inline versionbuildDecisionEntry(entity) is exported and produces the same Tag structurebuildMetaBadge(label, value, opts) is exported- All seven sentiment maps are exported as named constants:
WORK_STATUS_SENTIMENT, BUG_STATUS_SENTIMENT, PRIORITY_SENTIMENT, SEVERITY_SENTIMENT, SPEC_STATUS_SENTIMENT, DECISION_STATUS_SENTIMENT, MILESTONE_STATUS_SENTIMENT - Pipeline imports card builders and sentiments from
./cards.js instead of defining them inline - All existing backlog, decision-log, and relationship rendering produces identical output
- Existing tests pass without modification
Approach
- Create
cards.ts. Move the seven sentiment map constants, buildMetaBadge(), buildEntityCard(), and buildDecisionEntry() from pipeline.ts. - The card builders use
EntityRegistration from @refrakt-md/types for the entity parameter type and Tag from @markdoc/markdoc for constructing renderables — both are pure, edge-safe dependencies. - In
pipeline.ts, replace the moved code with: import { buildEntityCard, buildDecisionEntry, buildMetaBadge, WORK_STATUS_SENTIMENT, ... } from './cards.js'. - Verify that
pipeline.ts no longer defines any sentiment maps or card builder functions. - Run existing tests to confirm no regressions.
Dependencies
None — independent of other extractions.
References
- SPEC-040 — Edge Runtime Compatibility for Plan Package
Resolution
Completed: 2026-04-14
Branch: claude/edge-runtime-refactor-HOg8v
What was done
- Created
runes/plan/src/cards.ts with buildEntityCard, buildDecisionEntry, buildMetaBadge and all 7 sentiment maps - Pipeline.ts now imports only buildEntityCard and buildDecisionEntry from cards.ts (sentiment maps are used internally by the card builders)
- Removed ~150 lines of inline card/sentiment code from pipeline.ts
Notes
- cards.ts depends only on @markdoc/markdoc (pure JS) and @refrakt-md/types (type-only import for EntityRegistration)
- All backlog, decision-log, and relationship rendering tests pass — output is identical