feat: overhaul llms.txt generation#1043
Merged
Merged
Conversation
Restructure the generated llms.txt around the llms.txt spec and make it actively useful to LLMs and coding agents: - Add a hand-written header partial with an "Instructions for Large Language Models" section (ESM vs classic script patterns, the four PlayCanvas workflows, npm/CDN usage), curated entry points, and an Essential API section linking api.playcanvas.com - Emit spec-format entries: - [Title](url): description, wiring in the per-page frontmatter descriptions that were extracted but unused - Partition secondary sections (account management, glossary, press pack, security) under an ## Optional section per the spec - Exclude tutorials from both generated files - Surface the installed engine version in the file metadata - Fix subcategory ordering to match sidebars.js (dead 'index' entry, missing supersplat/splat-transform/security) - Add a standalone preview harness (npm run preview-llms) to generate both files in seconds without a full site build Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR overhauls llms.txt generation to provide a spec-formatted, LLM-steering overview of the PlayCanvas docs (with a curated, hand-written header), adds engine-version metadata, and introduces a fast local preview workflow for iterating on the generated outputs.
Changes:
- Adds a hand-written
llms.txtheader template (with placeholder substitution) containing workflow guidance, recommended entry points, and curated API links. - Updates the LLM generation plugin to emit spec-style entries (
- [Title](url): description), reorder User Manual sections, add anOptionalpartition, exclude tutorials by default, and include engine version metadata when resolvable. - Adds a preview harness (
npm run preview-llms) to generatellms.txtandllms-full.txtwithout a full Docusaurus build.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| utils/plugins/llms/preview.mjs | Adds a standalone script to run the plugin’s postBuild and write preview outputs to a chosen directory. |
| utils/plugins/llms/llms-header.md | Introduces the curated header content used as the top of generated llms.txt. |
| utils/plugins/docusaurus-plugin-llms.mjs | Refactors llms.txt generation to use the header template, spec-formatted entries with descriptions, optional partitioning, tutorial exclusion, and engine-version resolution. |
| package.json | Adds preview-llms npm script for the preview harness. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
What
Overhauls the generated llms.txt so it actively steers LLMs and coding agents toward correct PlayCanvas code, instead of being a flat link dump.
New llms.txt structure
Changes
- [Title](url): description. The plugin already extracted per-page descriptions (100% of docs have hand-written frontmatter descriptions) but never used them — they're now wired in.## Optionalsection: spec mechanism for content consumers can skip — account management, glossary, press pack, security.excludeDirschange, easy to revert after a tutorial refresh.playcanvaspackage at build time; the line is dropped gracefully if resolution fails.'index'entry replaced with'Overview';supersplat,splat-transform,securitywere missing from the order list and now matchsidebars.js.npm run preview-llms [outDir]generates both files in ~2 seconds without a full Docusaurus build, for fast iteration on the curated content.The hand-written header lives in
utils/plugins/llms/llms-header.md(placeholder-substituted at build time), so content edits don't touch plugin code.llms-full.txtgeneration logic is unchanged.Verification
llms-full.txtURL set differs from baseline by exactly the 147 tutorial docs — zero User Manual docs lost, zero additions.llms.txt: 452 docs + 42 curated entries, all in- [Title](url): descriptionformat; zero old-format lines; zero unresolved{{placeholders}};Engine Version: 2.19.6present; balanced code fences; Optional partition verified.npm run lintpasses (1248 files, 0 errors).Follow-ups (separate PRs)
.mdnext to each built HTML page and link those from llms.txt (link construction is isolated informatDocEntryfor this).🤖 Generated with Claude Code