Skip to content

Include in build script output llms-full.txt per sdk#3353

Draft
NWylynko wants to merge 1 commit into
mainfrom
nick/per-sdk-llms-full
Draft

Include in build script output llms-full.txt per sdk#3353
NWylynko wants to merge 1 commit into
mainfrom
nick/per-sdk-llms-full

Conversation

@NWylynko
Copy link
Copy Markdown
Contributor

@NWylynko NWylynko commented May 7, 2026

Summary

Companion to clerk/clerk#2385. That PR replaces /docs/llms-full.txt with a small index that links out to per-SDK full-context dumps at /docs/llms/{sdk}/llms-full.txt. Those routes call getFileContents('_llms/{sdk}/llms-full.txt', branch) from this repo — so we need to actually produce those files in the build.

What this changes

  • New optional llms.perSdkFullPath config (template, defaults to _llms/{sdk}/llms-full.txt). When set, the build emits one bundle per canonical SDK in validSdks after the existing _llms/llms-full.txt.
  • filterOutputDocsForSdk(docs, targetSdk, validSdks) decides what goes in each per-SDK bundle:
    • Files under {targetSdk}/… — kept (the real SDK-specific content).
    • Files under {otherSdk}/… — dropped.
    • Core (non-prefixed) files — dropped if shadowed by any {anySdk}/<same path> (those core files are landing-redirect pages).
    • Single-SDK docs that don't get their own variant directory (sdkScoped: true at the core path) — included only when targetSdk is in availableSdks.
  • listOutputDocsFiles now also extracts sdkScoped + availableSdks from each doc's frontmatter so the filter has what it needs for single-SDK docs.
  • The old _llms/llms-full.txt is preserved, it will still be needed until clerk/clerk is updated

The {sdk} keys in the path are the canonical 16 SDKs from VALID_SDKS — matching what clerk/clerk resolves migration aliases to via sdkMap.

Verification

  • pnpm exec vitest run — 191/191 tests pass, including:
    • scripts/lib/llms.test.ts — unit tests for sdkPrefixOfPath (incl. react vs react-router disambiguation) and filterOutputDocsForSdk (core/shadowed/single-SDK/other-SDK cases).
    • scripts/build-docs.test.ts — two new integration tests covering the per-SDK output (multi-SDK doc with .react.mdx variant + shared core doc; and skipping emission for SDKs with zero content).
  • pnpm run build against the real docs:
    • Emits all 16 per-SDK bundles plus the existing combined one.
    • Sample sizes: combined 367k lines · nextjs 123k · react 119k · js-frontend 114k · go 96k.
    • Each per-SDK file has zero redirectPage: frontmatter and a single distinct activeSdk: value matching the bundle.

Follow-ups

  • Once this lands, the routes added in clerk/clerk#2385 will start serving real content. Until then those routes 404 (called out in that PR's testing notes).

Made with Cursor

Adds per-SDK full-context bundles to the build output. The clerk app's new
/docs/llms/{sdk}/llms-full.txt route fetches these via getFileContents.

- New configurable `llms.perSdkFullPath` template (defaults to
  `_llms/{sdk}/llms-full.txt`); when set, the build emits one file per
  canonical SDK in `validSdks`.
- `filterOutputDocsForSdk` keeps `{targetSdk}/...` variants and core docs
  that are neither shadowed by an SDK landing-redirect nor restricted to
  other SDKs via frontmatter `availableSdks`.
- `listOutputDocsFiles` now exposes `sdkScoped` + `availableSdks` from
  frontmatter so per-SDK filtering works for single-SDK docs that don't
  get their own variant directory.
- Old `_llms/llms-full.txt` is preserved for backwards compatibility.

Companion to clerk/clerk#2385, which serves these files.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-docs Ready Ready Preview May 7, 2026 5:44pm

Request Review

@NWylynko NWylynko changed the title Emit per-SDK _llms/{sdk}/llms-full.txt bundles Include in build script output llms-full.txt per sdk May 7, 2026
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