Repository navigation
feat(docs): generate llms.txt from repository documentation - #1199
helpcodeai merged 20 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
helpcodeai
left a comment
There was a problem hiding this comment.
Thanks @Coding-Professional, this is close to what I had in mind, and the tests that check every code example in the real docs survive verbatim are a nice touch. A few things before I merge, two of them are gaps in my own issue text:
-
The main-module check in
scripts/generate-llms-txt.mjs:250comparesprocess.argv[1]with the real path of the module. If the script is called through a symlink, it does nothing and exits 0, so--checkpasses without checking anything. That's also why the CLI test fails on macOS, wheretmpdir()is under/var, a symlink to/private/var. Comparing withrealpathSync(process.argv[1])fixes both. -
My spec said
docs/operations/*.md, butcard-trial-offer.mdandsignup-attribution.mdare Cloud-only internals. Nobody using or self-hosting AnythingMCP needs them, so please leave those two out. -
docs/memory.mdlanded after I wrote the issue and isn't in either file. Could you add it to Reference, and add a test that everydocs/**/*.mdis either included or on an explicit exclude list (docs/AUTHORS.mdplus the two above)? That way the next new doc fails CI instead of quietly going missing. -
Adapter PRs change the count in
README.mdandpackage.json, so they will hit this check too. Please add the command to step 5 of "Add an adapter" in AGENTS.md and to the adapter section in CONTRIBUTING. I'd also move the general line out of the top of AGENTS.md and out of the AI section in CONTRIBUTING, to the test section and the PR process step about docs.
Smaller things, take them or leave them: a few descriptions in llms.txt aren't great ("Three pipelines.", "This is a living document.", the tool definition one ends with a colon), so they could go in the override map. There's a stray from the README at line 45 of llms-full.txt. And marking both files linguist-generated in .gitattributes would collapse the big diff in future PRs.
CI is green and the workflow change is exactly what I asked for, thanks for keeping it small.
|
Thanks for the review, @helpcodeai. All requested changes and the smaller cleanup suggestions are addressed in 138e17a, with regression tests added. CI is green and the PR description is updated. Ready for another look. |
helpcodeai
left a comment
There was a problem hiding this comment.
Thanks @Coding-Professional, all four points are fixed and the tests are good. I merged main into your branch and regenerated the files (517 → 529 adapters), so CI is green again on 5e4b2ed.
One last thing before I merge, and then it's done. The generator still follows symlinks for doc paths: a symlinked file in the fixed list (say docs/sso.md -> ../.env) or a symlinked folder like docs/integrations gets read and written into llms-full.txt. Only a symlinked file inside a scanned folder is skipped, and that's a side effect of Dirent.isFile(). CI's --check leaks nothing, but a maintainer running the generator locally after such a PR would commit their own file.
Could you reject symlinks explicitly? lstatSync(p).isSymbolicLink() for every fixed path and every scanned folder and file, plus a check that realpathSync(resolve(root, p)) starts with realpathSync(root) + sep. A test for a symlinked file and a symlinked folder would be great.
|
Thanks, @helpcodeai. Addressed in f757f73 with explicit symlink rejection, repository-boundary checks, and regression tests for files and folders. Synced with main and regenerated both files. CI is green. |
helpcodeai
left a comment
There was a problem hiding this comment.
Thanks @Coding-Professional, the symlink checks look right: every path part is checked with lstat, the real path must stay inside the repo, and the outputs are checked too. The tests cover files and folders. I merged main again and regenerated the two files so the check passes. Merging once CI is green.
Summary
Generate a repository documentation index and full-text bundle so AI clients can read AnythingMCP's product docs directly. CI checks freshness and coverage: every Markdown file under
docs/must be included or explicitly excluded. The generator rejects symlinked sources so local private files cannot be pulled into the bundle through documentation links.Changes
llms.txtandllms-full.txt, with stable ordering, LF output, short descriptions and--checkmode.docs/memory.mdunder Reference. Explicitly exclude contributor credits (docs/AUTHORS.md) and the Cloud-onlycard-trial-offer.md/signup-attribution.mdinternals. , and improve the tool-definition, observability and roadmap descriptions.linguist-generatedand link to them from the READMEs.The branch includes upstream main
af9a8291(v0.50.0), with generated references refreshed for the upstream response-size limit, Sentry upgrade and setup instructions. Generated counts cover 547 listed adapters. These are repository artifacts in both Cloud and self-hosted deployments; no application serving, Docker or enterprise code changes are included in the PR diff.Type
Testing
From the repository root on Windows, Node.js v24.17.0:
node scripts/generate-llms-txt.mjs: regenerated both files; repeated generation is checked for determinism by the test suite.node scripts/generate-llms-txt.mjs --check: passed.node --test scripts/validate-adapters.test.mjs scripts/adapter-new.test.mjs scripts/generate-llms-txt.test.mjs: 53 passed, 4 skipped. Windows file-symlink cases require privileges unavailable locally; directory-junction rejection and supported CLI invocation through a junction passed. The new directory-link regressions failed before the guard was added.node scripts/validate-adapters.mjs: 561 passed, 0 failed; 1,442 existing non-blocking warnings.node scripts/adapter-count.mjs --check: passed (547 listed adapters, 26 keyless, 8,397 tools).git diff --check: passed.npm test -w packages/backend -- --runInBand --testPathPatterns=adapters/catalog.spec.ts --silent: 10,279 passed on f757f73 before the latest main sync. The latest head's full backend CI also passed.CI for the sync commit f5fee956 passed on Ubuntu with Node 22: script tests (including all file/directory symlink cases), generated-output checks, full backend lint/typecheck/tests/build, CLI and frontend checks passed. Frontend e2e and CodeQL also passed. After syncing, re-ran the Windows script tests (53 passed, 4 privilege-related skips), adapter validation, quoted counts, generation/freshness and whitespace checks: passed. No native macOS run was performed locally.
Checklist
Related Issues
Fixes #1011.