Summary
Add a {component}.tokens.json emitter to specs-cli that projects a validated component contract into a flat JSON file listing every design token referenced, with type metadata and a per-element usage map.
RFC
This emitter is specified in RFC 001: Component Dictionary — emitter group defaults, priority high, complexity trivial.
Flat list of every token referenced, with type and per-element usage map.
Sketch
rfc/001-component-dictionary/sketches/button.tokens.json
The sketch shows a { component, tokens[] } structure with slash-delimited token paths (including parametric patterns like pattern/size/control/{small|medium|large}/gap) and typography token references.
The RFC notes this emitter should carry richer metadata than the sketch currently shows — specifically $type and per-element usage map, similar in structure to what StylingInventory tracks per row (appliedTo: Map<string, number>). See specs-plugin-2/src/Output/StylingInventory/types.ts for the StylingInventoryRow shape as a reference for what that metadata looks like.
Acceptance criteria
Summary
Add a
{component}.tokens.jsonemitter tospecs-clithat projects a validated component contract into a flat JSON file listing every design token referenced, with type metadata and a per-element usage map.RFC
This emitter is specified in RFC 001: Component Dictionary — emitter group
defaults, priority high, complexity trivial.Sketch
rfc/001-component-dictionary/sketches/button.tokens.jsonThe sketch shows a
{ component, tokens[] }structure with slash-delimited token paths (including parametric patterns likepattern/size/control/{small|medium|large}/gap) and typography token references.The RFC notes this emitter should carry richer metadata than the sketch currently shows — specifically
$typeand per-element usage map, similar in structure to whatStylingInventorytracks per row (appliedTo: Map<string, number>). Seespecs-plugin-2/src/Output/StylingInventory/types.tsfor theStylingInventoryRowshape as a reference for what that metadata looks like.Acceptance criteria
defaultsgroup$typemetadata