diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d3f530..87b0fee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.8.0] - 2026-08-21 + +### Changed + +- **`wp pattern validate` is now `wp imagewize pattern-validate`.** The + command claimed an unprefixed global WP-CLI namespace (`pattern`), which is + generic enough that publishing it as a standalone WP-CLI package would risk + colliding with someone else's command. Renamed ahead of publishing rather + than after, since a post-release rename is a breaking change. Updated + everywhere the old name was documented: `README.md`, `CLAUDE.md`, + `docs/bedrock/README.md`, `docs/bedrock/wp-cli-config/README.md`, and + `docs/category-organization.md`. + ## [5.7.1] - 2026-08-21 ### Fixed diff --git a/CLAUDE.md b/CLAUDE.md index b582420..d1140c0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,7 +15,7 @@ This is a collection of tools, scripts, and documentation for WordPress operatio - `trellis/security/` - fail2ban WordPress protection and manual IP blocking guides - `trellis/updater/` - Safe Trellis update scripts - **wp-cli/** - WordPress command-line operations - - `wp-cli/content-creation/` - WP-CLI content creation, block patterns, and the `wp pattern validate` command + - `wp-cli/content-creation/` - WP-CLI content creation, block patterns, and the `wp imagewize pattern-validate` command - `wp-cli/diagnostics/` - WordPress diagnostic tools - `wp-cli/migration/` - WordPress migration documentation and URL update methods - `wp-cli/security/` - Malware detection and security scanning diff --git a/README.md b/README.md index d8d871b..f105f43 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ invocation instead of failing. This table is generated from the catalog; | Tool | Description | Docs | |------|-------------|------| | **Local Package Development** | Test an in-development plugin/theme branch in a Bedrock site via a Composer `path` repository, before tagging a release | [→](docs/bedrock/local-package-development/README.md) | -| **WP-CLI Config** | Standard `wp-cli.yml` for Bedrock path setup plus a `wp pattern validate` command for canonicalizing block pattern files | [→](docs/bedrock/wp-cli-config/README.md) | +| **WP-CLI Config** | Standard `wp-cli.yml` for Bedrock path setup plus a `wp imagewize pattern-validate` command for canonicalizing block pattern files | [→](docs/bedrock/wp-cli-config/README.md) | ## WP-CLI diff --git a/docs/bedrock/README.md b/docs/bedrock/README.md index a11f1dd..3b74566 100644 --- a/docs/bedrock/README.md +++ b/docs/bedrock/README.md @@ -10,4 +10,4 @@ Test an in-development plugin or theme inside a Bedrock site before tagging a re ### [`wp-cli-config/`](wp-cli-config/) -Standard `wp-cli.yml` for Bedrock (sets `path: web/wp` so `--path` is never needed) plus a custom `wp pattern validate` command that round-trips block pattern files through WordPress's own parser to enforce canonical formatting. +Standard `wp-cli.yml` for Bedrock (sets `path: web/wp` so `--path` is never needed) plus a custom `wp imagewize pattern-validate` command that round-trips block pattern files through WordPress's own parser to enforce canonical formatting. diff --git a/docs/bedrock/wp-cli-config/README.md b/docs/bedrock/wp-cli-config/README.md index bb2ac7f..fa4c327 100644 --- a/docs/bedrock/wp-cli-config/README.md +++ b/docs/bedrock/wp-cli-config/README.md @@ -1,7 +1,7 @@ # Bedrock WP-CLI Configuration Standard `wp-cli.yml` for a [Bedrock](https://roots.io/bedrock/) site plus a custom -`wp pattern validate` command for keeping block pattern files in canonical form. +`wp imagewize pattern-validate` command for keeping block pattern files in canonical form. Place both files in your **Bedrock site root** (the directory that contains `composer.json`). @@ -21,7 +21,7 @@ require: |-----|---------| | `path` | Tells WP-CLI where WordPress core lives in a Bedrock layout — saves you `--path=web/wp` on every command | | `server.docroot` | Used by `wp server` (built-in dev server) to serve from Bedrock's public root | -| `require` | Auto-loads `wp-cli-pattern-validate.php` on every `wp` call so the `pattern validate` command is always available without an explicit `--require` flag | +| `require` | Auto-loads `wp-cli-pattern-validate.php` on every `wp` call so the `imagewize pattern-validate` command is always available without an explicit `--require` flag | --- @@ -46,31 +46,31 @@ across a block theme's `patterns/` directory in CI or as a pre-commit check. ```bash # Validate all patterns — dry run, shows PASS/FAIL per file -wp pattern validate web/app/themes/your-theme/patterns/ +wp imagewize pattern-validate web/app/themes/your-theme/patterns/ # Show a unified diff for each file that needs changes (no writes) -wp pattern validate web/app/themes/your-theme/patterns/ --diff +wp imagewize pattern-validate web/app/themes/your-theme/patterns/ --diff # Auto-fix all structural issues in-place -wp pattern validate web/app/themes/your-theme/patterns/ --fix +wp imagewize pattern-validate web/app/themes/your-theme/patterns/ --fix # Fix and save per-file diff logs + a summary to docs/pattern-logs// -wp pattern validate web/app/themes/your-theme/patterns/ --fix --log +wp imagewize pattern-validate web/app/themes/your-theme/patterns/ --fix --log # Override the log output directory -wp pattern validate web/app/themes/your-theme/patterns/ --fix --log --log-dir=/tmp/pattern-logs +wp imagewize pattern-validate web/app/themes/your-theme/patterns/ --fix --log --log-dir=/tmp/pattern-logs # Validate a single file -wp pattern validate web/app/themes/your-theme/patterns/hero.php --fix +wp imagewize pattern-validate web/app/themes/your-theme/patterns/hero.php --fix # Validate a subdirectory only -wp pattern validate web/app/themes/your-theme/patterns/woocommerce/ --fix +wp imagewize pattern-validate web/app/themes/your-theme/patterns/woocommerce/ --fix ``` If `wp-cli-pattern-validate.php` is **not** auto-loaded via `wp-cli.yml`, pass it explicitly: ```bash -wp --require=wp-cli-pattern-validate.php pattern validate web/app/themes/your-theme/patterns/ +wp --require=wp-cli-pattern-validate.php imagewize pattern-validate web/app/themes/your-theme/patterns/ ``` **Via wp-ops:** runnable straight from the wp-ops checkout (no copying required) — set `WP_SITE_DIR` to your Bedrock site root: `WP_SITE_DIR=/path/to/site wp-ops bedrock wp-cli-pattern-validate web/app/themes/your-theme/patterns/ --fix`. See [`wp-ops`](../../../README.md). diff --git a/docs/category-organization.md b/docs/category-organization.md index 279bb21..b994bc2 100644 --- a/docs/category-organization.md +++ b/docs/category-organization.md @@ -313,7 +313,7 @@ nothing there. Only inbound `.md` cross-links (23 files reference `nginx/` or `troubleshooting/`) and the dead `Categories` entries need touching. `bedrock/` is a genuine edge case: 1 command, 3 docs. Its one command -(`wp pattern validate`) is arguably a `wp-cli/` command, after which the whole +(`wp imagewize pattern-validate`) is arguably a `wp-cli/` command, after which the whole tree is documentation too. **Your instinct that `bedrock` belongs under docs is right** — it's the one directory where the reorganization is unambiguous. diff --git a/docs/wp-cli-package-evaluation.md b/docs/wp-cli-package-evaluation.md index 3375919..46abf72 100644 --- a/docs/wp-cli-package-evaluation.md +++ b/docs/wp-cli-package-evaluation.md @@ -1,6 +1,7 @@ # Publishing wp-ops WordPress tools as a WP-CLI package -**Status:** evaluation, nothing implemented. +**Status:** step 1 of 3 shipped (the command is namespaced); extraction and +publishing not started. **Date:** 2026-08-21. **Supersedes:** the Mistral draft of the same filename, whose compatibility table was largely fabricated. [Corrections](#corrections-to-the-previous-draft) @@ -106,17 +107,13 @@ one command as a proof of concept. a `composer.json` with `"type": "wp-cli-package"`, a repo, and a tag. That is the whole job. -One thing to fix first. The command currently claims an unprefixed global -namespace: - -```php -WP_CLI::add_command( 'pattern validate', ... ); // line 401 -``` - -`pattern` is generic enough that a published package squatting it will collide -with something. Namespace it before publishing — `wp imagewize pattern-validate` -or similar. Renaming after release is a breaking change; renaming now costs one -line. +**Namespaced.** The command claimed an unprefixed global namespace — +`WP_CLI::add_command( 'pattern validate', ... )` — and `pattern` is generic +enough that a published package squatting it would collide with something. +It's now `wp imagewize pattern-validate`, updated everywhere the old name was +documented (`README.md`, `CLAUDE.md`, `docs/bedrock/`, +`docs/category-organization.md`). Done ahead of publishing rather than after, +since renaming post-release is a breaking change. --- @@ -148,8 +145,8 @@ standalone scripts, never as a rewrite of them. **Ship one package, measure, then decide.** -1. Rename `pattern validate` to a namespaced command. One line, do it - regardless of whether anything is published. +1. ~~Rename `pattern validate` to a namespaced command.~~ Done — it's now + `wp imagewize pattern-validate`. 2. Extract `wp-cli-pattern-validate.php` into its own small repo with a `wp-cli-package` `composer.json`. It works unmodified. 3. Publish, and see whether it gets installs. If it does, the next candidate @@ -171,7 +168,7 @@ at lower cost. | Task | Estimate | | --- | --- | -| Namespace the `pattern validate` command | 15 min | +| ~~Namespace the `pattern validate` command~~ | ~~15 min~~ done | | New repo, `composer.json`, README, tag | 2–3 hrs | | Optional: Behat harness via `wp scaffold package-tests` | 4–8 hrs | | **Realistic total for the proof of concept** | **under a day** | diff --git a/wp-cli/content-creation/wp-cli-pattern-validate.php b/wp-cli/content-creation/wp-cli-pattern-validate.php index fec1ddf..4fcb29e 100644 --- a/wp-cli/content-creation/wp-cli-pattern-validate.php +++ b/wp-cli/content-creation/wp-cli-pattern-validate.php @@ -15,25 +15,25 @@ * ## EXAMPLES * * # Validate all patterns (dry run, shows what would change) - * wp pattern validate web/app/themes/your-theme/patterns/ + * wp imagewize pattern-validate web/app/themes/your-theme/patterns/ * * # Show unified diff without fixing - * wp pattern validate web/app/themes/your-theme/patterns/ --diff + * wp imagewize pattern-validate web/app/themes/your-theme/patterns/ --diff * * # Auto-fix all structural issues in-place - * wp pattern validate web/app/themes/your-theme/patterns/ --fix + * wp imagewize pattern-validate web/app/themes/your-theme/patterns/ --fix * * # Fix and write logs to docs/pattern-logs/ - * wp pattern validate web/app/themes/your-theme/patterns/ --fix --log + * wp imagewize pattern-validate web/app/themes/your-theme/patterns/ --fix --log * * # Fix a single file - * wp pattern validate web/app/themes/your-theme/patterns/hero.php --fix + * wp imagewize pattern-validate web/app/themes/your-theme/patterns/hero.php --fix * * # Fix a subdirectory only - * wp pattern validate web/app/themes/your-theme/patterns/woocommerce/ --fix + * wp imagewize pattern-validate web/app/themes/your-theme/patterns/woocommerce/ --fix * * # If not auto-required via wp-cli.yml, pass --require explicitly: - * wp --require=wp-cli-pattern-validate.php pattern validate web/app/themes/your-theme/patterns/ + * wp --require=wp-cli-pattern-validate.php imagewize pattern-validate web/app/themes/your-theme/patterns/ * * @desc Validate/fix block pattern files by round-tripping through parse_blocks()/serialize_blocks() * @category content @@ -398,4 +398,4 @@ private function run_compliance_checks( $files, $fix ) { } $_cmd = new Pattern_Validate_Command(); -WP_CLI::add_command( 'pattern validate', array( $_cmd, 'validate' ) ); +WP_CLI::add_command( 'imagewize pattern-validate', array( $_cmd, 'validate' ) );