WordPress / WordPress/create-block-theme

Feature: Add wp cbt export CLI command

Open
#832 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement wp-cli
Dominant language
JavaScript
Stars
417
Forks
66
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CBT_CLI_Command class introduced for wp cbt save, and review the CBT_Theme_Export refactor in #828 before implementing the new entry point. Verify the listed output-path, flag, block-theme, i18n, PHPDoc, and progress requirements, then run the specified PHP lint and test commands and perform the documented WP-CLI smoke test.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.