Part of #828 (which fulfills #688). Depends on the CBT_Theme_Export service refactor tracked in #828, and reuses the CBT_CLI_Command class introduced for wp cbt save.
Goal
Expose the CBT_Theme_Export service as a WP-CLI subcommand so developers can produce a theme zip from the terminal.
Scope
Add an export method to CBT_CLI_Command. No new file.
CLI surface
wp cbt export <output-path> [--include-images]
[--export-ready]
[--translate-ready]
- Positional
<output-path> — required, must be writable
- Flag names align with the existing CBT export option labels
- Progress reporting via
WP_CLI\Utils\make_progress_bar() for image bundling
Required behavior
wp_is_block_theme() guard — WP_CLI::error() if not
- Reject
<output-path> if the parent directory does not exist or is not writable, with a clear WP_CLI::error() message
- All user-facing strings i18n'd
- PHPDoc with shortdesc,
## OPTIONS, ## EXAMPLES
Tests
- Output path validation (non-existent dir, non-writable dir, dir vs file)
- Flag normalization
- Block theme guard
Out of scope
--directory (unzipped) output — possible follow-up
- Variation / clone / blank export — possible follow-up
- Custom theme metadata overrides at export time
Acceptance
- Manual smoke test:
wp cbt export /tmp/my-theme.zip --include-images against a real block theme in Studio
wp help cbt export 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_Exportservice refactor tracked in #828, and reuses theCBT_CLI_Commandclass introduced forwp cbt save.Goal
Expose the
CBT_Theme_Exportservice as a WP-CLI subcommand so developers can produce a theme zip from the terminal.Scope
Add an
exportmethod toCBT_CLI_Command. No new file.CLI surface
<output-path>— required, must be writableWP_CLI\Utils\make_progress_bar()for image bundlingRequired behavior
wp_is_block_theme()guard —WP_CLI::error()if not<output-path>if the parent directory does not exist or is not writable, with a clearWP_CLI::error()message## OPTIONS,## EXAMPLESTests
Out of scope
--directory(unzipped) output — possible follow-upAcceptance
wp cbt export /tmp/my-theme.zip --include-imagesagainst a real block theme in Studiowp help cbt exportdisplays the documented options and exampleslint:php,test:php,test:unitall green