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.