@zweer/llms-txt
v0.2.1
Published
A CLI tool to generate llms.txt and llms-full.txt files from a VitePress docs directory
Maintainers
Readme
@zweer/llms-txt
A CLI tool to generate llms.txt and llms-full.txt files from a docs directory (e.g., VitePress).
Follows the llms.txt specification to make your documentation AI-friendly.
Installation
npm install -g @zweer/llms-txtUsage
CLI
# Generate from a VitePress docs directory
llms-txt \
--project-name "My Project" \
--project-description "A cool project" \
--site-url "https://example.com"
# Custom directories
llms-txt \
--project-name "My Project" \
--project-description "A cool project" \
--site-url "https://example.com" \
--docs-dir ./documentation \
--out-dir ./documentation/publicOptions
| Option | Default | Description |
| :--- | :--- | :--- |
| --project-name <NAME> | required | Project name for the header |
| --project-description <DESC> | required | Project description |
| --site-url <URL> | required | Base URL of the site |
| --docs-dir <PATH> | ./docs | Path to the docs directory |
| --out-dir <PATH> | ./docs/public | Output directory |
Programmatic API
import { generateLlmsFullTxt, generateLlmsTxt, scanPages } from '@zweer/llms-txt'
const sections = scanPages('./docs')
const llmsTxt = generateLlmsTxt({
projectName: 'My Project',
projectDescription: 'A cool project',
siteUrl: 'https://example.com',
sections,
})
const llmsFullTxt = generateLlmsFullTxt({
projectName: 'My Project',
projectDescription: 'A cool project',
siteUrl: 'https://example.com',
sections,
})How It Works
- Scans the docs directory recursively for
.mdfiles - Extracts
titleanddescriptionfrom YAML frontmatter (falls back to first# heading) - Groups pages by directory (each subdirectory becomes a section)
- Generates
llms.txtwith links and descriptions - Generates
llms-full.txtwith the full content of all pages
License
MIT
