Skip to content

CLI Reference

Jon Imms edited this page Jun 25, 2026 · 1 revision

CLI Reference

The complete command reference for the stratawp CLI and the create-stratawp scaffolder, grouped by area.

StrataWP ships two binaries from the @stratawp/cli package (currently v2.0.0): create-stratawp (also published as the standalone create-stratawp package, currently v0.5.2) bootstraps a new theme, and stratawp manages it day to day — scaffolding, dev/build, design systems, deployment, sync, rollback, icons, and updates.

Note This page is the curated, grouped reference. For the full one-page command list, see the canonical CHEAT_SHEET.md in the repo. New to the CLI? Start with Installation & Quick Start.

Prerequisites

  • Node.js 18 or higher
  • pnpm (recommended) or npm
  • PHP 8.1+ and WordPress 6.7+ with a local dev environment
  • The stratawp command available on your PATH (installed automatically inside a scaffolded theme; see FAQ & Troubleshooting if it is not found)

Tip Run stratawp --version to confirm the CLI is installed, and stratawp --help to print every available command.

Conventions

  • <angle> brackets denote required arguments; [square] brackets denote optional ones.
  • Flags shown with a value (e.g. --port <port>) expect an argument; boolean flags (e.g. --force) do not.
  • pnpm <script> commands are package.json scripts that live inside a generated theme. The stratawp <command> commands are the global CLI.

Scaffolding a new theme — create-stratawp

Command What it does
npx create-stratawp Creates a new StrataWP theme via an interactive wizard.

The wizard prompts for theme name, slug, description, and author, then walks you through template selection (Basic, Advanced, Store, or Minimal), a CSS framework choice (Vanilla, Tailwind, UnoCSS, or Panda), TypeScript configuration, optional testing, and auto-detects/links your local WordPress install (Local by Flywheel and MAMP sites are scanned automatically).

Example

npx create-stratawp

Warning Run create-stratawp from a directory outside your WordPress installation (e.g. ~/Projects). The wizard creates the theme folder and symlinks it into WordPress for you.

See Installation & Quick Start for the full first-run walkthrough.


Project scripts (run inside a theme)

These are the pnpm scripts present in a generated theme's package.json.

Command What it does
pnpm dev Starts the Vite dev server with hot reload at http://localhost:3000.
pnpm build Builds the theme for production.
pnpm preview Serves the production build locally for preview.
pnpm typecheck Runs TypeScript validation (tsc --noEmit).

Note The script is typecheck (no hyphen). Linting, formatting, and the test runner are wired at the StrataWP monorepo root rather than inside an individual generated theme, so prefer the stratawp CLI entry points below for those tasks.

The stratawp CLI also exposes dev and build directly:

Command Signature Common flags
Dev server stratawp dev -p, --port <port> (default 3000), -h, --host <host> (default localhost)
Production build stratawp build --analyze (analyze bundle size)

Example

stratawp dev --port 3001

Scaffolding generators

Generate blocks, components, templates, and template parts inside an existing theme.

Command What it does Common flags
stratawp block:new <name> Creates a new Gutenberg block (dynamic, server-rendered via render.php). --category <category> (default common), --styleFramework <none|tailwind|unocss> (default none)
stratawp component:new <name> Creates a new PHP theme component. -t, --type <service|feature|integration|custom> (default custom), --namespace <namespace>
stratawp template:new <name> Creates a new WordPress (FSE) template. -t, --type <page|single|archive|404|home|search|custom> (default page), --description <text>
stratawp part:new <name> Creates a new template part. -t, --type <header|footer|sidebar|content|custom> (default custom), --markup <html|php> (default php)

Note block:new does not take a --type flag — generated blocks are always dynamic (server-rendered via render.php). Its only flags are --category and --styleFramework.

Example

stratawp block:new hero-banner --category design --styleFramework tailwind

See Blocks, Patterns & Design Systems for what each generator produces.


Design systems

Command What it does
stratawp design-system:setup <framework> Sets up a design system. <framework> must be tailwind or unocss.

The command installs the framework dependencies, writes a config file (tailwind.config.js or uno.config.ts), updates vite.config.ts, and creates src/css/design-system.css.

Example

stratawp design-system:setup tailwind

Testing

Command What it does Common flags
stratawp test Test runner entry point. --unit (unit only), --e2e (E2E only), --watch (watch mode)

Warning stratawp test is a registered command whose flags are accepted, but the runner is not yet implemented — it currently prints a "Coming soon!" notice. Track progress in the Roadmap. For working test execution today, use the Vitest/Playwright tooling described in Testing & Quality.

Example

stratawp test --unit --watch

Component Explorer

Command Signature Common flags
Launch explorer stratawp explorer -p, --port <port> (default 3000), -h, --host <host> (default localhost), --no-open (don't open browser)
Alias stratawp storybook Same flags as explorer.

Example

stratawp explorer --port 6006 --no-open

Deployment

Deploy a built theme to a configured environment over FTP, SFTP, SSH, or Git.

Command What it does Common flags
stratawp deploy:setup Interactive configuration of deployment environments.
stratawp deploy <environment> Deploys the theme to the named environment. --no-build, --dry-run, --force, --fresh, --no-backup, --verbose
stratawp deploy:test <environment> Tests the connection to an environment.
stratawp deploy:list Lists configured deployment environments.

Deploy flags

Flag Effect
--no-build Skip the build step.
--dry-run Show what would be deployed without deploying.
--force Deploy without the confirmation prompt.
--fresh Ignore the manifest and upload all files (full deploy).
--no-backup Skip creating a pre-deploy backup snapshot.
--verbose Show detailed debug output.

Example

stratawp deploy production --dry-run

See Deployment for the setup wizard and post-deploy automation.


FSE template sync

Sync Full Site Editing templates between local and remote databases via WP-CLI over SSH.

Command What it does Common flags
stratawp sync:templates <environment> Syncs FSE templates from the local DB to the remote. -t, --template <name>, --all, --dry-run, --wp-path <path>, --wp-cli <path>, --verbose
stratawp sync:templates:list <environment> Lists FSE templates on local and remote. --wp-path <path>, --wp-cli <path>

Example

stratawp sync:templates production --all --dry-run

Database sync

Command What it does Common flags
stratawp sync:db:pull <environment> Pulls the database from a remote environment to local. --tables <list>, --no-url-replace, --dry-run
stratawp sync:db:push <environment> Pushes the local database to a remote environment. --tables <list>, --no-url-replace, --dry-run, --force

--tables accepts a comma-separated list (e.g. wp_posts,wp_postmeta). URL replacement is serialization-safe.

Example

stratawp sync:db:pull production --tables=wp_posts,wp_postmeta

Warning sync:db:push overwrites the remote database. Use --dry-run first to preview. See Environment Sync & Rollback.


Rollback & snapshots

Command What it does Common flags
stratawp rollback:list (alias rollback:ls) Lists available deployment snapshots. -e, --environment <env>, -n, --limit <number> (default 10)
stratawp rollback:diff <snapshot1> <snapshot2> Compares two snapshots by index.
stratawp rollback:mark-stable <snapshot> Marks a snapshot as known-good (stable).

Example

stratawp rollback:list --environment=production --limit=20

Icon fonts

Manage a Flaticon icon-font directory in your theme.

Command What it does Common flags
stratawp icons:setup Sets up the icon-font directory (Flaticon) under src/icons/. --zip <path>
stratawp icons:update Updates the icon font from a new ZIP file. --zip <path>
stratawp icons:list Lists available icon names.

Example

stratawp icons:setup --zip ~/Downloads/my-icons.zip

Package updates

Check for and apply updates to your installed @stratawp/* packages.

Command What it does Common flags
stratawp update Checks for and applies StrataWP package updates interactively. -c, --check (check only, don't apply), -f, --force (skip confirmation prompts)

Example

stratawp update --check

See also

Clone this wiki locally