---
title: Commands
description: Complete reference for every DocsLit CLI command and flag, including init, new, dev, build, validate, lint, components, schema, agents, mcp, import and the cloud commands.
tag: CLI reference
readtime: 5 min read
---
> For AI agents: the complete documentation index is at [llms.txt](https://docs.docslit.com/0.3/llms.txt). This page as Markdown: [cli-reference/commands.md](https://docs.docslit.com/0.3/cli-reference/commands.md).


# 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](../ai-and-agents/machine-readable-cli).

## Usage

```bash
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](../getting-started/project-structure#projects-without-a-config-file).

## Global options

<wc-fields header="Global options">
<wc-field name="--help, -h" type="flag">
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.
</wc-field>
<wc-field name="--version, -v" type="flag">
Print the DocsLit version number.
</wc-field>
</wc-fields>

## init

Scaffold a new documentation project with starter pages and configuration.

<wc-endpoint method="GET" url="docslit init [directory]"></wc-endpoint>

```bash
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.

<wc-fields header="Arguments and options">
<wc-field name="directory" type="string" default="my-docs">
The directory name for the new project.
</wc-field>
<wc-field name="--no-agents" type="flag">
Do not write `AGENTS.md`.
</wc-field>
<wc-field name="--theme" type="string">
Start with a theme (`default`, `peppermint`, `frond`, `tonal`, `folio`, `ledger`) or a palette. See [Themes](../customization/theming).
</wc-field>
</wc-fields>

## new

Create a new Markdown page and add it to the sidebar. It never prompts. Run it from the project root.

<wc-endpoint method="GET" url="docslit new <page-id>"></wc-endpoint>

```bash
docslit new getting-started/advanced --title "Advanced" --group "Getting started"
docslit new guides/webhooks --description "How to verify webhooks." --json
```

<wc-fields header="Options">
<wc-field name="--title" type="string">
The page title. Default: derived from the page id.
</wc-field>
<wc-field name="--group" type="string" default="Pages">
The sidebar group to add the page to. It is created when missing. Ignored for autogenerated sidebars.
</wc-field>
<wc-field name="--description" type="string">
The frontmatter description. Default: empty.
</wc-field>
<wc-field name="--position" type="number">
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.
</wc-field>
<wc-field name="--json" type="flag">
Print `{ id, file, sidebarUpdated, group }` as JSON. Errors print `{ "error": "..." }`.
</wc-field>
</wc-fields>

## dev

Start a development server with hot reload.

<wc-endpoint method="GET" url="docslit dev"></wc-endpoint>

```bash
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.

<wc-fields header="Options">
<wc-field name="--port" type="number" default="3000">
The port number for the dev server.
</wc-field>
<wc-field name="--no-compat" type="flag">
Turn off Mintlify compatibility mode. See [Try DocsLit without converting](../migration/from-mintlify#try-docslit-without-converting).
</wc-field>
<wc-field name="--theme-picker" type="flag">
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](../customization/theming#try-themes-live).
</wc-field>
</wc-fields>

## build

Generate a static site for deployment.

<wc-endpoint method="GET" url="docslit build"></wc-endpoint>

```bash
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](../ai-and-agents/reading-agents). 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](../deployment/chapter-pdf-export).

<wc-callout type="warning" title="Builds no longer write functions/ into your project">
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.
</wc-callout>

<wc-fields header="Options">
<wc-field name="--out" type="string" default="dist">
The output directory for the built site.
</wc-field>
<wc-field name="--offline" type="flag">
Build a self-contained offline site with lazy-loaded pages. No server needed. It works from `file://` URLs.
</wc-field>
<wc-field name="--incremental" type="flag">
Reuse unchanged pages and assets, and keep the existing output directory. Same as `"build": { "cache": true }`. See [Faster builds](#faster-builds).
</wc-field>
<wc-field name="--og-images" type="flag">
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.
</wc-field>
<wc-field name="--no-og-images" type="flag">
Skip Open Graph images even when they are enabled in `docslit.json`.
</wc-field>
<wc-field name="--no-search-index" type="flag">
Skip `search-index.json`. This also disables site search and the MCP search tool.
</wc-field>
<wc-field name="--no-llms-txt" type="flag">
Skip `llms.txt` and `llms-full.txt`.
</wc-field>
<wc-field name="--no-mcp" type="flag">
Skip the MCP server and `.well-known/agent.json`.
</wc-field>
<wc-field name="--no-sitemap" type="flag">
Skip `sitemap.xml` and `robots.txt`.
</wc-field>
<wc-field name="--profile" type="flag">
Print per-phase build timings.
</wc-field>
<wc-field name="--verbose" type="flag">
Print detailed per-page build logs.
</wc-field>
<wc-field name="--no-minify" type="flag">
Skip CSS and JavaScript minification. Useful when inspecting the output.
</wc-field>
<wc-field name="--pdf" type="flag">
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`.
</wc-field>
<wc-field name="--no-pdf" type="flag">
Skip PDF generation even when `pdf.enabled` is `true` in `docslit.json`.
</wc-field>
<wc-field name="--pdf-dir" type="string" default="pdf">
PDF output directory inside `--out`. Overrides `pdf.outputDir` in config.
</wc-field>
</wc-fields>

### 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](../getting-started/project-structure#configuration-file).

`--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`.

<wc-endpoint method="GET" url="docslit check a11y"></wc-endpoint>

```bash
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](accessibility).

<wc-fields header="Options">
<wc-field name="--out" type="string" default="dist">
The built site directory to check.
</wc-field>
<wc-field name="--level" type="string" default="wcag2aa">
`wcag2a`, `wcag2aa`, `wcag21aa` or `wcag22aa`.
</wc-field>
<wc-field name="--theme" type="string" default="both">
`light`, `dark` or `both`.
</wc-field>
<wc-field name="--pages" type="string">
Comma-separated page ids to check.
</wc-field>
<wc-field name="--max" type="number">
Check at most this many pages.
</wc-field>
<wc-field name="--format" type="string" default="text">
`text`, `json` or `github`.
</wc-field>
<wc-field name="--fail-on" type="string" default="serious">
`minor`, `moderate`, `serious` or `critical`. Exits with code 1 when a violation is at or above this impact.
</wc-field>
</wc-fields>

## cache

Manage the build cache used by `--incremental` builds.

<wc-endpoint method="GET" url="docslit cache clean"></wc-endpoint>

```bash
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.

```bash
docslit deploy --github-pages
docslit deploy --netlify
docslit deploy --cloudflare
docslit deploy --vercel
docslit deploy --cloudflare --out public
```

<wc-fields header="Options">
<wc-field name="--github-pages" type="flag">
Write a GitHub Pages workflow. `--gh-pages` is an alias.
</wc-field>
<wc-field name="--netlify" type="flag">
Write a Netlify config.
</wc-field>
<wc-field name="--cloudflare" type="flag">
Write `wrangler.toml`. It also copies `<out>/functions/_middleware.js` to `functions/_middleware.js` for Markdown negotiation on Cloudflare Pages. Run `docslit build` first.
</wc-field>
<wc-field name="--vercel" type="flag">
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.
</wc-field>
<wc-field name="--out" type="string" default="dist">
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`.
</wc-field>
</wc-fields>

For GitHub project pages, set `"basePath": "/your-repo"` in `docslit.json` first. See [Site chrome](../customization/site-chrome) and [Static hosting](../deployment/static-hosting).

## validate

Check your project for errors and warnings.

<wc-endpoint method="GET" url="docslit validate [directory]"></wc-endpoint>

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

See [Validation](validation) for what gets checked.

<wc-fields header="Options">
<wc-field name="--strict" type="flag">
Treat warnings as errors. Exits with code 1 if any warnings are found.
</wc-field>
<wc-field name="--external" type="flag">
Also check external `http(s)` links.
</wc-field>
<wc-field name="--format" type="string" default="pretty">
`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.
</wc-field>
</wc-fields>

## lint

Check documentation quality: descriptions, headings, code languages, alt text, link text and page length.

<wc-endpoint method="GET" url="docslit lint [directory]"></wc-endpoint>

```bash
docslit lint
docslit lint --format json
docslit lint --strict
```

See [Lint](lint) for the rules and how to configure them.

<wc-fields header="Options">
<wc-field name="--format" type="string" default="pretty">
`pretty`, `json` or `github`.
</wc-field>
<wc-field name="--strict" type="flag">
Exit with code 1 on warnings as well as errors.
</wc-field>
</wc-fields>

## components

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

<wc-endpoint method="GET" url="docslit components [tag]"></wc-endpoint>

```bash
docslit components
docslit components wc-tabs
docslit components wc-tabs --json
```

<wc-fields header="Options">
<wc-field name="--json" type="flag">
Print the manifest, or one entry, as JSON. An unknown tag exits with code 1.
</wc-field>
</wc-fields>

## schema

Print a JSON Schema.

<wc-endpoint method="GET" url="docslit schema [config|frontmatter]"></wc-endpoint>

```bash
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](../ai-and-agents/agent-setup).

<wc-endpoint method="GET" url="docslit agents init [directory]"></wc-endpoint>

```bash
docslit agents init
docslit agents init --tool claude,cursor
docslit agents print migrate
```

<wc-fields header="agents init options">
<wc-field name="--tool" type="string">
A comma-separated list of `claude`, `cursor`, `copilot`, `windsurf`, `codex` and `gemini`, or `all`. Default: `AGENTS.md` plus the tools detected in the project.
</wc-field>
<wc-field name="--force" type="flag">
Overwrite generated files you edited and replace a customized MCP entry.
</wc-field>
<wc-field name="--json" type="flag">
Print the result as JSON.
</wc-field>
</wc-fields>

`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](../ai-and-agents/mcp-server).

<wc-endpoint method="GET" url="docslit mcp [url]"></wc-endpoint>

```bash
docslit mcp
docslit mcp --dir ../my-docs
docslit mcp https://docs.docslit.com
docslit mcp --print-config claude https://docs.docslit.com
```

<wc-fields header="Options">
<wc-field name="--dir" type="string" default=".">
Authoring mode: the project directory.
</wc-field>
<wc-field name="url" type="string">
Reader mode: the root URL of a published DocsLit site.
</wc-field>
<wc-field name="--print-config" type="string">
Print a ready-to-paste client config and exit. Optionally name a client (`claude`, `cursor` or `vscode`) and a site URL.
</wc-field>
</wc-fields>

## import

Migrate a Mintlify, Fern, GitBook or MkDocs project.

<wc-endpoint method="GET" url="docslit import <source-dir>"></wc-endpoint>

```bash
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](../migration/from-mintlify) and the [import reference](../migration/import-reference).

<wc-fields header="Options">
<wc-field name="--out" type="string">
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`.
</wc-field>
<wc-field name="--from" type="string">
Skip detection: `mintlify`, `fern`, `gitbook` or `mkdocs`.
</wc-field>
<wc-field name="--dry-run" type="flag">
Convert and report everything without writing any files.
</wc-field>
<wc-field name="--theme" type="string">
The built-in theme or palette to apply, plus the source brand colors. Default: `peppermint` for Mintlify, `frond` for Fern and `folio` for GitBook.
</wc-field>
<wc-field name="--no-theme" type="flag">
Do not select a built-in theme. Brand colors are still applied.
</wc-field>
<wc-field name="--versions" type="string" default="tabs">
`tabs` converts each version of a versioned site into a tab. `latest` converts only the default version.
</wc-field>
<wc-field name="--force" type="flag">
Overwrite a non-empty output directory.
</wc-field>
<wc-field name="--json" type="flag">
Print the migration report as JSON.
</wc-field>
</wc-fields>

## theme

Pick a prebuilt look, and inspect the design tokens.

<wc-endpoint method="GET" url="docslit theme list"></wc-endpoint>

```bash
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
```

<wc-fields header="Subcommands">
<wc-field name="theme list" type="command">
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 }`.
</wc-field>
<wc-field name="theme use <theme>" type="command">
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.
</wc-field>
<wc-field name="theme tokens" type="command">
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](../customization/design-tokens).
</wc-field>
<wc-field name="theme init [file]" type="command">
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.
</wc-field>
</wc-fields>

See [Themes](../customization/theming) and [Palettes and brand colors](../customization/palettes-and-brand).

## openapi scaffold

Generate API reference pages from an OpenAPI 3.x specification.

<wc-endpoint method="GET" url="docslit openapi scaffold <spec.yaml>"></wc-endpoint>

```bash
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.

<wc-fields header="Options">
<wc-field name="--overlay" type="string">
Path to an OpenAPI overlay file to apply on top of the spec.
</wc-field>
<wc-field name="--new-only" type="flag">
Only create pages for operations that are not documented yet.
</wc-field>
</wc-fields>

See [OpenAPI integration](../integrations/openapi).

## api python

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

<wc-endpoint method="GET" url="docslit api python <package>"></wc-endpoint>

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

Runs [Griffe](https://mkdocstrings.github.io/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.

<wc-fields header="Options">
<wc-field name="--docstyle" type="string" default="google">
Docstring style: `google`, `numpy` or `sphinx`. Saved as `python.docstringStyle`.
</wc-field>
<wc-field name="--search" type="string">
Directory Griffe searches for the package. Repeatable. Defaults to `src` if it exists, otherwise the project root.
</wc-field>
<wc-field name="--from" type="string">
Copy an existing Griffe dump instead of running Griffe.
</wc-field>
<wc-field name="--pages" type="flag">
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.
</wc-field>
<wc-field name="--json" type="flag">
Print the result as JSON: package, JSON path, modules, and pages written and skipped.
</wc-field>
</wc-fields>

See [Python API reference](../integrations/python-api).

## 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](https://docslit.com/pricing/#request) to get a token.

<wc-fields header="Cloud commands">
<wc-field name="publish" type="command">
Build if needed and publish. Options: `--project <slug>`, `--out <dir>` and `--build`.
</wc-field>
<wc-field name="projects" type="command">
List your published projects with URLs and status.
</wc-field>
<wc-field name="whoami" type="command">
Show the authenticated user.
</wc-field>
<wc-field name="rollback &lt;slug&gt; [deploy-id]" type="command">
Restore a project to an earlier deploy. Option: `--yes`.
</wc-field>
<wc-field name="delete &lt;slug&gt;" type="command">
Delete a published project and all its files. Option: `--yes`.
</wc-field>
</wc-fields>

See [DocsLit Cloud](../deployment/docslit-cloud) for details.
