Commands

CLI reference5 min read|
|

DocsLit provides a set of CLI commands for creating, developing, building, and deploying documentation sites.

Usage

docslit <command> [options]

Or if installed globally:

docslit <command> [options]

Global options

Display help information for any command. Print the DocsLit version number.

init

Scaffold a new documentation project with starter pages and configuration.

docslit init my-docs

Creates a project directory with docslit.json, three starter pages in docs/, and a components/ directory.

The directory name for the new project.

dev

Start a development server with hot reload.

docslit dev docslit dev --port 4000

The server watches docs/, components/, docslit.json, and your brand theme file (if configured) for changes. The browser reloads automatically via WebSocket when any file is saved.

The port number for the dev server.

build

Generate a static site for deployment.

docslit build docslit build --offline docslit build --out public docslit build --pdf

Produces HTML pages, search index, sitemap, and AI discovery files in the output directory. With --pdf, also generates chapter, page, and full documentation PDFs in dist/pdf/. See Chapter PDF export.

The output directory for the built site. Build a self-contained offline site with lazy-loaded pages. No server needed — works from `file://` URLs. Generate chapter, page, and full documentation PDFs. Requires Playwright (`npm install -D playwright` and `npx playwright install chromium`). Skip PDF generation even when `pdf.enabled` is `true` in `docslit.json`. PDF output directory inside `--out`. Overrides `pdf.outputDir` in config.

new

Create a new Markdown page and optionally append it to the sidebar.

docslit new getting-started/advanced --title "Advanced" --group "Getting started"

deploy

Write hosting recipe files (does not upload). Keep docslit publish for DocsLit Cloud.

docslit deploy --github-pages docslit deploy --netlify docslit deploy --cloudflare

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 --external --format github

See validation for details on what gets checked.

Treat warnings as errors. Exits with code 1 if any warnings are found. Also check external `http(s)` links (HEAD, then GET fallback). Output format: `pretty` or `github` (GitHub Actions annotations).

import

Migrate documentation from another platform.

docslit import ./my-mintlify-docs docslit import ./my-fern-docs --out converted docslit import ./my-gitbook --dry-run

Automatically detects the source platform (Mintlify, Fern, GitBook, or generic Markdown).

Custom output directory. Defaults to `{source-dir}-docslit`. Scan and report without writing any files.

theme

Manage color presets and corporate brand themes.

docslit theme init docslit theme init themes/acme.json docslit theme list

theme init scaffolds a brand-theme.json file with starter brand colors and fonts, and wires it into docslit.json when no theme is set. theme list prints built-in presets and overridable theme variables.

See Theming for the full guide.

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. Tags and x-tagGroups in the spec are used to build sidebar hierarchy with method badges.

Path to an OpenAPI overlay file to apply on top of the spec. Only create pages for operations not already documented. Scans existing files for `wc-endpoint ref` tags.

See OpenAPI integration for the full guide.

Cloud commands

These commands require authentication. Run docslit login first.

Authenticate with DocsLit Cloud via browser OAuth. Build and deploy your site to DocsLit Cloud. List all published documentation projects. Display the authenticated user. Restore the previous deployment for a project. Remove a project from DocsLit Cloud.

See DocsLit Cloud for details.