Repository navigation
feat(docs): extract agent-relevant metadata with the API tables (#18) - #49
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends
examples/catalog/scripts/extract-api.ts, the existing extractor rather than a new engine, so every generatedsrc/generated/api/<slug>.jsoncarries 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)
descriptionSearchInput: "A search field: …"variants{ name: "variant", values: ["default", "outline", …], default: "default" }dataSlots["checkbox", "checkbox-indicator"]state{ prop: "checked", defaultProp: "defaultChecked", onChange: "onCheckedChange" }. Any prop with anon<Prop>Change, declared or inherited from the primitiveasChildtruefor Button,falsefor Cardfoundationradix-ui/Tabs,@base-ui/react,cmdk,vaul,sonner,@ui-sdk/*(runtime imports only)composesButton, Command, HoverCard, Popover, Select(named by each file's primary part)types["CodeBlockVariant"](still also listed inhelpers, which the docs render)description""everywhere rather than guessedindex.jsonno longer containsgeneratedAt.Compatibility
main's extractor next to this one and comparedslug,source,helpersand each part'sname/extends/propsfor 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.tsonly re-exports the types, and the new interface fields are additive.Tests
tests/docs/api-extractor.test.tshas 11 new tests:writeAllto two temp dirs gives byte-identical files. The index keys are exactlycomponentsandexportsCovered.Testing evidence
pnpm format:check✓pnpm lint✓pnpm test: 206 passedpnpm build✓pnpm docs:check: 0 errors, 0 warnings, 62 pages ✓Docs
docs/CONTRIBUTING.mdThe 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.