Generate static artifacts
Generate static artifacts
Use this path when your runtime needs files on disk — a CDN-only deploy, a static export, a separate agent-only service, or multiple sibling apps sharing one corpus. The leadtype generate CLI walks your MDX source and writes a complete set of files into public/.
For app runtimes that compile MDX through a bundler (Next, Astro, Vite, Fumadocs), prefer the source primitive — it skips the disk round-trip.
The flow
Fetch the source repo
In CI, check out the docs source before the build. For a public repo, a shallow clone is enough:
For private repos, use your CI platform's checkout action or a read-only deploy key. The important part is that leadtype receives a normal filesystem path whose root contains docs/.
Lint before generate
Run lint against the fetched docs before writing generated output. Lint fails with file and line context, which is easier to debug than a later app build using stale artifacts:
Generate
Point --src at the fetched repo root and --out at the directory you'll serve:
That command writes:
public/llms.txtandpublic/llms-full.txtpublic/docs/*.mdpublic/docs/search-index.jsonandpublic/docs/search-content.jsonpublic/docs/sitemap.xml,sitemap.md,robots.txt, andagent-readability.json
Use --json in CI so automation can record resolved groups, output files, filters, and search index stats.
Multi-source mounting
Some projects keep docs and release notes side by side instead of putting everything under docs/:
Repeat --docs-dir to include those folders in the same generated corpus:
By default, extra sources are mounted under /docs/<folder>, so changelog/v1.mdx becomes public/docs/changelog/v1.md and /docs/changelog/v1.md.
Use <dir>=<url-prefix> when the folder should keep its own public route:
That still keeps an internal generated copy at public/docs/changelog/v1.md for search and runtime helpers, but it also writes public/changelog/v1.md and emits canonical links such as /changelog/v1 and /changelog/v1.md in llms.txt, search metadata, sitemap entries, and agent-readability.json.
Wire it into the build
Make checkout, lint, and generation run before the framework build:
If the docs source and docs app live in the same repo, skip docs:fetch and point --src at .:
Use library APIs for custom pipelines
The CLI is the happy path. Use the library APIs directly when you need custom plugin order, filters, or generated JSON paths. Keep conversion first — LLM files, search, and Agent Readability artifacts read the generated markdown:
Verify
After a clean build, inspect these files:
public/docs/index.md— converted markdown for the source repo home pagepublic/llms.txt— hosted routing index with page-level markdown linkspublic/llms-full.txt— all generated markdown docs in one fallback filepublic/docs/search-index.jsonandpublic/docs/search-content.json— non-empty search filespublic/docs/agent-readability.json— manifest for markdown responses, JSON-LD, sitemap, and robots helpers