Skip to main content

CLI Reference

Manage pages, validate schemas, preview renders, and build โ€” all from the terminal.

Installation

StackWright CLI comes bundled with @StackWright/cli. If you scaffolded with launch-StackWright, it's already installed.

bash
# Already installed via launch-StackWright
npx launch-StackWright my-site
 
# Or add to an existing project
pnpm add @StackWright/cli

Page Commands

Create, list, and manage pages in your StackWright site.

bash
# Add a new page
pnpm StackWright page add about --heading "About Us"
 
# List all pages
pnpm StackWright page list
 
# Remove a page
pnpm StackWright page remove about

Validation

Validate page YAML against Zod schemas before building. Catches errors early.

bash
# Validate all pages
pnpm StackWright validate
 
# Validate a specific page
pnpm StackWright validate pages/about/content.yml

Theme Management

Preview and switch between themes. Custom themes are defined in StackWright.yml.

bash
# List available themes
pnpm StackWright theme list
 
# Preview a theme
pnpm StackWright theme preview my-theme

Rendering & Preview

Render pages to screenshots for visual verification. Used by the Otter Raft for iterative design.

bash
# Render a specific page
pnpm StackWright render /about --width 1280 --height 720
 
# Render all pages
pnpm StackWright render --all

Build & Deploy

The prebuild step processes YAML into JSON. Then Next.js handles the rest.

bash
# Development (prebuild + hot reload)
pnpm dev
 
# Production build
pnpm build
 
# Start production server
pnpm start
MCP Server
The StackWright MCP server exposes CLI commands as tools. AI agents call validate, render, and page-add through the protocol โ€” no terminal needed.

Quick Reference

page add <name>

Create a new page with directory and content.yml

page list

List all pages in the current project

validate [file]

Validate page YAML against Zod schemas

render <path>

Screenshot a page for visual verification

theme list

List available built-in and custom themes

build

Prebuild YAML โ†’ JSON, then Next.js production build

Ready to Build?

Start with the Getting Started guide or let the Otter Raft handle it.