Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Implementation Complete ✅

Successfully implemented the wp package get command as requested in issue #200.

Summary of Changes

  • Added Package_Command::get() method to retrieve single package information
  • Registered package get as a new subcommand in composer.json
  • Added comprehensive Behat tests covering all functionality
  • Full PHPDoc documentation with examples
  • Support for --fields parameter to filter output
  • Support for --format parameter (table, json, yaml, csv)
  • Support for --skip-update-check flag with test coverage
  • Error handling for non-installed packages
  • Consistent with existing list command patterns
  • All quality checks passed (lint, phpcs, phpstan, codeql)
  • Test cleanup added to match other test scenarios

Features Implemented

Command: wp package get <package> [--fields=<fields>] [--format=<format>] [--skip-update-check]

Available Fields:

  • name - Package name
  • authors - Package authors
  • version - Currently installed version
  • update - Update status (none, available, error)
  • update_version - Version available for update
  • description - Package description (optional)

Example Usage:

# Get all package information
wp package get wp-cli/server-command

# Get just the version
wp package get wp-cli/server-command --fields=version --format=json

# Get multiple fields without update check
wp package get wp-cli/server-command --fields=name,version --skip-update-check

Testing

  • ✅ Linting passed
  • ✅ Code style (PHPCS) passed
  • ✅ Static analysis (PHPStan) passed
  • ✅ Security scan (CodeQL) passed
  • ✅ Behat tests added (will run in CI)
  • ✅ Code follows existing patterns
  • ✅ Test coverage for --skip-update-check flag added
  • ✅ Test cleanup properly added to match other scenarios

Files Changed

  • composer.json (1 line): Register new command
  • features/package.feature (66 lines): Add comprehensive tests including --skip-update-check coverage and cleanup
  • src/Package_Command.php (103 lines): Implement get() method
  • README.md: Auto-generated documentation

Total: 170 lines added across 4 files

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
@github-actions github-actions bot added command:package Related to 'package' command scope:distribution Related to distribution state:unconfirmed command:package-get labels Jan 19, 2026
@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

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
@swissspidy swissspidy added this to the 2.6.2 milestone Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:package Related to 'package' command command:package-get scope:distribution Related to distribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add command to get information about single package

2 participants