Commands

CLI reference•5 min read|
|

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

docslit <command> [options]

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

Display help. 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. Print the DocsLit version number.

init

Scaffold a new documentation project with starter pages and configuration.

docslit init my-docs docslit init my-docs --no-agents docslit init my-docs --theme peppermint

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.

The directory name for the new project. Do not write AGENTS.md. Start with a theme (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.

docslit new getting-started/advanced --title "Advanced" --group "Getting started" docslit new guides/webhooks --description "How to verify webhooks." --json The page title. Default: derived from the page id. The sidebar group to add the page to. It is created when missing. Ignored for autogenerated sidebars. The frontmatter description. Default: empty. Writes 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. Print { id, file, sidebarUpdated, group } as JSON. Errors print { "error": "..." }.

dev

Start a development server with hot reload.

docslit dev docslit dev --port 4000 docslit dev --theme-picker

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.

The port number for the dev server. Turn off Mintlify compatibility mode. See Try DocsLit without converting. Show a floating Theme control to try every theme, palette and mode on your own content. It is for development only and is never written to a build. To ship it in a built site, set themePicker in docslit.json. See Themes.

build

Generate a static site for deployment.

docslit build docslit build --offline docslit build --out public docslit build --pdf docslit build --incremental --profile

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.

Earlier versions wrote 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. The output directory for the built site. Build a self-contained offline site with lazy-loaded pages. No server needed. It works from file:// URLs. Reuse unchanged pages and assets, and keep the existing output directory. Same as "build": { "cache": true }. See Faster builds. Generate an Open Graph image for every page. Off by default. Same as "ogImage": true or "build": { "ogImages": true }. A page can opt out with ogImage: false in its frontmatter. Skip Open Graph images even when they are enabled in docslit.json. Skip search-index.json. This also disables site search and the MCP search tool. Skip llms.txt and llms-full.txt. Skip the MCP server and .well-known/agent.json. Skip sitemap.xml and robots.txt. Print per-phase build timings. Print detailed per-page build logs. Skip CSS and JavaScript minification. Useful when inspecting the output. Generate chapter, page and full documentation PDFs. Requires Playwright (npm install -D playwright and npx playwright install chromium). DocsLit finds Playwright in your project even when you run it with npx. Skip PDF generation even when pdf.enabled is true in docslit.json. PDF output directory inside --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.

docslit build docslit check a11y docslit check a11y --level wcag21aa --format github

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.

The built site directory to check. wcag2a, wcag2aa, wcag21aa or wcag22aa. light, dark or both. Comma-separated page ids to check. Check at most this many pages. 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.

docslit cache clean

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.

docslit deploy --github-pages docslit deploy --netlify docslit deploy --cloudflare docslit deploy --vercel docslit deploy --cloudflare --out public Write a GitHub Pages workflow. --gh-pages is an alias. Write a Netlify config. Write wrangler.toml. It also copies <out>/functions/_middleware.js to functions/_middleware.js for Markdown negotiation on Cloudflare Pages. Run docslit build first. Write 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. The build output folder the recipes point at: the GitHub Pages artifact path, Netlify 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.

docslit validate docslit validate --strict docslit validate --format json docslit validate --external --format github

See Validation for what gets checked.

Treat warnings as errors. Exits with code 1 if any warnings are found. Also check external 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.

docslit lint docslit lint --format json docslit lint --strict

See Lint for the rules and how to configure them.

pretty, json or github. Exit with code 1 on warnings as well as errors.

components

List the built-in wc-* components, or show one component's attributes, nesting and example.

docslit components docslit components wc-tabs docslit components wc-tabs --json Print the manifest, or one entry, as JSON. An unknown tag exits with code 1.

schema

Print a JSON Schema.

docslit schema docslit schema frontmatter

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.

docslit agents init docslit agents init --tool claude,cursor docslit agents print migrate A comma-separated list of claude, cursor, copilot, windsurf, codex and gemini, or all. Default: AGENTS.md plus the tools detected in the project. Overwrite generated files you edited and replace a customized MCP entry. Print the result as JSON.

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.

docslit mcp docslit mcp --dir ../my-docs docslit mcp https://docs.docslit.com docslit mcp --print-config claude https://docs.docslit.com Authoring mode: the project directory. Reader mode: the root URL of a published DocsLit site. Print a ready-to-paste client config and exit. Optionally name a client (claude, cursor or vscode) and a site URL.

import

Migrate a Mintlify, Fern, GitBook or MkDocs project.

docslit import ./my-mintlify-docs docslit import ./my-fern-docs --out converted --theme frond docslit import ./my-gitbook --dry-run docslit import ./site --from fern --json

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.

The output directory. Default: {source-dir}-docslit. It is never the source folder, and it is refused when it is not empty unless you pass --force. Skip detection: mintlify, fern, gitbook or mkdocs. Convert and report everything without writing any files. The built-in theme or palette to apply, plus the source brand colors. Default: peppermint for Mintlify, frond for Fern and folio for GitBook. Do not select a built-in theme. Brand colors are still applied. tabs converts each version of a versioned site into a tab. latest converts only the default version. Overwrite a non-empty output directory. Print the migration report as JSON.

theme

Pick a prebuilt look, and inspect the design tokens.

docslit theme list docslit theme list --json docslit theme use peppermint docslit theme use tonal --palette ocean docslit theme tokens --theme folio docslit theme init acme-theme.json Print the themes with their signature palettes, the palettes and the custom color variables. A * marks your project's current choice. --json prints { themes, palettes, radius, appearance, current, config }. Set the theme in 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. Print the design-token reference with defaults and current values. --json prints it for agents, and --theme <id> shows the values for that theme instead of the project's. See Design tokens. Scaffold a brand theme file, 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.

docslit openapi scaffold api-spec.yaml docslit openapi scaffold api-spec.yaml --overlay overlay.yaml docslit openapi scaffold api-spec.yaml --new-only

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.

Path to an OpenAPI overlay file to apply on top of the spec. Only create pages for operations that are not documented yet.

See OpenAPI integration.

api python

Set up a Python API reference from a package's docstrings.

docslit api python mypkg docslit api python mypkg --docstyle numpy --search src --pages docslit api python mypkg --from griffe.json --json

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.

Docstring style: google, numpy or sphinx. Saved as python.docstringStyle. Directory Griffe searches for the package. Repeatable. Defaults to src if it exists, otherwise the project root. Copy an existing Griffe dump instead of running Griffe. Create docs/api/<package>/ with one ::: module page per public module plus an index, and an "API reference" sidebar group. Existing pages are never overwritten. Print the result as JSON: package, JSON path, modules, and pages written and skipped.

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.

Build if needed and publish. Options: --project <slug>, --out <dir> and --build. List your published projects with URLs and status. Show the authenticated user. Restore a project to an earlier deploy. Option: --yes. Delete a published project and all its files. Option: --yes.

See DocsLit Cloud for details.