AgentSkillsCN

barodoc-cli

Barodoc CLI 命令集,用于开发、构建和项目创建。当您运行 Barodoc 命令、搭建开发服务器、构建文档站点,或创建新项目时,可使用此技能。

SKILL.md
--- frontmatter
name: barodoc-cli
description: Barodoc CLI commands for development, building, and project creation. Use when running barodoc commands, setting up dev servers, building documentation sites, or creating new projects.

Barodoc CLI

The barodoc CLI provides commands for development, building, and project management.

Installation

bash
# Global install
npm install -g barodoc

# Or use via npx
npx barodoc serve

Commands

serve - Development Server

Start a development server with hot reload.

bash
barodoc serve [dir] [options]

Arguments:

  • dir - Project directory (default: .)

Options:

OptionDescriptionDefault
-p, --port <port>Port to listen on4321
-h, --hostExpose to networkfalse
-c, --config <file>Config file pathauto-detect

Examples:

bash
# Current directory
barodoc serve

# Specific directory
barodoc serve docs

# Custom port
barodoc serve --port 3000

# Expose to network
barodoc serve --host

build - Production Build

Build static files for deployment.

bash
barodoc build [dir] [options]

Arguments:

  • dir - Project directory (default: .)

Options:

OptionDescriptionDefault
-o, --output <dir>Output directorydist
-c, --config <file>Config file pathauto-detect

Examples:

bash
# Build current directory
barodoc build

# Build specific directory
barodoc build docs

# Custom output
barodoc build --output build

Output:

  • Static HTML/CSS/JS in output directory
  • Pagefind search index generated automatically

preview - Preview Build

Serve the production build locally for testing.

bash
barodoc preview [dir] [options]

Arguments:

  • dir - Project directory (default: .)

Options:

OptionDescriptionDefault
-p, --port <port>Port to listen on4321
-o, --output <dir>Build output directorydist

Example:

bash
barodoc build && barodoc preview

create - New Project

Scaffold a new Barodoc documentation project.

bash
barodoc create <name>

Arguments:

  • name - Project name (creates directory)

Example:

bash
barodoc create my-docs
cd my-docs
barodoc serve

Generated structure:

code
my-docs/
├── barodoc.config.json
├── docs/
│   └── en/
│       ├── introduction.md
│       └── quickstart.md
├── public/
│   └── logo.svg
└── .gitignore

Auto-Detection

The CLI automatically detects project type:

File PresentModeBehavior
astro.config.mjsFull CustomRuns astro dev/build directly
No astro configQuick ModeCreates temp Astro project in .barodoc/

Development Workflow

In Monorepo (Local Development)

bash
# Run CLI with tsx (no build required)
pnpm barodoc serve docs

# With explicit path
pnpm barodoc build docs --output docs/dist

The monorepo root package.json has:

json
{
  "scripts": {
    "barodoc": "tsx packages/barodoc/src/cli.ts"
  }
}

Published Package

bash
# After npm install -g barodoc
barodoc serve
barodoc build

Exit Codes

CodeMeaning
0Success
1Error (config not found, build failed, etc.)

Environment Variables

VariableDescription
PORTDefault port (overridden by --port)
HOSTDefault host binding

Troubleshooting

"Config file not found"

Ensure barodoc.config.json exists in the target directory:

bash
# Check current directory
ls barodoc.config.json

# Or specify explicitly
barodoc serve --config ./my-config.json

Port already in use

bash
barodoc serve --port 4322

Build fails with missing dependencies

For Quick Mode, ensure you have Node.js 20+ installed. For Full Custom Mode, run:

bash
pnpm install  # or npm install