Part of #828 (which fulfills #688). Depends on the CBT_Theme_Save service refactor tracked in #828.
Goal
Expose the CBT_Theme_Save service as a WP-CLI subcommand so developers can persist Editor changes to disk from the terminal.
Scope
New file: includes/cli/class-cbt-cli-command.php
New class: CBT_CLI_Command extending WP_CLI_Command, with a save method.
Registration (in includes/class-create-block-theme.php):
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once plugin_dir_path( __DIR__ ) . 'includes/cli/class-cbt-cli-command.php';
WP_CLI::add_command( 'cbt', 'CBT_CLI_Command' );
}
CLI surface
wp cbt save [--fonts] [--templates] [--styles] [--patterns]
[--all] [--only-modified-templates] [--dry-run]
- Flags are kebab-case publicly; the command translates internally to the
saveFonts / saveTemplates / etc. keys the service expects
--all is a convenience for "save everything"
--only-modified-templates maps to processOnlySavedTemplates
--dry-run reports what would change without writing
Required behavior
- Guard with
wp_is_block_theme() — WP_CLI::error() if not, mirroring the plugin UI gate documented in AGENTS.md
WP_CLI::error() if no save flag is passed (no silent no-op success)
- All user-facing strings i18n'd via
__( ..., 'create-block-theme' )
- PHPDoc with shortdesc, full
## OPTIONS, and at least two ## EXAMPLES
- Translate
WP_Error from the service into WP_CLI::error()
Tests
PHPUnit tests against the command class (the service itself is covered in its own issue):
- Flag normalization (kebab-case → service options)
- Guard fires on non-block themes
- Empty invocation produces an error
Out of scope
Acceptance
- Manual smoke test: install plugin in a Studio site, run each flag combination against a block theme
wp help cbt save displays the documented options and examples
lint:php, test:php, test:unit all green
Part of #828 (which fulfills #688). Depends on the
CBT_Theme_Saveservice refactor tracked in #828.Goal
Expose the
CBT_Theme_Saveservice as a WP-CLI subcommand so developers can persist Editor changes to disk from the terminal.Scope
New file:
includes/cli/class-cbt-cli-command.phpNew class:
CBT_CLI_CommandextendingWP_CLI_Command, with asavemethod.Registration (in
includes/class-create-block-theme.php):CLI surface
saveFonts/saveTemplates/ etc. keys the service expects--allis a convenience for "save everything"--only-modified-templatesmaps toprocessOnlySavedTemplates--dry-runreports what would change without writingRequired behavior
wp_is_block_theme()—WP_CLI::error()if not, mirroring the plugin UI gate documented in AGENTS.mdWP_CLI::error()if no save flag is passed (no silent no-op success)__( ..., 'create-block-theme' )## OPTIONS, and at least two## EXAMPLESWP_Errorfrom the service intoWP_CLI::error()Tests
PHPUnit tests against the command class (the service itself is covered in its own issue):
Out of scope
wp cbt export— separate issue tracked in [Tracking] WP-CLI support: phased implementation #828Acceptance
wp help cbt savedisplays the documented options and exampleslint:php,test:php,test:unitall green