Skip to content

Conversation

@adamziel
Copy link
Collaborator

@adamziel adamziel commented Jan 13, 2026

Motivation for the change, related issues

Makes npx @wp-playground/cli start persist the created site – just like wp-now does. With this PR, Playground CLI has a feature parity with wp-cli and we can move forward with the wp-now deprecation.

Follow-ups on #3040

Implementation details

Whenever there's no mount specified for /wordpress, Playground CLI will mount the host path ~/.wordpress-playground/sites/<path hash> at the /wordpress VFS location.

There's also a --reset CLI flag that wipes out the stored files and starts a fresh site.

That's the gist of it.

This simple logic comes with a few caveats:

  • The ~/.wordpress-playground mount will not happen if the user explicitly mounts /my/cool/site at /wordpress. We can't mount two host directories at /wordpress so the explicit path wins.
  • The ~/.wordpress-playground mount will not happen if the auto mounting is enabled, and the /my/project/path contains a full WordPress installation. The reason is the same as above.
  • I've removed the "just mount cwd at /wordpress" fallback in the auto-mounting logic. It doesn't seem that useful and it also interfered with the ~/.wordpress-playground mount. If we really need that logic in the future, we can restore it behind an explicit option.

I've also moved the start command logic inside the runCli() function, it seems cleaner that way. Really, the CLI code could use some cleanup sooner than later to clearly separate the Typescript definitions for each command's args and clearly separate their handlers. But that's out of scope here.

Testing Instructions (or ideally a Blueprint)

  • Run nx dev playground-cli start
  • Change site title or add a page
  • Kill the server
  • Run nx dev playground-cli start again
  • Confirm your changes are still there
  • Kill the server
  • Run nx dev playground-cli start --reset-site
  • Confirm you got a fresh new site

@adamziel adamziel changed the title [CLI] Persist sites in home directory when the start command is used [CLI] @wp-playground/cli start perist sites Jan 13, 2026
@adamziel adamziel changed the title [CLI] @wp-playground/cli start perist sites [CLI] @wp-playground/cli start persist sites Jan 13, 2026
@brandonpayton
Copy link
Member

@adamziel I read the PR description and think everything sounds like a good idea. This sounds great for users.

@adamziel adamziel merged commit 7b484d5 into trunk Jan 13, 2026
33 checks passed
@adamziel adamziel deleted the persist-cli-sites branch January 13, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants