-
Notifications
You must be signed in to change notification settings - Fork 380
[CLI] Add high-level start command for easy local WordPress development
#3040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
…ment Introduces a new `start` command that provides a simple, wp-now-style experience for running WordPress locally. While the existing `server` command offers powerful low-level options for advanced use cases, `start` is designed for developers who just want to run a command and get going. The command auto-detects project types (plugin, theme, wp-content, WordPress), enables auto-login by default, and opens the browser automatically. It accepts manual mounts via --mount and allows disabling auto-detection with --no-auto-detect for users who need more control.
|
i have this same issue Runtime error |
|
@Samiullahstanikzai would you open a new issue with more details and reproduction instructions? |
|
Could we make the command even shorter? Just: |
|
@akirk I think so! Or maybe even just |
| } | ||
|
|
||
| export function isPluginFilename(path: string): boolean { | ||
| export function isPluginDirectory(path: string): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function accepts a directory path, let's call it accordingly
Summary
This PR introduces a new
startcommand to Playground CLI that provides a simple, wp-now-style experience for running WordPress locally. It's designed to make the CLI accessible to developers who just want to run a command and get going, without needing to understand low-level options.The existing
servercommand remains available for advanced users who need fine-grained control over mounts, WordPress installation modes, and other low-level options.Migrating from wp-now
This change unlocks officially deprecating
@wp-now/wp-nowand recommending everyone switch to@wp-playground/cli. Here's how wp-now commands map to the newstartcommand:npx @wp-now/wp-now startnpx @wp-playground/cli startwp-now start --php=8.3playground start --php=8.3wp-now start --wp=6.7playground start --wp=6.7wp-now start --port=8000playground start --port=8000wp-now start --blueprint=bp.jsonplayground start --blueprint=bp.jsonwp-now start --path=./my-pluginplayground start --path=./my-pluginwp-now start --skip-browserplayground start --skip-browserwp-now start --resetThe API is intentionally similar. Both tools automatically detect plugin, theme, wp-content, or WordPress directories. Both work with no additional flags.
Improvements over wp-now:
--skip-browserto disable)--mount /host/path:/vfs/pathfor additional mounts beyond auto-detection--no-auto-mountto disable auto-detection and manually control mounts--site-urlwhen you need a specific URLDifferences with wp-now:
wp-now, you can runwp-now startin a directory, get a site, make some changes to that site, then close the server, come back the next day, start the server again, and continue working on that same site. Playground CLI doesn't do it. Every server is ephemeral. You can store your changes by explicitly mounting wp-content to a local directory, but there's no automation in place to do it for you. If the users will request this feature, we can consider adding it, but I'm skipping it in the initial rollout as it would add a lot of complexity that the Playground CLI tool was intentionally designed not to handle implicitly.Usage
CLI Flags Reference
--path--php8.37.2,7.3,7.4,8.0,8.1,8.2,8.3,8.4,8.5--wplatest--port9400--blueprint--logintrue--xdebugfalse--skip-browserfalse--quietfalse--site-urlhttp://127.0.0.1:<port>).--mount/host/path:/vfs/path. Use this for additional mounts beyond auto-detection.--no-auto-mountfalse--mountto manually specify mounts instead.Test plan
playground start --helpand verify options are displayed correctlyplayground startin a plugin directory and verify auto-detection works--skip-browsersuppresses browser opening