The rig CLI: Complete Command Reference

Every WP Rig workflow runs through npm/Bun scripts (plus a few Composer and WP-CLI commands). This is the canonical command reference — the same list lives in the repo at docs/commands.md, and npm run with no arguments lists everything available in your checkout.

Development & build

CommandPurpose
npm run devWatch source files and rebuild on changes (all-in-one dev loop with live reload).
npm run dev:modernVite-like dev server without BrowserSync (opt-in).
npm run buildOne-time build of source files without watching.
npm run build:css / build:jsBuild only CSS (Lightning CSS) or JS/TS (esbuild).
npm run build:blocksBuild all blocks in assets/blocks/.
npm run bundleProduction-ready theme: minified assets, string replacement, translations, WebP + AVIF images.
npm run bundle:wporgProduction bundle prepped for WordPress.org submission.

Initialization & setup

CommandPurpose
npm run rig-initInstall dependencies and run the interactive theme initializer (paradigm choice, dev URL, etc.).
npm run rig-init:bunSame, with bun install.
npm run setup-childrig-init + childify in one command (paradigm-aware child themes).
npm run block-basedConvert the theme toward a strictly block-based (FSE) setup.
npm run theme:enable-blocksEnable block compilation (enableBlocks: true).
npm run generateCertGenerate local SSL certificates.
npm run get-dev-urlPrint the resolved dev URL.

Quality & linting

CommandPurpose
npm run lint:jsESLint on assets/js/src/**.
npm run lint:cssStylelint with the WP Rig budget: nesting ≤ 3 levels, specificity ≤ (0,4,1), no !important, var()-required custom properties, no descending specificity. Also regenerates tokens first.
npm run fix:cssAuto-fix stylelint violations.
npm run lint:blocksValidate block markup in templates/ + parts/ against live core block schemas.
npm run lint:patternsValidate block patterns (metadata + markup) in patterns/ and component patterns/ dirs.
npm run ai:checkFull pre-flight gate: e2e + screenshots + all linters. Run before submitting work.

Design tokens

CommandPurpose
npm run rig:tokensRegenerate CSS variables + theme.json (+ Tailwind when enabled) from config/tokens.json. Merges any baked overlay last.
npm run rig:tokens:setupOne-time v1→v2 token upgrade + legacy-name codemod. Dry-run by default; --apply writes (with backups).
npm run rig:tokens:importImport a W3C DTCG / Figma (Tokens Studio) JSON. Dry-run by default.
npm run rig:tokens:exportExport tokens.json to a DTCG document for Figma round-trips.

See Design Tokens v2 for the full system.

WordPress blocks

CommandPurpose
npm run block:new <slug>Scaffold a block (apiVersion: 3). Flags: --title, -d/--dynamic, --ts, --php (PHP-only block), --category, --icon, --description, --keywords, --no-style, --no-editor-style, --view.
npm run block:new:dynamicShortcut for a dynamic (render.php) block.
npm run block:list / block:removeList or remove theme blocks.
npm run block:promote-pluginPromote a theme block into a plugin.
npm run block:schemaFetch active core block schemas from your local site (WP-CLI bridge).
npm run block:compileCompile a block IR payload to Gutenberg markup via the WP-CLI bridge.

Component registry

CommandPurpose
npm run rig:listList installed components (bundled vs registry) with versions.
npm run rig:search [keyword]Discover community components.
npm run rig:add [slug] / rig:remove [slug]Install or remove a component (assets, AI context, manifest entry — no orphans).
npm run rig:update [slug]Pull framework-level component updates, preserving local customizations.
npm run rig:test-component [slug]Pre-flight check before sharing (manifest, files, security).
npm run rig:prepare [slug]Package a component for submission via GitHub PR.
npm run rig:compareCompare installed components against registry versions.
npm run create-rig-component "Name"Scaffold a new theme component (registry-ready files included).

Full lifecycle docs: The Open Component Registry.

Site Editor bake & sync

CommandPurpose
npm run rig:bakeBake Site Editor DB changes (patterns, templates/parts, fonts, Global Styles) into theme files.
npm run rig:bake:planRead-only inventory + collision report. Run before every bake.
npm run rig:bake:cleanDelete only DB records whose exported files match the manifest sha256; removes the overlay.

Full workflow docs: Site Editor Bake & Sync.

Patterns, testing, audits

  • npm run rig:pattern — scaffold a block pattern with i18n-aware headers + config-seeded categories.
  • npm run rig:localize — generate the .pot translation file in languages/.
  • npm run test:e2e — full Playwright suite (chromium + firefox + webkit).
  • npm run test:e2e:spatial — spatial & visual regression (deterministic geometry checks).
  • npm run test:e2e:screenshot — capture/update regression screenshots.
  • npm run test:scripts — Jest unit tests for build tooling.
  • npm run test:prod-build — full production-bundle verification.
  • npm run audit:theme-review (and the other audit:* commands) — WordPress.org-style theme review checks.

Composer & WP-CLI

  • Testing: composer test:unit, test:integration, test:all (unit + integration + PHPStan).
  • Quality: composer phpstan, composer phpcs-dev, composer fix (Rector + PHP-CS-Fixer + PHPCBF).
  • Environment: composer setup-wp-tests, composer install-codestandards.
  • WP-CLI: wp rig test-setup and wp rig import-test-data set up the Theme Unit Test environment.