Skip to content

Feature: Add wp cbt export CLI command #832

@bph

Description

@bph

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestwp-clihandling wp-cli commands in this plugin

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions