Skip to content

feat(cli): component-md transformer - deterministic single-file markdown reference#180

Open
nathanacurtis wants to merge 1 commit into
release/schema-0.28.0+cli-0.24.0from
feat/component-md
Open

feat(cli): component-md transformer - deterministic single-file markdown reference#180
nathanacurtis wants to merge 1 commit into
release/schema-0.28.0+cli-0.24.0from
feat/component-md

Conversation

@nathanacurtis

Copy link
Copy Markdown
Member

Summary

Adds a component-md transformer to specs transform that emits a deterministic, single-file component.md per component, projected verbatim from api.yaml + variants.yaml (+ examples.yaml when present). Zero LLM calls, byte-reproducible, ~15ms per component.

This is the first concrete step on RFC 0001 (Component Dictionary): the {c}.md output, shaped as a transform transformer alongside contract and css.

Sections emitted

  • Overview — counts, variant axes (inert axes flagged), contents manifest with configuration-space size
  • Props — types, defaults, enum values, slot constraints (min/max/anyOf), code-only markers, example values, binding notes, contract omissions
  • Bindings — direct, conditional, and variant-scoped (When column)
  • Statesprocessing.states classification with web selectors, contract inclusion, and unclassified rows for unmapped enum values
  • Anatomy — with element-presence pivot (default / all variants / specific configurations)
  • Layout — default tree + deduplicated variant trees, each with + added − removed diff
  • Element styles / Typography / Color — verbatim token paths with resolved rawValue when the spec carries it; element × property color map with per-variant overrides
  • Variant deltas — numbered, with stated resolution rule, content/instanceOf swap rows, layout diffs, Color cross-references
  • Invalid combinations — exact-cover minimized (24 spec rows → 5 patterns on egdsButton), with equivalence note
  • Subcomponents — linked per-subcomponent component.md files (recursive)
  • Examples — instance examples as non-default prop configurations
  • Provenance

Validation

  • 35 unit tests (packages/cli/tests/unit/transforms/ComponentMd.test.ts); full CLI suite passes (439)
  • Run against 134 fixture components across the de-library and eg-spec-to-figma specs-testing workspaces; byte-determinism verified by repeated-run diff
  • Hardened via a three-lens adversarial review (React / SwiftUI / Compose implementer + LLM-agent perspectives); all correctness findings (dropped instanceOf swaps, dropped element content, variant-scoped bindings, unstated delta resolution rule) fixed
  • Fixture corpora with generated outputs: specs-testing branch test/component-md

Docs

New page site/src/content/docs/cli/transforms/component-md.md; rows added to the transforms index and transform command reference.

🤖 Generated with Claude Code

…arkdown reference

Emits component.md per component from api.yaml + variants.yaml: overview
with variant axes and contents manifest, props (slot constraints, code-only
markers, examples), bindings incl. variant-scoped with When column, states
classification with unclassified-value rows, anatomy with element-presence
pivot, layout trees with diffs vs default, element styles incl. content,
typography, element×property color map, numbered variant deltas with
instanceOf/content rows and resolution rule, exact-cover-minimized invalid
combinations, linked subcomponent files, instance-example configurations,
and provenance. Token references render verbatim with resolved rawValue
when the spec carries it.

Hardened via three-lens adversarial review (React / SwiftUI / Compose
consumers) against 134 fixture components across two workspaces;
byte-deterministic across repeated runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant