Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Adds wp package get <package> command to retrieve information about a single installed package. Previously, users had to parse wp package list output to get package details.

Changes

  • New command: Package_Command::get() retrieves package metadata (name, authors, version, update status)
  • Field filtering: --fields parameter to select specific fields
  • Format support: --format parameter for table, json, yaml, csv output
  • Command registration: Added to composer.json commands list
  • Test coverage: Behat scenarios for error handling, field filtering, and format options

Usage

# Get all package information
$ wp package get wp-cli/server-command
+-----------------+----------------------+
| Field           | Value                |
+-----------------+----------------------+
| name            | wp-cli/server-command|
| authors         | Daniel Bachhuber     |
| version         | dev-main             |
| update          | none                 |
+-----------------+----------------------+

# Get specific field as JSON
$ wp package get wp-cli/server-command --fields=version --format=json
{"version":"dev-main"}

Implementation reuses existing get_installed_package_by_name() and find_latest_package() methods for consistency with wp package list.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add command to get information about single package</issue_title>
<issue_description>As suggested in wp-cli/i18n-command#53 (comment), there could be a new wp package version command to get the version of a single command.

Perhaps this could also just be wp package get <package> [--fields=<fields>] so one can easily get any specific field for a package.

Ideally we abstract the code in such a way that a single package is able to get its own version using that way.</issue_description>

Comments on the Issue (you are @copilot in this section)

@schlessera That is non-trivial. Inside of the code, the versions don't exist. We can only fetch and store them during the Composer build phase, which means adding something like https://github.com/Ocramius/PackageVersions @schlessera Once we force Composer v2+ as a dependency here, we can move forward with this, as the above mentioned `PackageVersions` package is now a direct part of Composer from v2 onwards. @schlessera @gilzow Right now we allow for both v1 and v2 of Composer to be used, and the built Phar already defaults to v2. It might be feasible to phase out v1 with WP-CLI v3, but we'll have to see at that point what the installation numbers are.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 19, 2026 10:20
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add command to get information about a single package Add wp package get command to retrieve single package information Jan 19, 2026
Copilot AI requested a review from swissspidy January 19, 2026 10:29
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 0% with 40 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Package_Command.php 0.00% 40 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review January 19, 2026 15:42
@swissspidy swissspidy requested a review from a team as a code owner January 19, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add command to get information about single package

2 participants