CLI Commands

The Lito CLI provides powerful commands to develop, build, and manage your documentation site. All commands support detailed options for customization.

init

Initialize a new documentation project with interactive prompts or options.

Terminal window
# Interactive mode
lito init
# With options
lito init --output ./my-docs --name "My Project" --template default

Options

OptionAliasTypeDescriptionDefault
--output-o<path>Output directory for the project(interactive)
--name-n<name>Project name(interactive)
--template-t<name>Template to usedefault
--sampleflagCreate sample documentation pagestrue

Example

Terminal window
lito init -o ./docs -n "My API Docs" -t default

This creates:

  • docs-config.json with your project settings
  • Sample introduction.mdx and quickstart.mdx pages
  • _assets/ and _images/ folders for static files

build

Builds your documentation site for production deployment.

Terminal window
# With global installation
lito build --input ./my-docs --output ./dist [options]
# With npx
npx @litodocs/cli build --input ./my-docs --output ./dist [options]

Options

OptionAliasTypeDescriptionDefault
--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 pathdefault
--base-url-b<url>Base URL for the site (useful for subpath deployments)/
--provider<name>Hosting optimization: vercel, netlify, cloudflare, staticstatic
--rendering<mode>Rendering mode: static, server, hybridstatic
--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
--searchflagEnable search functionalityfalse
--refreshflagForce re-download template from GitHub, bypassing cachefalse

Example

Terminal window
lito build -i ./docs -o ./build \
--provider cloudflare \
--rendering server \
--name "My Documentation" \
--description "Complete reference" \
--primary-color "#0066CC" \
--search

dev

Starts a local development server with hot module reloading. Perfect for editing and previewing changes in real-time.

Terminal window
# With global installation
lito dev --input ./my-docs [options]
# With npx
npx @litodocs/cli dev --input ./my-docs [options]

Options

OptionAliasTypeDescriptionDefault
--input-i<path>Required. Path to your docs folder
--template-t<name>Template to use: default, github:owner/repo, or local pathdefault
--base-url-b<url>Base URL for the site/
--port-p<number>Port for the development server4321
--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
--searchflagEnable search functionalityfalse
--refreshflagForce re-download template from GitHub, bypassing cachefalse

Example

Terminal window
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.

Terminal window
# With global installation
lito eject --input ./my-docs --output ./astro-docs-project [options]
# With npx
npx @litodocs/cli eject --input ./my-docs --output ./astro-docs-project [options]

Options

OptionAliasTypeDescriptionDefault
--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 pathdefault
--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
--searchflagEnable search functionalityfalse
--refreshflagForce re-download template from GitHub, bypassing cachefalse

Example

Terminal window
lito eject -i ./docs -o ./my-astro-project \
--name "Customizable Docs" \
--primary-color "#10B981" \
--refresh

Once ejected, you have a full Astro project and can use all standard Astro commands:

Terminal window
cd my-astro-project
npm install
npm run dev
npm run build

preview

Preview a production build locally. Optionally builds first if no output exists.

Terminal window
# Preview existing build
lito preview --output ./dist
# Build and preview
lito preview --input ./my-docs

Options

OptionAliasTypeDescriptionDefault
--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 buildingdefault
--base-url-b<url>Base URL for the site/
--port-p<number>Port for preview server4321

Example

Terminal window
# Quick preview of existing build
lito preview -o ./dist -p 3000
# Full build and preview workflow
lito preview -i ./docs -o ./dist

validate

Validate your docs-config.json configuration against the schema.

Terminal window
lito validate --input ./my-docs

Options

OptionAliasTypeDescriptionDefault
--input-i<path>Path to the docs foldercurrent directory
--quiet-qflagQuiet mode for CI (exit code only)false

Example

Terminal window
# Interactive validation with details
lito 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.

Terminal window
lito doctor --input ./my-docs

Options

OptionAliasTypeDescriptionDefault
--input-i<path>Path to the docs foldercurrent directory

Checks Performed

CheckDescription
Directory existsValidates the path is a valid directory
docs-config.json existsConfiguration file is present
Config is valid JSONCan be parsed without errors
Config passes validationMeets schema requirements
Content files existAt least one .md or .mdx file found
No common issuesChecks for misplaced files (node_modules, etc.)
Template cacheShows cached template status
Node.js versionValidates 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.

Terminal window
lito info --input ./my-docs

Options

OptionAliasTypeDescriptionDefault
--input-i<path>Path to the docs foldercurrent 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

Terminal window
lito info -i ./docs

template list

Lists all available Lito templates.

Terminal window
lito template list
# or
npx @litodocs/cli template list

template cache

Manages the template cache.

Terminal window
lito template cache [options]
# or
npx @litodocs/cli template cache [options]

Options

OptionDescription
--clearClear all cached templates to free up disk space

Example

Terminal window
lito template cache --clear

upgrade

Checks for updates and upgrades Lito to the latest version.

Terminal window
lito upgrade
# or
npx @litodocs/cli upgrade

This command will:

  1. Check the npm registry for the latest version
  2. Compare it with your installed version
  3. Prompt you to confirm the upgrade
  4. Automatically detect your package manager (pnpm, yarn, or npm)
  5. 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)