-
Notifications
You must be signed in to change notification settings - Fork 4.7k
wp-env: Add cleanup command and force flag #75045
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
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 3 MB ℹ️ View Unchanged
|
Add a new `cleanup` command that removes environment-specific resources (containers, volumes, networks, and local files) while preserving Docker images for faster re-starts. This is useful for archiving sessions without the overhead of full teardown. Also add `--force` flag to both `destroy` and `cleanup` commands to skip the confirmation prompt, enabling non-interactive usage in scripts. - Add cleanup command module with confirmation prompt support - Add --force flag to destroy and cleanup commands - Add getCleanupWarningMessage() methods to Docker and Playground runtimes - Add cleanup() methods to Docker and Playground runtimes - Update CLI to register cleanup command and force flag - Add tests for destroy and cleanup command parsing with force flag - Update README with cleanup command reference and lifecycle scripts - Update CHANGELOG with new features Co-Authored-By: Claude Haiku 4.5 <[email protected]>
Rename the `clean` command to `reset` to avoid confusion with the new `cleanup` command. The `clean` command is now deprecated but still works as an alias with a warning message. - Add new `reset` command that resets WordPress databases - Deprecate `clean` command (shows warning, still calls afterClean for backwards compat) - Update runtime messages to use "Resetting/Reset" instead of "Cleaning/Cleaned" - Add `afterReset` lifecycle script (afterClean still works for deprecated clean command) - Update README and CHANGELOG with deprecation notice Co-Authored-By: Claude Opus 4.5 <[email protected]>
f8cf051 to
3ba970c
Compare
What?
Add a new
cleanupcommand that removes environment-specific resources while preserving Docker images. Also add--forceflag to bothdestroyandcleanupcommands to skip confirmation prompts.Why?
In a world of worktrees, AI and parallel sessions, this command becomes necessary. When archiving sessions or running wp-env in non-interactive scripts, users need a way to clean up environments without removing shared Docker images (which can be large and time-consuming to rebuild). The
--forceflag enables automation without interactive prompts.How?
cleanupcommand: removes containers, volumes, networks, and local files but preserves Docker images (omits--rmi all)--forceflag: skips confirmation prompt on both commandsgetCleanupWarningMessage()andcleanup()for Docker and PlaygroundTesting Instructions
npx wp-env cleanupto test cleanup with confirmation promptnpx wp-env cleanup --forceto skip confirmationdocker images | grep wordpressnpx wp-env destroy --forceremoves everything including images🤖 Generated with Claude Code