Group SDK-scoped pages under sub-headers in /docs/llms.txt#3354
Open
Group SDK-scoped pages under sub-headers in /docs/llms.txt#3354
Conversation
Pages whose path begins with a known SDK segment (e.g. nextjs/foo.mdx) are now listed under a '### <SDK Display Name>' sub-header, after the generic pages, in /docs/llms.txt. SDK sections are emitted in the order defined by VALID_SDKS for stable output. Co-authored-by: Nick Wylynko <nick@wylynko.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reference docs like docs/reference/vue/clerk-plugin.mdx live under a non-SDK top-level directory but are scoped to a single SDK. Detect the SDK from any directory segment in the path (skipping the trailing file segment so e.g. core-2/expo.mdx isn't misclassified) and add aliases for path slugs that don't match the SDK key: - javascript -> js-frontend - express -> expressjs Co-authored-by: Nick Wylynko <nick@wylynko.com>
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.
🔎 Previews:
What does this solve? What changed?
Restructures the auto-generated
/docs/llms.txtoverview so that SDK-scoped pages are grouped under per-SDK sub-headers, instead of being interleaved as one flat list. Generic (non-SDK) pages are listed first under## Docs, then each SDK gets its own### <SDK Display Name>section.For example:
A page is treated as SDK-scoped if any directory segment in its path matches a known SDK. This covers two patterns:
nextjs/api-doc.mdx.reference/vue/clerk-plugin.mdx,reference/astro/clerk-middleware.mdx,reference/nuxt/integration.mdx.The trailing filename segment is intentionally excluded so a generic doc like
guides/.../core-2/expo.mdxis not misclassified as an Expo-scoped page.Two URL slugs don't match their SDK key, so they're recognized via an alias map:
javascript→js-frontendexpress→expressjsImplementation details:
scripts/lib/llms.ts–writeLLMsbuckets pages withgetSdkFromPath, which scans directory segments and consultsPATH_SEGMENT_SDK_ALIASES. Generic pages are emitted first; SDK sections follow in the order defined byvalidSdksfor stable, deterministic output. ASDK_DISPLAY_NAMESmap provides human-friendly section titles (e.g.nextjs→Next.js,tanstack-react-start→TanStack React Start,js-frontend→JavaScript).scripts/build-docs.ts– passesconfig.validSdksintowriteLLMsso the grouping logic shares the canonical SDK list.scripts/build-docs.test.ts– adds two new tests:Should group SDK-scoped pages under sub-headers in llms.txt overview– covers the SDK-variant case (dist/<sdk>/foo.mdx).Should group reference/<sdk>/ pages and URL-aliased SDKs under their SDK sub-header– coversreference/vue,reference/astro,reference/javascript(→js-frontend) andreference/express(→expressjs).All 150 existing build-docs tests pass.
Deadline
Other resources