CLI Commands
The Lito CLI provides powerful commands to develop, build, and manage your documentation site. All commands support detailed options for customization.
If you have Lito installed globally, use lito <command>. Otherwise, use npx @litodocs/cli <command>.
init
Initialize a new documentation project with interactive prompts or options.
# Interactive modelito init
# With optionslito init --output ./my-docs --name "My Project" --template defaultOptions
| Option | Alias | Type | Description | Default |
|---|---|---|---|---|
--output | -o | <path> | Output directory for the project | (interactive) |
--name | -n | <name> | Project name | (interactive) |
--template | -t | <name> | Template to use | default |
--sample | — | flag | Create sample documentation pages | true |
Example
lito init -o ./docs -n "My API Docs" -t defaultThis creates:
docs-config.jsonwith your project settings- Sample
introduction.mdxandquickstart.mdxpages _assets/and_images/folders for static files
build
Builds your documentation site for production deployment.
# With global installationlito build --input ./my-docs --output ./dist [options]
# With npxnpx @litodocs/cli build --input ./my-docs --output ./dist [options]Options
| Option | Alias | Type | Description | Default |
|---|---|---|---|---|
--input | -i | <path> | Required. Path to your docs folder | — |
--output | -o | <path> | Output directory for the built site | ./dist |
--template | -t | <name> | Template to use: default, github:owner/repo, or local path | default |
--base-url | -b | <url> | Base URL for the site (useful for subpath deployments) | / |
--provider | — | <name> | Hosting optimization: vercel, netlify, cloudflare, static | static |
--rendering | — | <mode> | Rendering mode: static, server, hybrid | static |
--name | — | <name> | Set project name | — |
--description | — | <text> | Set project description | — |
--primary-color | — | <hex> | Set primary theme color (hex format) | — |
--accent-color | — | <hex> | Set accent theme color (hex format) | — |
--favicon | — | <path> | Set favicon path | — |
--logo | — | <path> | Set logo path | — |
--search | — | flag | Enable search functionality | false |
--refresh | — | flag | Force re-download template from GitHub, bypassing cache | false |
Example
lito build -i ./docs -o ./build \ --provider cloudflare \ --rendering server \ --name "My Documentation" \ --description "Complete reference" \ --primary-color "#0066CC" \ --searchdev
Starts a local development server with hot module reloading. Perfect for editing and previewing changes in real-time.
# With global installationlito dev --input ./my-docs [options]
# With npxnpx @litodocs/cli dev --input ./my-docs [options]Options
| Option | Alias | Type | Description | Default |
|---|---|---|---|---|
--input | -i | <path> | Required. Path to your docs folder | — |
--template | -t | <name> | Template to use: default, github:owner/repo, or local path | default |
--base-url | -b | <url> | Base URL for the site | / |
--port | -p | <number> | Port for the development server | 4321 |
--name | — | <name> | Set project name | — |
--description | — | <text> | Set project description | — |
--primary-color | — | <hex> | Set primary theme color (hex format) | — |
--accent-color | — | <hex> | Set accent theme color (hex format) | — |
--favicon | — | <path> | Set favicon path | — |
--logo | — | <path> | Set logo path | — |
--search | — | flag | Enable search functionality | false |
--refresh | — | flag | Force re-download template from GitHub, bypassing cache | false |
Example
lito dev -i ./docs -p 5000 \ --name "Development Docs" \ --primary-color "#3B82F6"eject
Exports the complete Astro project source code. Use this when you need full control over the project and want to customize beyond what Lito configuration allows.
# With global installationlito eject --input ./my-docs --output ./astro-docs-project [options]
# With npxnpx @litodocs/cli eject --input ./my-docs --output ./astro-docs-project [options]Options
| Option | Alias | Type | Description | Default |
|---|---|---|---|---|
--input | -i | <path> | Required. Path to your docs folder | — |
--output | -o | <path> | Output directory for the Astro project | ./astro-docs-project |
--template | -t | <name> | Template to use: default, github:owner/repo, or local path | default |
--base-url | -b | <url> | Base URL for the site | / |
--name | — | <name> | Set project name | — |
--description | — | <text> | Set project description | — |
--primary-color | — | <hex> | Set primary theme color (hex format) | — |
--accent-color | — | <hex> | Set accent theme color (hex format) | — |
--favicon | — | <path> | Set favicon path | — |
--logo | — | <path> | Set logo path | — |
--search | — | flag | Enable search functionality | false |
--refresh | — | flag | Force re-download template from GitHub, bypassing cache | false |
Example
lito eject -i ./docs -o ./my-astro-project \ --name "Customizable Docs" \ --primary-color "#10B981" \ --refreshOnce ejected, you have a full Astro project and can use all standard Astro commands:
cd my-astro-projectnpm installnpm run devnpm run buildpreview
Preview a production build locally. Optionally builds first if no output exists.
# Preview existing buildlito preview --output ./dist
# Build and previewlito preview --input ./my-docsOptions
| Option | Alias | Type | Description | Default |
|---|---|---|---|---|
--input | -i | <path> | Path to docs folder (will build if needed) | — |
--output | -o | <path> | Path to built site | ./dist |
--template | -t | <name> | Template to use if building | default |
--base-url | -b | <url> | Base URL for the site | / |
--port | -p | <number> | Port for preview server | 4321 |
Example
# Quick preview of existing buildlito preview -o ./dist -p 3000
# Full build and preview workflowlito preview -i ./docs -o ./distvalidate
Validate your docs-config.json configuration against the schema.
lito validate --input ./my-docsOptions
| Option | Alias | Type | Description | Default |
|---|---|---|---|---|
--input | -i | <path> | Path to the docs folder | current directory |
--quiet | -q | flag | Quiet mode for CI (exit code only) | false |
Example
# Interactive validation with detailslito validate -i ./docs
# CI-friendly (exit code 0 = valid, 1 = invalid)lito validate -i ./docs --quiet && echo "Config is valid"What It Checks
- Required fields (
metadata.name) - Type validation (objects, arrays)
- Sidebar structure (label + items required)
- Config portability (core vs extension keys)
doctor
Diagnose common issues with your documentation project.
lito doctor --input ./my-docsOptions
| Option | Alias | Type | Description | Default |
|---|---|---|---|---|
--input | -i | <path> | Path to the docs folder | current directory |
Checks Performed
| Check | Description |
|---|---|
| Directory exists | Validates the path is a valid directory |
docs-config.json exists | Configuration file is present |
| Config is valid JSON | Can be parsed without errors |
| Config passes validation | Meets schema requirements |
| Content files exist | At least one .md or .mdx file found |
| No common issues | Checks for misplaced files (node_modules, etc.) |
| Template cache | Shows cached template status |
| Node.js version | Validates Node.js 18+ (recommends 20+) |
Example Output
┌ Lito - Doctor││ Checking: /path/to/docs││ Diagnostic Results:││ ✓ Directory exists│ ✓ docs-config.json exists│ ✓ Config is valid JSON│ ✓ Config passes validation│ ✓ Content files exist (34 files)│ ✓ No common issues│ ✓ Template cache (1 cached)│ ✓ Node.js version (v22.0.0)│└ Your project looks healthy! 🎉info
Display project information and statistics.
lito info --input ./my-docsOptions
| Option | Alias | Type | Description | Default |
|---|---|---|---|---|
--input | -i | <path> | Path to the docs folder | current directory |
Information Displayed
- Project: Name, description
- Content: Markdown/MDX file counts, subdirectories
- Navigation: Sidebar groups, navbar links
- Features: Search, i18n, versioning, dark mode status
- Branding: Logo, favicon, colors
- Configuration: Core vs extension keys, portability
- Environment: Node.js version, cached templates
Example
lito info -i ./docstemplate list
Lists all available Lito templates.
lito template list# ornpx @litodocs/cli template listtemplate cache
Manages the template cache.
lito template cache [options]# ornpx @litodocs/cli template cache [options]Options
| Option | Description |
|---|---|
--clear | Clear all cached templates to free up disk space |
Example
lito template cache --clearupgrade
Checks for updates and upgrades Lito to the latest version.
lito upgrade# ornpx @litodocs/cli upgradeThis command will:
- Check the npm registry for the latest version
- Compare it with your installed version
- Prompt you to confirm the upgrade
- Automatically detect your package manager (pnpm, yarn, or npm)
- Run the appropriate install command
Example Output
🔍 Checking for updates...
Current version: 0.5.1 Latest version: 0.5.2
? Upgrade from 0.5.1 to 0.5.2? (Y/n)Lito automatically checks for updates when you run any command. If an update is available, you’ll see a notification suggesting to run lito upgrade.