WordPress / WordPress/create-block-theme
[Tracking] WP-CLI support: phased implementation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 417
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
Tracking issue for adding WP-CLI support to Create Block Theme, originally requested in #688.
Background
Issue #688 proposes WP-CLI commands so developers can persist Editor changes to disk from the terminal — useful for git workflows and automation. @bacoords prototyped a wp cbt save command on a separate branch (https://github.com/bacoords/create-block-theme/tree/add/cli-export-command) but did not open a PR; the prototype acknowledges duplicated logic from the REST API.
This tracking issue proposes a four-PR sequence that ships the CLI as a thin layer over a properly extracted service layer, so REST and CLI share a single implementation.
Approach
For each of save and export:
- Refactor first — extract the REST handler's orchestration into a service class (
CBT_Theme_Save,CBT_Theme_Export) underincludes/create-theme/. REST endpoint becomes a thin wrapper. Add PHPUnit coverage. No behavior change at the wire boundary. - Add the CLI command — register on the same service. Kebab-case flags,
wp_is_block_theme()guard,## EXAMPLES, i18n.
Doing the refactor first means the test coverage we need anyway lands in a small, reviewable PR before any new surface area is added.
Variation, clone, child-theme, blank-theme, and reset commands are deliberately out of scope for v1 and can be added in follow-ups once the pattern is established.
Sub-issues
- #829 — Extract
CBT_Theme_Saveservice fromrest_save_theme - #830 — Add
wp cbt saveCLI command - #831 — Extract
CBT_Theme_Exportservice fromrest_export_theme - #832 — Add
wp cbt exportCLI command
Out of scope (potential follow-ups)
- Variation / clone / blank / child theme creation as CLI commands
- Behat feature tests (the plugin has no Behat infrastructure today)
- Promoting silent filesystem failures to
WP_Error(separate concern from the refactor)
References
- Original feature request: #688
- Prototype branch: https://github.com/bacoords/create-block-theme/tree/add/cli-export-command
- WP-CLI Commands Cookbook: https://make.wordpress.org/cli/handbook/guides/commands-cookbook/
Open to discussion on scope, sequencing, and naming before any PRs are opened.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with sub-issue #829 and the REST handlers named in this tracking issue, rest_save_theme and rest_export_theme, under includes/create-theme/. Review the proposed sequence and PHPUnit coverage requirements; the tracking work is done when the relevant service extraction or CLI sub-issue is completed without taking the listed out-of-scope commands into v1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend-api-design, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100