extension-command icon indicating copy to clipboard operation
extension-command copied to clipboard

Add check-update commands for plugins and themes

Open Copilot opened this issue 3 months ago • 3 comments

Adds wp plugin check-update and wp theme check-update commands, providing parity with wp core check-update.

Implementation

Commands added:

  • wp plugin check-update [<plugin>...] [--all] [--fields=<fields>] [--format=<format>]
  • wp theme check-update [<theme>...] [--all] [--fields=<fields>] [--format=<format>]

Behavior:

  • Exit code 0 always (matches core check-update)
  • Success message when no updates available
  • Table output listing available updates (name, status, version, update_version)
  • Supports filtering by specific items or --all flag
  • Supports output formats: table, csv, json, yaml

Files modified:

  • src/Plugin_Command.php - Added check_update() method with @subcommand check-update annotation
  • src/Theme_Command.php - Added check_update() method with @subcommand check-update annotation
  • composer.json - Registered new commands

Tests:

  • features/plugin-check-update.feature - 7 scenarios
  • features/theme-check-update.feature - 7 scenarios

Example Usage

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

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

# Check specific items or all
$ wp plugin check-update akismet
$ wp theme check-update --all --format=json

Resolves #112

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>

  • Fixes wp-cli/extension-command#384

✨ 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 avatar Nov 08 '25 16:11 Copilot

@copilot you're missing the @subcommand check-update annotation for the two new subcommand methods.

swissspidy avatar Nov 09 '25 11:11 swissspidy

@copilot you're missing the @subcommand check-update annotation for the two new subcommand methods.

Added the @subcommand check-update annotation to both methods in commit 0f4b688.

Copilot avatar Nov 09 '25 11:11 Copilot

Codecov Report

:x: 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 :warning:
src/Theme_Command.php 94.44% 1 Missing :warning:

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar Nov 10 '25 15:11 codecov[bot]

/gemini review

swissspidy avatar Jan 20 '26 12:01 swissspidy