Skip to content

inthhq/leadtype

Repository files navigation

leadtype

A docs pipeline. Write MDX once. Get a website for humans, an llms.txt for HTTP agents, an AGENTS.md-fronted bundle for offline coding agents, and a static search index — all from a single source.

flowchart LR
  src["docs/*.mdx"]
  site_run["leadtype generate"]
  bundle_run["leadtype generate --bundle"]
  site_out["public/<br/>llms.txt · llms-full.txt<br/>docs/*.md · search-index.json"]
  bundle_out["packages/&lt;name&gt;/<br/>AGENTS.md · docs/*.md"]
  humans["humans (browser)"]
  http_agents["HTTP agents<br/>(/llms.txt or<br/>Accept: text/markdown)"]
  search["search UI · AI answers"]
  offline_agents["coding agents<br/>(Claude Code, Codex, Cursor,<br/>Copilot…) read<br/>node_modules/&lt;pkg&gt;/AGENTS.md"]
  src --> site_run
  src --> bundle_run
  site_run --> site_out
  bundle_run --> bundle_out
  site_out --> humans
  site_out --> http_agents
  site_out --> search
  bundle_out --> offline_agents
Loading

leadtype is not a docs website framework. Bring your own UI — Next.js, TanStack Start, Astro, Nuxt, SvelteKit, Vue, Svelte, anything — and let leadtype handle conversion, validation, search, and the agent-facing outputs it specializes in. It's designed to layer behind a framework like Fumadocs or Starlight, not replace it.

Choose your path

  • Build a docs site — wire leadtype into your build to convert MDX, index search, and serve markdown to agents.
  • Bundle docs into your package — ship AGENTS.md plus topic markdown inside the npm tarball so consumers can point agents at version-matched docs in node_modules/<your-package>/. Agents that install your package then spend 32–54% fewer tokens and stop confidently guessing wrong about your API — the win is biggest for the small, cheap models most agents run, with a smaller accuracy bump for frontier models (evals).

Install

# npm
npm install leadtype
# pnpm
pnpm add leadtype
# bun
bun add leadtype

30-second example

The fastest start in an existing app — scaffolds the docs source, route, config, and a first artifact set. The framework is auto-detected from package.json; pass --framework to be explicit:

npx leadtype init                    # auto-detect, or:
npx leadtype init --framework next   # next · astro · nuxt · sveltekit

Or wire the pipeline by hand. For a hosted docs site:

npx leadtype generate --src . --out public --base-url https://leadtype.dev

For an npm-bundled doc set:

npx leadtype generate --bundle --src . --out packages/acme

The first produces public/llms.txt, public/llms-full.txt, public/docs/search-index.json, and public/docs/*.md. The second produces packages/acme/AGENTS.md and packages/acme/docs/*.md with relative links that still work after npm install.

Bundling is two steps, and the second is the one that matters. Shipping AGENTS.md only pays off if consuming projects point their agent at it — left to discover it on their own, agents read the bundle only ~29% of the time; with a root-AGENTS.md pointer it's ~90–100% (evals). So tell consumers to add this to their own root AGENTS.md:

When working with the `acme` library, read the bundled docs in
`node_modules/acme/AGENTS.md` first — they're version-matched to the
installed package and stay accurate as it updates.

leadtype generate --bundle prints this snippet, filled in with your package name, on success.

Documentation

Full docs at leadtype.dev:

Repo layout

  • packages/leadtype/ — the npm package (CLI + library entry points).
  • apps/example/ — production docs site and reference template, on TanStack Start.
  • docs/ — the source MDX rendered by both this site and the package's bundled docs.

Local workflow

bun install
bun run dev          # build the package, run the pipeline, start the example app

Pipeline checks:

bun run --filter example pipeline:build
bun run --filter example pipeline:test
bun run --filter example test:e2e

License

MIT.

About

Unified docs pipeline for humans & agents.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors