Skip to content

CLI commands

Run commands from the directory containing docskit.config.ts.

CommandPurpose
docskit init [directory]Create a starter in an empty directory; defaults to docs
docskit version <id>Create a pending snapshot of current content and navigation
docskit promote <id>Mark a snapshot published and make it latest stable
docskit devStart the development server
docskit buildCompile pages, index search, and write dist/
docskit previewServe the last production build
docskit checkCheck configuration and TypeScript component files

docskit start is an alias for preview. Use docskit --help or docskit -h for usage, and docskit --version or docskit -v for the package version. Each command accepts --help and -h, for example docskit dev -h. Help does not require a config file or create a generated application.

version <id> creates documentation snapshots; --version prints the Docskit package version. See Documentation versions for setup and routes.

Server options

Development and preview default to port 3000. They accept --host and --port; -p is the short form for the port:

Shell
pnpm dev --host 0.0.0.0 --port 3001
pnpm preview --port 3001

The PORT environment variable also sets the port. An explicit --port takes precedence. Ports must be integers between 1 and 65535. Unknown commands, unsupported options, and invalid arguments exit with status 1.

Build-time settings

VariablePurpose
DOCS_SITE_URLPublic origin used by the site configuration
DOCS_BASE_PATHDeployment pathname used by the site configuration

Use the supported variables in docskit.config.ts, as shown in configuration. The CLI reads .env and .env.local.

Check and build

check validates configuration and TypeScript components. build also validates Markdown frontmatter, route uniqueness, and code-tab structure while rendering the content. Run both before publishing changes.

The generated application is stored under .docskit/. Do not edit it; configure your project through docskit.config.ts and its explicit extension options.

Interrupt a command

Ctrl+C stops the running tool. The CLI exits without a failure message for SIGINT or SIGTERM, using status 130 or 143 respectively. Other tool failures keep their error message and stop the command.