Skip to content

feat(docs): extract agent-relevant metadata with the API tables (#18) - #49

Merged
YaelAnaya merged 1 commit into
mainfrom
feat/18-extractor-metadata
Dec 5, 2026
Merged

YaelAnaya merged 1 commit into
mainfrom
feat/18-extractor-metadata

Conversation

@YaelAnaya

Copy link
Copy Markdown
Contributor

Summary

Extends examples/catalog/scripts/extract-api.ts, the existing extractor rather than a new engine, so every generated src/generated/api/<slug>.json carries structured, agent-relevant facts. It also makes the output deterministic. This feeds the manifest (#19) and the LLM docs (#20).

Closes #18.

New fields (all additive, all read from source)

Where Field Example
part description JSDoc on the part's function or arrow. SearchInput: "A search field: …"
part variants Button: { name: "variant", values: ["default", "outline", …], default: "default" }
part dataSlots Checkbox: ["checkbox", "checkbox-indicator"]
part state Checkbox: { prop: "checked", defaultProp: "defaultChecked", onChange: "onCheckedChange" }. Any prop with an on<Prop>Change, declared or inherited from the primitive
part asChild true for Button, false for Card
file foundation radix-ui/Tabs, @base-ui/react, cmdk, vaul, sonner, @ui-sdk/* (runtime imports only)
file composes FilterParamsBar: Button, Command, HoverCard, Popover, Select (named by each file's primary part)
file types CodeBlock: ["CodeBlockVariant"] (still also listed in helpers, which the docs render)
file description A JSDoc block ahead of the imports. No file has one today, so it is "" everywhere rather than guessed

index.json no longer contains generatedAt.

Compatibility

  • The legacy fields are unchanged. I loaded main's extractor next to this one and compared slug, source, helpers and each part's name/extends/props for all 54 components. The two outputs are identical (70,690 chars of JSON), so the catalog's API tables render exactly as before.
  • examples/catalog/src/lib/api.ts only re-exports the types, and the new interface fields are additive.

Tests

tests/docs/api-extractor.test.ts has 11 new tests:

  • 9 for the metadata: variants, data-slots, foundation, composes, types, state, asChild, JSDoc, and the "nothing invented" rule.
  • 2 for determinism: two extractions give equal JSON, and writeAll to two temp dirs gives byte-identical files. The index keys are exactly components and exportsCovered.

Testing evidence

  • pnpm format:check ✓
  • pnpm lint ✓
  • pnpm test: 206 passed
  • pnpm build ✓
  • pnpm docs:check: 0 errors, 0 warnings, 62 pages ✓

Docs

docs/CONTRIBUTING.md The docs site gets one paragraph on the new fields, and asks contributors to write a part's purpose as JSDoc on the part.

Public API / dependency changes

None.

The extractor now records, beside each component's API tables, the facts an
agent would otherwise dig out of the source:

- per part: its JSDoc, its cva variants as lists with their default, the
  data-slot values it renders, its controlled/uncontrolled props (any prop
  with an on<Prop>Change, declared or inherited) and whether it takes asChild;
- per file: the behaviour libraries it imports (radix-ui/<Primitive>, Base
  UI, cmdk, vaul, sonner, UI SDK), the Robomous components it composes by
  their primary part, its exported types, and a file-level JSDoc when one
  exists (none does yet).

Everything is read from the source; nothing is inferred. The fields are
additive: the existing ones are byte-for-byte what main produces, so the docs
site's tables do not change. index.json loses generatedAt, so the same source
gives the same bytes.

Closes #18
@YaelAnaya YaelAnaya added type: enhancement Improvement to existing functionality area: agent-tooling Agent instructions, skills, and workflows area: documentation Documentation and component catalog labels Dec 5, 2026
@YaelAnaya YaelAnaya self-assigned this Dec 5, 2026
@YaelAnaya
YaelAnaya merged commit ba6aeeb into main Dec 5, 2026
1 check passed
@YaelAnaya
YaelAnaya deleted the feat/18-extractor-metadata branch December 5, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agent-tooling Agent instructions, skills, and workflows area: documentation Documentation and component catalog type: enhancement Improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[05] DOC-01 · Extend the API extractor with agent-relevant metadata

1 participant