Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Implementation Plan for check-update Commands

Based on the issue requirements, I have successfully added check-update commands for plugins and themes, following the behavior of wp core check-update.

Requirements:

  • Add wp plugin check-update command ✅
  • Add wp theme check-update command ✅
  • Follow wp core check-update behavior (always returns exit code 0) ✅
  • Display success message when no updates available ✅
  • Display table of available updates when updates exist ✅

Implementation Checklist:

  • Explore repository structure and understand existing code
  • Implement check-update method in Plugin_Command class
  • Implement check-update method in Theme_Command class
  • Add commands to composer.json
  • Add feature tests for plugin check-update
  • Add feature tests for theme check-update
  • Run linter and fix any issues
  • Run code review
  • Run security checker
  • Add @subcommand annotations
  • Validate plugin/theme names using filter_item_list

Changes Made:

  1. Plugin_Command.php - Added check_update() method with full documentation and @subcommand check-update annotation

    • Validates plugin names using filter_item_list() to ensure errors for invalid names
    • Supports filtering by specific plugin names
    • Supports --all flag to check all plugins
    • Supports custom output formats (table, csv, json, yaml)
    • Supports custom field selection via --fields
    • Always returns exit code 0
  2. Theme_Command.php - Added check_update() method with full documentation and @subcommand check-update annotation

    • Validates theme names using filter_item_list() to ensure errors for invalid names
    • Supports filtering by specific theme names
    • Supports --all flag to check all themes
    • Supports custom output formats (table, csv, json, yaml)
    • Supports custom field selection via --fields
    • Always returns exit code 0
  3. composer.json - Registered new commands:

    • plugin check-update
    • theme check-update
  4. Feature Tests - Created comprehensive test coverage:

    • features/plugin-check-update.feature - 8 test scenarios (including invalid plugin validation)
    • features/theme-check-update.feature - 8 test scenarios (including invalid theme validation)

Command Examples:

# Check for plugin updates
$ wp plugin check-update
+-----------+--------+---------+----------------+
| name      | status | version | update_version |
+-----------+--------+---------+----------------+
| akismet   | active | 4.1.0   | 4.1.1          |
+-----------+--------+---------+----------------+

# Check for theme updates
$ wp theme check-update
+------------+----------+---------+----------------+
| name       | status   | version | update_version |
+------------+----------+---------+----------------+
| twentytwelve | inactive | 2.0   | 2.1            |
+------------+----------+---------+----------------+

# No updates available
$ wp plugin check-update
Success: All plugins are up to date.

# Invalid plugin name produces error
$ wp plugin check-update invalid-plugin
Error: The 'invalid-plugin' plugin could not be found.

# Check specific plugin
$ wp plugin check-update akismet

# Check all plugins
$ wp plugin check-update --all

# Output as JSON
$ wp plugin check-update --format=json

Notes:

  • Language pack check-update is handled by the language-command package (separate repository)
  • Exit code always returns 0 (matching core check-update behavior as specified by maintainer)
  • Commands filter for 'available' updates only (not 'unavailable' which indicates compatibility issues)
  • Implementation follows existing WP-CLI patterns and code style
  • Added @subcommand check-update annotations for proper command registration
  • Plugin/theme name validation now matches behavior of other commands (update, auto-updates, etc.)
Original prompt

This section details on the original issue you should resolve

<issue_title>Possibility to check-updates for plugins, themes and languages</issue_title>
<issue_description>I think it would be very helpful if there is a possibility to check if updates exist.
Thes feature is already implemented for the wp core:

https://developer.wordpress.org/cli/commands/core/check-update/

But there is no such a feature for plugins, themes and languagepacks.

Plugin parameter overview:

https://developer.wordpress.org/cli/commands/plugin/

Theme parameter overview:

https://developer.wordpress.org/cli/commands/theme/

Langauge parameter overview:

https://developer.wordpress.org/cli/commands/language/core/
https://developer.wordpress.org/cli/commands/language/plugin/
https://developer.wordpress.org/cli/commands/language/theme/

It would be also nice, if the check-update parameter provide returncodes.
Example:

wp plugin check-update -> no updates -> returncode = 0

wp core check-update -> update available -> returncode = 1

wp theme check-update -> unknown error -> returncode = 2

Thanks and Cheers

</issue_description>

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

@danielbachhuber Thanks for the suggestion, @MoBlockbuster !

I'm amenable to creating parity with wp core check-update. We'll want to follow its behavior, though:

$ wp core check-update
Success: WordPress is at the latest version.
$ echo $?
0
$ wp core check-update
+---------+-------------+-----------------------------------------------------------------------+
| version | update_type | package_url                                                           |
+---------+-------------+-----------------------------------------------------------------------+
| 6.1.4   | minor       | https://downloads.wordpress.org/release/wordpress-6.1.4-partial-0.zip |
| 6.4.1   | major       | https://downloads.wordpress.org/release/wordpress-6.4.1.zip           |
+---------+-------------+-----------------------------------------------------------------------+
$ echo $?
0

Notably, the return code is always 0, even when there are updates available.</comment_new>
<comment_new>@mrsdizzie
If you want to se if there are any plugin or theme updates (as in your example) this currently works and provides sort of similar information:

wp plugin list --update=available
wp theme list --update=available

I'm not familiar with languages but I think it works similarly:
wp language plugin list --all --update=available

I don't know if plugins can provide details on if something is a patch or major update since they all probably use different versioning.</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 8, 2025
Copilot AI and others added 2 commits November 8, 2025 16:24
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 possibility to check for updates on plugins, themes, and languages Add check-update commands for plugins and themes Nov 8, 2025
Copilot AI requested a review from swissspidy November 8, 2025 16:29
@swissspidy

This comment was marked as resolved.

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

This comment was marked as resolved.

@swissspidy swissspidy marked this pull request as ready for review November 10, 2025 15:38
@swissspidy swissspidy requested a review from a team as a code owner November 10, 2025 15:38
@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 95.83333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Plugin_Command.php 96.66% 1 Missing ⚠️
src/Theme_Command.php 94.44% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added this to the 2.3.0 milestone Nov 11, 2025
@swissspidy swissspidy added command:plugin Related to 'plugin' command command:theme Related to 'theme' command labels Dec 12, 2025
@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Use filter_item_list() to validate plugin and theme names before checking for updates. This ensures that invalid names produce errors instead of silent success messages, consistent with other commands like update and auto-updates.

Also added test scenarios to verify error handling for invalid plugin/theme names.

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

Labels

command:plugin Related to 'plugin' command command:theme Related to 'theme' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possibility to check-updates for plugins, themes and languages

2 participants