Repository navigation
feat(docs): generate llms.txt and a Markdown reference per component (#20) - #52
Merged
Merged
Conversation
scripts/build-agent-docs.ts writes docs/generated/llms.txt and
docs/generated/components/<slug>.md from the component manifest and the docs
pages, so there is no second documentation system to maintain.
Each reference carries the summary, import line, category, anatomy with
data-slots, props, variants, controlled/uncontrolled props and composition
from the manifest, the when-to-use guidance ("Not documented yet." until
#51 writes it), then the page's prose as plain Markdown: live demos become
their files' source verbatim, Callout a quote, Guidelines a do/don't list,
Keyboard a table. Unknown JSX outside a code fence fails the build.
llms.txt indexes every reference by sidebar category, plus the design
rules, AGENTS.md, ADR 0001 and the manifest (pinned to the version's tag).
The site serves all three at /llms.txt, /components/<slug>.md and
/components.manifest.json, from the committed files.
pnpm docs:agents regenerates docs/generated/; docs:check fails when it is
stale. AGENTS.md and CONTRIBUTING document both.
Closes #20
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
Generates agent-readable docs from sources the repo already has. Nothing is written by hand a second time.
docs/generated/llms.txt: an index in the llmstxt.org format.docs/generated/components/<slug>.md: one reference per component, 54 in total.Closes #20.
What a reference contains
From the manifest (#19):
importline (plusimport typewhen the file exports types), category, built-on, source and package version;data-slot→ JSDoc), props per part (extends+ a props table), variants with their default, controlled/uncontrolled props, and composition (foundation, composed components, parts takingasChild);Then the page's prose, under Guide, converted from MDX to plain Markdown:
<Preview demo="…">becomes that demo file's source, verbatim, in a fence longer than any backtick run in the code.<Callout>becomes> **Note/Warning: title**,<Guidelines>a Do/Don't list, and<Keyboard>a Key/Action table. Their props are read with the TypeScript parser, never evaluated.`<ScrollBar />`is prose and passes.You can see the result in
docs/generated/components/tabs.md.llms.txt
Package summary, install/usage, the colour-role rule, then every reference grouped by sidebar category. Next come links to DESIGN.md, AGENTS.md, ADR 0001 and CONTRIBUTING, pinned to the
v<version>tag so they match the version described. Under Optional it links the manifest.Served by the docs site
Three Astro endpoints import the committed files with
?raw:/llms.txt/components/<slug>.md, beside each HTML page/components.manifest.jsonI checked the built
dist/: all three are byte-identical todocs/generated/.Commands
pnpm docs:agentsregenerates the manifest and the agent docs in one go.docs:checknow also runsagents:check, which fails when anything is stale or orphaned.Tests
tests/docs/agent-docs.test.ts, 11 tests:llms.txt;Testing evidence
pnpm format:check✓pnpm lint✓pnpm test: 228 passedpnpm docs:check: manifest current, agent docs current (55 files), 0 errors / 0 warnings, 62 pages.Notes
llms.txtamong the sources of truth, addspnpm docs:agentsto the commands, and tells agents to read a component's reference before choosing it. CONTRIBUTING documents the generator and adds a Scripts row. Releasing now says to runpnpm docs:agentsafter the version bump.Public API / dependency changes
None.