ID:WORK-147Status:done
Extract entity card builder and sentiments into cards module
Extract buildEntityCard(), buildDecisionEntry(), buildMetaBadge(), and all sentiment map constants from pipeline.ts into a new cards.ts module with zero Node.js imports.
Priority:highComplexity:moderateSource:SPEC-040
Acceptance Criteria
- New file
runes/plan/src/cards.tsexists cards.tshas zero imports fromnode:fs,node:path, ornode:child_processcards.tsonly 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.jsinstead 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(), andbuildDecisionEntry()frompipeline.ts. - The card builders use
EntityRegistrationfrom@refrakt-md/typesfor the entity parameter type andTagfrom@markdoc/markdocfor 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.tsno longer defines any sentiment maps or card builder functions. - Run existing tests to confirm no regressions.
Dependencies
None — independent of other extractions.
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
- Created
runes/plan/src/cards.tswith 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
Relationships
Dependency of
History
- 888d791statusready→done
- ☑ New file `runes/plan/src/cards.ts` exists
- ☑ `cards.ts` has zero imports from `node:fs`, `node:path`, or `node:child_process`
- ☑ `cards.ts` only depends on `@markdoc/markdoc` (pure JS) and `@refrakt-md/types` (type-only imports)
- +7 more criteria
- 7340389Created (ready, high, moderate, SPEC-040, plan, architecture, edge-runtime)