Subchapter 13.1
references/cli.mdMarkdown5 KBView on GitHub
Use this reference for local WordPress Playground runs with @wp-playground/cli: disposable or persisted local servers, mounted plugins/themes, Blueprint execution, snapshots, version switching, and local smoke tests.
npm/npx available.server; the default is 9400.Check the installed CLI help when exact flags matter:
npx @wp-playground/cli@latest --help
npx @wp-playground/cli@latest start --help
npx @wp-playground/cli@latest server --helpUse start for the common local plugin/theme workflow. It detects the project type, mounts the project, opens a browser, enables admin auto-login, and persists the site between sessions.
cd <plugin-or-theme-root>
node -v
npx @wp-playground/cli@latest startnpx @wp-playground/cli@latest start --reset when the persisted site should be recreated from scratch.server with explicit --wp=<version> and --php=<version> when reproducing compatibility issues instead of relying on moving defaults.Use server when you need full manual control, a disposable site, CI-style behavior, custom mounts, or a Blueprint-backed server:
npx @wp-playground/cli@latest server --auto-mount--auto-mount[=<path>] detects a WordPress directory, plugin, theme, wp-content directory, or PHP/HTML directory.--port=<free-port> when the default port is busy.--wordpress-install-mode=install-from-existing-files-if-needed to skip setup when a site is already present.--wordpress-install-mode=do-not-attempt-installing only when WordPress files and database integration are already handled by the mounted tree.Use explicit mounts when auto-mount is not enough:
npx @wp-playground/cli@latest server \
--mount=/absolute/host/path:/wordpress/wp-content/plugins/my-plugin--mount= for multiple plugins, mu-plugins, themes, or custom content.--mount-before-install when installer or Blueprint steps need mounted files before WordPress setup completes.--mount-dir "/host/path" "/vfs/path" or --mount-dir-before-install "/host/path" "/vfs/path".For headless setup or CI-style validation:
npx @wp-playground/cli@latest run-blueprint --blueprint=<file-or-url>blueprint skill for Blueprint JSON structure and schema details.--blueprint-may-read-adjacent-files when a local Blueprint directory or bundle references nearby files.--verbosity=debug when step execution needs inspection.npx @wp-playground/cli@latest server --blueprint=<file-or-url>For local directory bundles:
npx @wp-playground/cli@latest server \
--blueprint=./my-bundle/ \
--blueprint-may-read-adjacent-filesZIP bundles are self-contained and do not need adjacent-file access.
npx @wp-playground/cli@latest build-snapshot \
--blueprint=<file-or-url> \
--outfile=./site.zip--verbosity=debug if the generated site does not contain the expected state.--wp=<version> to pin WordPress.--php=<version> to pin PHP.--verbosity=debug.--blueprint-may-read-adjacent-files for local directory bundles.--port=<free-port>.start site: rerun with start --reset.wp-playground routing procedure and select the debugging workflow.