Skip to content

feat(docs): generate llms.txt and per-component LLM docs, publish to GitHub Pages - #3308

Draft
interactivellama wants to merge 8 commits into
feat/v11-llm-3-prop-jsdocfrom
feat/v11-llm-1-llm-docs
Draft

interactivellama wants to merge 8 commits into
feat/v11-llm-3-prop-jsdocfrom
feat/v11-llm-1-llm-docs

Conversation

@interactivellama

@interactivellama interactivellama commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Part of the v11 docs stack (2 of 3, stack #3316). Base: #3314. Merge last: this stack merges after the clean CI and GA requirements stacks, so it documents the final API.

Additional description

Generates docs an LLM agent can fetch, straight from the generated .d.ts, so they can't drift from the types:

  • scripts/generate-llm-docs.ts uses the TypeScript compiler API on dist/types and writes dist/llms/:
    • llms.txt: an index with install and import lines and a link per component
    • components/<name>.md per public component: a props table (type, required, default, @deprecated replacement), the exported types a prop references, and the component.json site-stories examples verbatim
    • llms-full.txt: every component file in one document
  • npm run build runs it (build:llm-docs, after build:types), so dist/llms ships in the npm package. It is not committed.
  • scripts/__tests__/generate-llm-docs.test.mjs emits its own declarations and checks that output covers every public component, required and deprecated props, literal unions, union props types (Button) and examples.
  • .github/workflows/docs-site.yml publishes Storybook to GitHub Pages with dist/llms at the site root, on push to master and on a published release.

Also deletes components/component-docs.json, the 0.10.x docgen output. Only this generator read it (as a fallback description), and nothing regenerates it. Where tsc drops a component's JSDoc from the .d.ts (components that assign displayName), the generator now reads the JSDoc from the component's source file instead. Combobox gets a JSDoc summary, since it had none.

Decisions:

  1. Hosting: GitHub Pages from Actions. It needs no new service or secret, and the site lands at https://salesforce.github.io/design-system-react/.
  2. Compiler API, no docgen dependency. The checker already resolves forwardRef/class components, intersections and discriminated unions. Props from @types/react (HTML pass-through) get a one-line summary instead of table rows.
  3. Literal unions are expanded inline, so the allowed values are in the table. Referenced exported types are printed verbatim under the table. For a union props type, a prop counts as required only if every member requires it.
  4. llms-full.txt includes the examples, since examples are what an agent copies.

Maintainer tasks (not done in this PR):

  • Enable GitHub Pages for the repository with source: GitHub Actions. Until then the deploy job fails.
  • Point react.lightningdesignsystem.com at the Pages site (DNS and the redirect).

Known gaps, not fixed here:

  • panel/component.json lists three site-stories that were deleted in the rewrite. The generator warns and skips them, so Panel has no examples.
  • SimpleDataTableInteractiveLink is typed any in the .d.ts, so its section says its props are untyped.

CONTRIBUTOR checklist (do not remove)

Please complete for every pull request.

Green gate — all of these must pass locally (CI runs the same):

  • npm run lint passes with 0 errors (npm run lint:fix to auto-fix). Warnings are the tracked gradual-migration backlog; do not add new errors.
  • npm run typecheck is clean (tsc --noEmit).
  • npm test -- --run passes — this runs both Vitest projects (jsdom unit + real-browser browser) and the story HTML snapshots. If you changed rendered markup on purpose, update snapshots with npm test -- --run -u and review the diff.
  • npm run build succeeds (type-check + Vite library build + .d.ts + entry shims).

Behavior & docs:

  • First-time contributors: sign the CLA (a bot will comment with instructions).
  • Added/updated Vitest + React Testing Library tests for the change (template: components/button/__tests__). New props and bug fixes should get a regression test. Tests that genuinely need a real browser (focus traversal, layout/measurement, canvas) go in a *.browser.test.jsx file (the browser project); everything else is jsdom.
  • Reviewed the component's Storybook stories: npm run storybook → http://localhost:6007/. Confirm the story actually renders and behaves (deprecated Storyshots/Karma are gone; there is no separate browser-tests server).
  • Story/example code uses the component's real prop API (e.g. slots like content / visualPickerFigure, render props like renderItem, icon props, events), not assumptions — a common source of "component looks broken" reports has been stories authored against the wrong API. Cross-check against components/<name>/__examples__.
  • Storybook Accessibility (a11y) panel shows no new violations for the affected stories.
  • If you added or changed a type, remember runtime PropTypes were removed in the TS migration — types are the contract. Ship accurate .d.ts (they're generated by the build); JS consumers rely on them via editor type-acquisition.

REVIEWER checklist (do not remove)

  • CI is green (GitHub Actions CI workflow: lint, typecheck, test, build). Chromatic visual review, if configured, has been checked.
  • Change has adequate test coverage; bug fixes include a regression test.
  • Reviewed the affected Storybook stories and their a11y panels.
  • Rendered markup still conforms to SLDS — check the story HTML snapshot diff (components/__tests__/__snapshots__/story-snapshots.test.jsx.snap).
  • Public API / package surface: if exports changed, the deep-import contract still holds (@salesforce/design-system-react/components/<name> and nested paths resolve for ESM, CJS, and types). Removing/renaming a public component or export is a breaking change → feat!:/BREAKING CHANGE: and a major version bump.

@interactivellama interactivellama changed the title feat/v11 llm 1 llm docs feat(docs): generate llms.txt and per-component LLM docs, publish to GitHub Pages Nov 13, 2026
Base automatically changed from feat/v11-p1-7-typing to master November 13, 2026 22:28
@interactivellama
interactivellama removed this pull request from stack #3312 November 15, 2026 21:48
@interactivellama
interactivellama changed the base branch from master to feat/v11-llm-3-prop-jsdoc November 15, 2026 21:50
@interactivellama
interactivellama removed this pull request from stack #3315 November 16, 2026 05:53
@interactivellama interactivellama added this to the 11.0.0-rc.1 milestone Nov 18, 2026
@interactivellama
interactivellama removed this pull request from stack #3316 November 18, 2026 23:30
@interactivellama
interactivellama removed this pull request from stack #3344 November 19, 2026 04:42
@interactivellama
interactivellama removed this pull request from stack #3346 November 19, 2026 22:05
@interactivellama
interactivellama removed this pull request from stack #3348 November 20, 2026 00:23
@interactivellama
interactivellama force-pushed the feat/v11-llm-1-llm-docs branch 4 times, most recently from e17f66e to 94edc5b Compare November 20, 2026 23:51
@interactivellama
interactivellama removed this pull request from stack #3359 November 23, 2026 07:57
@interactivellama
interactivellama removed this pull request from stack #3361 November 23, 2026 08:13
scripts/generate-llm-docs.ts reads the emitted dist/types with the
TypeScript compiler API and writes dist/llms/: llms.txt (llmstxt.org
index), llms-full.txt (every component file), and components/<name>.md
with the description, import lines, a props table (required, literal
union values, @deprecated with its replacement), the referenced types,
and up to three examples copied verbatim from site-stories.

Public components are the package-root default exports, grouped by
component directory; utilities/, private/ and directories without a
component.json are skipped.
npm run build now runs build:llm-docs after build:types, so the published
package has dist/llms/llms.txt for agents working offline in a consumer
repo (node_modules/@salesforce/design-system-react/dist/llms/llms.txt).
Emits the declarations into a temp directory and runs the generator on
them, since test:ci runs tests before build. Asserts that every public
component has a file, required props are marked, @deprecated props show
their replacement, and examples are copied verbatim.
On push to master and on release, build the library (which emits
dist/llms) and Storybook, copy dist/llms to the site root so llms.txt is
served at /llms.txt, and deploy to GitHub Pages. DNS for
react.lightningdesignsystem.com is unchanged.
README gets a Documentation section (hosted Storybook, llms.txt, and the
bundled dist/llms/llms.txt for agents). CHANGELOG Added line. ROADMAP:
the hosted-docs workflow is done; enabling Pages and DNS for
react.lightningdesignsystem.com stay open for a maintainer.
The 0.10.x docgen output was only read by the llm-docs generator, as a
fallback description. Nothing regenerates it, so it had drifted from the
components. The generator now falls back to the component's JSDoc in
its source file, which tsc drops from the .d.ts when the component
assigns displayName.
master converted components/index.js to TypeScript, so the llm-docs test
failed with ENOENT reading the old path.

This branch has not been deployed

No deployments
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