Commands
DocsLit provides CLI commands for creating, writing, checking, building and deploying documentation sites, and for connecting AI tools to them. Commands that AI agents use print JSON on request. See Machine-readable CLI.
Usage
Without a global install, run any command through npx, for example npx docslit build.
build, dev, validate, lint and mcp also run in a folder that has only a docs/ directory and no docslit.json. Commands that write config, such as new and theme use, need a real docslit.json. See Project structure.
Global options
docslit --help lists every command with all of its options. docslit <command> --help (or docslit help <command>) shows one command. A mistyped command suggests the nearest real one.init
Scaffold a new documentation project with starter pages and configuration.
Creates a project directory with docslit.json (including a $schema key for editor completion), three starter pages in docs/, and an AGENTS.md with instructions for AI coding tools.
AGENTS.md.default, peppermint, frond, tonal, folio, ledger) or a palette. See Themes.new
Create a new Markdown page and add it to the sidebar. It never prompts. Run it from the project root.
sidebar_position into the frontmatter. For an explicit sidebar group it also inserts the page at that 1-based position in the group. A position past the end appends it.{ id, file, sidebarUpdated, group } as JSON. Errors print { "error": "..." }.dev
Start a development server with hot reload.
The server watches docs/, components/, docslit.json, your brand theme file and any code file you import with file=. The browser reloads automatically when a file is saved. New, renamed and removed pages update an autogenerated sidebar.
themePicker in docslit.json. See Themes.build
Generate a static site for deployment.
Produces HTML pages, a search index, a sitemap and the AI discovery files (llms.txt, .md pages, sitemap.md, changes.md, skill.md, agent.json, mcp-server.js). See How agents read your site. Open Graph images are off by default. Enable them with --og-images. With --pdf, it also generates chapter, page and full documentation PDFs. See Chapter PDF export.
functions/_middleware.js into your project root on every build. Now the build writes only into the output folder. It refreshes an existing functions/_middleware.js that carries the "generated by DocsLit" marker. To install it on Cloudflare Pages, run docslit deploy --cloudflare after a build.file:// URLs."build": { "cache": true }. See Faster builds."ogImage": true or "build": { "ogImages": true }. A page can opt out with ogImage: false in its frontmatter.docslit.json.search-index.json. This also disables site search and the MCP search tool.llms.txt and llms-full.txt..well-known/agent.json.sitemap.xml and robots.txt.npm install -D playwright and npx playwright install chromium). DocsLit finds Playwright in your project even when you run it with npx.pdf.enabled is true in docslit.json.--out. Overrides pdf.outputDir in config.Faster builds
Open Graph images are the slowest and largest generator, so they are off unless you ask for them. Pages keep their og:title and og:description tags either way. Skip other generators with --no-search-index, --no-llms-txt, --no-mcp and --no-sitemap, and set the same switches persistently in the build object in docslit.json. See Project structure.
--incremental reuses parsed and rendered pages, minified assets and OG images, and writes only files that changed. It removes stale generated pages, OG images, redirects and tracked generator outputs only when you have not modified them. Modified or untracked files are kept, and stale output from older DocsLit versions can remain, so run a clean build when you need guaranteed clean output. Use --profile to see where the time goes.
check
Run checks against a built site. The available check is a11y.
Runs axe-core in Chromium on every page, in light and dark themes. It needs npm install -D playwright axe-core and npx playwright install chromium in your project, and a built site. See Accessibility checks.
wcag2a, wcag2aa, wcag21aa or wcag22aa.light, dark or both.text, json or github.minor, moderate, serious or critical. Exits with code 1 when a violation is at or above this impact.cache
Manage the build cache used by --incremental builds.
clean removes cached build results. It does not remove generated output.
deploy
Write hosting recipe files. It does not upload anything. Use docslit publish for DocsLit Cloud.
--gh-pages is an alias.wrangler.toml. It also copies <out>/functions/_middleware.js to functions/_middleware.js for Markdown negotiation on Cloudflare Pages. Run docslit build first.vercel.json (only when the project has none) and a project-root middleware.js that returns a page's Markdown when the Accept header prefers text/markdown. Re-running the command updates a middleware.js that DocsLit wrote and leaves any other middleware.js unchanged.publish, the Cloudflare assets directory, the middleware lookup and the Vercel outputDirectory. Use the same value you pass to docslit build --out.For GitHub project pages, set "basePath": "/your-repo" in docslit.json first. See Site chrome and Static hosting.
validate
Check your project for errors and warnings.
See Validation for what gets checked.
http(s) links.pretty, github (Actions annotations) or json (one JSON document on stdout). With json and github, stdout carries only the report. Any other value is an error.lint
Check documentation quality: descriptions, headings, code languages, alt text, link text and page length.
See Lint for the rules and how to configure them.
pretty, json or github.components
List the built-in wc-* components, or show one component's attributes, nesting and example.
schema
Print a JSON Schema.
config is the default and describes docslit.json. Any other kind exits with code 1.
agents
Set up AI coding tools for your project. See Agent setup.
claude, cursor, copilot, windsurf, codex and gemini, or all. Default: AGENTS.md plus the tools detected in the project.docslit agents print [author|migrate|agents-md] prints the author skill (default), the migrate skill, or the AGENTS.md block to stdout without writing files.
mcp
Run a Model Context Protocol server over stdio. See MCP server.
claude, cursor or vscode) and a site URL.import
Migrate a Mintlify, Fern, GitBook or MkDocs project.
Detects the source platform from docs.json or mint.json (Mintlify), fern/docs.yml (Fern), SUMMARY.md (GitBook) or mkdocs.yml (MkDocs, Material, Zensical). Any other Markdown or MDX folder is imported with an automatic sidebar. The command converts pages, components, code blocks, links, assets and config, validates the result and writes MIGRATION.md with everything that needs a human. See Migration and the import reference.
{source-dir}-docslit. It is never the source folder, and it is refused when it is not empty unless you pass --force.mintlify, fern, gitbook or mkdocs.peppermint for Mintlify, frond for Fern and folio for GitBook.tabs converts each version of a versioned site into a tab. latest converts only the default version.theme
Pick a prebuilt look, and inspect the design tokens.
* marks your project's current choice. --json prints { themes, palettes, radius, appearance, current, config }.docslit.json, keeping your other settings, brand colors, fonts and file formatting. The palette resets to the theme's signature palette unless you pass --palette <name>. Pass a palette id instead of a theme to change only the palette. An unknown name exits with code 1 and suggests the nearest one.--json prints it for agents, and --theme <id> shows the values for that theme instead of the project's. See Design tokens.brand-theme.json by default, creating its folder if needed, and reference it from docslit.json when no theme is set. It then lists every theme and palette, and edits docslit.json without reformatting it.See Themes and Palettes and brand colors.
openapi scaffold
Generate API reference pages from an OpenAPI 3.x specification.
Creates a Markdown page per endpoint in docs/api/, an introduction.md from the spec's info block, and updates docslit.json with the OpenAPI config and sidebar structure.
See OpenAPI integration.
api python
Set up a Python API reference from a package's docstrings.
Runs Griffe (griffe, uvx griffe or python -m griffe) to write api/python/<package>.json, adds the package to python.packages in docslit.json, and optionally scaffolds the pages. Python is only needed for this command, never for docslit build. Run it again to refresh the data.
google, numpy or sphinx. Saved as python.docstringStyle.src if it exists, otherwise the project root.docs/api/<package>/ with one ::: module page per public module plus an index, and an "API reference" sidebar group. Existing pages are never overwritten.See Python API reference.
Cloud commands
These commands talk to DocsLit Cloud. They read your API token from the DOCSLIT_TOKEN environment variable. DocsLit Cloud is in early access: request access to get a token.
--project <slug>, --out <dir> and --build.--yes.--yes.See DocsLit Cloud for details.