You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Include command assets and exclude dev-only Symfony packages in Phar builds - #1219
Fixes two Phar packaging issues exposed after releasing wp-cli/i18n-command v3.1.0 and wp-cli/package-command v3.1.0:
Include bundled command assets/ directories in non-CLI Phar builds
wp-cli/i18n-command relies on assets/block-i18n.json and assets/theme-i18n.json as offline fallbacks when remote schemas cannot be downloaded (tested in wp-cli/i18n-command#519).
utils/make-phar.php previously only packaged vendor/wp-cli/*-command/templates, causing all three i18n-command Phar jobs in wp-cli/automated-tests to fail on makepot.feature:3476.
Adds vendor/wp-cli/*-command/assets (guarded via glob( ..., GLOB_ONLYDIR )) for non-CLI builds.
Exclude dev-only vendor/symfony/* from the Phar when composer/composer is absent
With wp-cli/package-command v3.1.0 (wp-cli/package-command#248), no runtime package in wp-cli/wp-cli-bundle depends on any symfony/* package anymore — all 20 locked symfony/* packages are in packages-dev only.
utils/make-phar.php was still unconditionally bundling 209 dev-only files from vendor/symfony/ (console, filesystem, finder, string, polyfill-*, etc.) into the Phar.
Guards ->in( WP_CLI_VENDOR_DIR . '/symfony' ) behind is_dir( WP_CLI_VENDOR_DIR . '/composer/composer' ) and strips all /symfony/ entries from autoload_*.php when composer/composer is absent, shrinking the built Phar from ~6.8 MB to ~5.6 MB while preserving backwards compatibility with older package-command<3.1.0.
Adds regression scenarios to features/make-phar.feature covering both changes.
Summary by CodeRabbit
Bug Fixes
Phar packaging now includes bundled internationalization command assets and avoids including files from the Symfony vendor directory.
Non-CLI builds now include assets directories from command packages.
No actionable comments were generated in the recent review.
Walkthrough
The Phar builder now adjusts Symfony vendor handling based on the Composer installation and includes command asset directories in non-CLI builds. New feature scenarios check for bundled i18n JSON assets and the absence of Symfony vendor paths.
The builder adjusts Symfony autoload-map filtering based on whether composer/composer exists. It replaces the unconditional Composer vendor scan with a Symfony scan that runs only when both required directories exist. A scenario checks that the Phar contains no /vendor/symfony/ paths.
Non-CLI builds add existing assets directories matched under wp-cli/*-command to the Finder. A scenario checks that the Phar contains block-i18n.json and theme-i18n.json.
The change adjusts which files go into the Phar: it bundles command assets and drops dev-only Symfony packages when Composer is absent. No actionable merge-blocking risk was found, and the regression scenarios cover both changes.
Architecture risk: Low · up to 515c7
The change affects 2 systems.
Changed systems:utils, features
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — utils (service) was modified; 1 changed file maps to changed impact.
observed — features (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in features/make-phar.feature: Adds a scenario that creates a Phar and checks that both block-i18n.json and theme-i18n.json exist in its bundled i18n-command assets; the expected output is present.
observed — Modified behavior in features/make-phar.feature: Adds a scenario that iterates through the Phar contents, counts paths containing /vendor/symfony/, and expects the count to be 0.
observed — Modified behavior in utils/make-phar.php: The CLI-build autoload-map filter now uses a narrower Symfony pattern when composer/composer exists, and the broader Symfony-wide pattern otherwise.
observed — Modified behavior in utils/make-phar.php: The non-CLI autoload-map filter now uses a narrower Symfony pattern when composer/composer exists, and the broader Symfony-wide pattern otherwise.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names both main changes in the PR: adding command assets to non-CLI Phar builds and excluding dev-only Symfony packages when composer/composer is absent. The summary and objectives confirm b…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names both main changes in the PR: adding command assets to non-CLI Phar builds and excluding dev-only Symfony packages when composer/composer is absent. The summary and objectives confirm both changes, and the regression scenarios in features/make-phar.feature cover them. The title is specific and concise.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 65c50a47-9cd7-4efb-8eff-a3d1bc78bf04
Commits
Reviewing files that changed from the base of the PR and between 4bc3ca0 and 515c7d9.
Files selected for processing: 2
features/make-phar.feature
utils/make-phar.php
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two Phar packaging issues exposed after releasing
wp-cli/i18n-commandv3.1.0 andwp-cli/package-commandv3.1.0:Include bundled command
assets/directories in non-CLI Phar buildswp-cli/i18n-commandrelies onassets/block-i18n.jsonandassets/theme-i18n.jsonas offline fallbacks when remote schemas cannot be downloaded (tested inwp-cli/i18n-command#519).utils/make-phar.phppreviously only packagedvendor/wp-cli/*-command/templates, causing all threei18n-commandPhar jobs inwp-cli/automated-teststo fail onmakepot.feature:3476.vendor/wp-cli/*-command/assets(guarded viaglob( ..., GLOB_ONLYDIR )) for non-CLI builds.Exclude dev-only
vendor/symfony/*from the Phar whencomposer/composeris absentwp-cli/package-commandv3.1.0 (wp-cli/package-command#248), no runtime package inwp-cli/wp-cli-bundledepends on anysymfony/*package anymore — all 20 lockedsymfony/*packages are inpackages-devonly.utils/make-phar.phpwas still unconditionally bundling 209 dev-only files fromvendor/symfony/(console,filesystem,finder,string,polyfill-*, etc.) into the Phar.->in( WP_CLI_VENDOR_DIR . '/symfony' )behindis_dir( WP_CLI_VENDOR_DIR . '/composer/composer' )and strips all/symfony/entries fromautoload_*.phpwhencomposer/composeris absent, shrinking the built Phar from ~6.8 MB to ~5.6 MB while preserving backwards compatibility with olderpackage-command<3.1.0.Adds regression scenarios to
features/make-phar.featurecovering both changes.Summary by CodeRabbit