CLI Reference
Command syntax, flags, and Rspress integration for the ciderpress CLI.
Overview
ciderpress uses @kidd-cli/core for command routing. Styled terminal output goes through @clack/prompts. The CLI entry point is packages/cli/src/index.ts, which registers all commands. Each command is a standalone module that orchestrates the engine and Rspress build APIs.
Commands
setup
Creates a starter ciderpress.config.ts in the current directory if one does not already exist.
dev
The primary development workflow. Combines initial sync, file watcher, and Rspress dev server on http://localhost:6174. The --clean flag removes cache, content, and dist before starting.
Use --headless to skip the Ink TUI and emit plain log output. Required when running from a non-TTY shell (tmux without a real PTY, background agent tasks, CI). Note that the headless runner does not construct the shared OpenAPI cache, so OpenAPI dereferencing repeats on every sync — see Dev Mode.
See Dev Mode for how the watch loop, HMR, and config reload work.
build
Produces a static site:
- Optional clean step
- Full sync
- Rspress build (generates optimized HTML/CSS/JS in
.ciderpress/dist/) - Link check (enabled by default, disable with
--no-check)
serve
Starts a static file server pointing at .ciderpress/dist/ on http://localhost:8080. The browser opens automatically; use --no-open to disable.
sync
Runs the sync engine and exits — no dev server, no Rspress build. Loads config, syncs all content into .ciderpress/content/, reports pages written / skipped / removed and elapsed ms. Useful for CI pipelines, benchmarking the sync pipeline in isolation, and pre-warming .ciderpress/ before a separate build step.
check
Validates the config and runs a build to detect broken links. Reports config errors and deadlinks with a summary table.
diff
Shows changed files in configured source directories. Two modes:
- Without
--ref(default): usesgit statusto detect uncommitted changes in the working tree. - With
--ref <ref>: usesgit diff --name-only <ref> HEADto compare commits. Exits with code1when changes are detected — matching the VercelignoreCommandconvention (exit 1 = proceed with build, exit 0 = skip).
By default, output is a space-separated file list on stdout (suitable for scripts and piping). Pass --pretty to emit intro/note/outro formatting via @clack/prompts — not pipeable, but human-readable.
draft
Scaffolds a new documentation file from a template. Prompts for doc type and title when not provided via args, then writes the rendered template to the specified output directory.
clean
Removes .ciderpress/cache/, .ciderpress/content/, and .ciderpress/dist/ (all three targets live under .ciderpress/). Safe to run at any time -- all content is regenerated by sync/build.
dump
Resolves the full entry tree from the config and prints it as JSON. Useful for debugging config resolution and glob patterns.
Rspress Integration
The CLI communicates with Rspress through packages/cli/src/lib/rspress.ts:
All functions receive a Rspress config object built by createRspressConfig() from @ciderpress/ui. Sidebar and nav are loaded by Rspress from _meta.json / _nav.json in the content tree; the UI config additionally loads workspaces.json and scopes.json from .ciderpress/content/.generated/ and wires up the ciderpress theme.
Error Handling
CLI errors are handled at the command boundary:
- Config errors --
loadConfig()returns aResult<T, ConfigError>tuple; commands report errors via@clack/promptsand callprocess.exit(1) - Sync errors -- Result tuples propagate up; the CLI reports them and exits
- Rspress errors -- Build/dev failures are caught and reported
All user-facing error formatting is centralized in the CLI layer.