Skip to content

Conversation

Copy link

Copilot AI commented Nov 10, 2025

Description

Implements WP-CLI commands for the Abilities API introduced in WordPress 6.9 - a unified registry of callable capabilities with defined inputs/outputs for AI integrations and automation.

Changes

Commands Added

wp ability

  • list - List registered abilities with filtering (e.g., --category=content)
  • get <name> - Show ability details (name, category, description, callback, schemas)
  • exists <name> - Check existence via wp_has_ability() (exit code 0/1)
  • execute <name> [<input>] - Execute with JSON input from arg or STDIN

wp ability category

  • list - List categories
  • get <name> - Show category details
  • exists <name> - Check existence (exit code 0/1)

Implementation Details

  • Version guard: before_invoke hook checks WP 6.9+ via Utils\wp_version_compare()
  • Fallback logic: Handles both direct API functions (wp_get_abilities()) and registry pattern (wp_abilities()->get_all())
  • Execute command: Tries wp_execute_ability() first, falls back to direct callback invocation
  • Standard formatting: --field, --fields, --format (table/csv/json/yaml/count) via WP_CLI\Formatter
  • Follows patterns from Post_Type_Command and Taxonomy_Command

Testing

Behat feature tests cover:

  • Version requirement enforcement (@less-than-wp-6.9)
  • All CRUD operations
  • JSON input via argument and STDIN
  • Error cases (non-existent abilities, invalid JSON)

Files Modified

  • src/Ability_Command.php - Main command (377 lines)
  • src/Ability_Category_Command.php - Category command (235 lines)
  • entity-command.php - Command registration
  • composer.json - Added 9 commands to manifest
  • features/ability.feature - Ability tests
  • features/ability-category.feature - Category tests

Example

# List abilities filtered by category
$ wp ability list --category=content --format=csv
name,category,description
get_post,content,Gets a post

# Execute with inline JSON
$ wp ability execute get_post '{"id": 1}'

# Execute with STDIN
$ echo '{"id": 1}' | wp ability execute get_post

Related

Resolves #<issue_number> (reference WordPress core: https://make.wordpress.org/ai/2025/07/17/abilities-api/)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/Behat/Behat/zipball/1b6b08efa995fe4135901b862d112adc7e95ecbb
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/Behat/Gherkin/zipball/05a7459283e8e6af0d46ec25b8bb5960ca3cfa7b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/8e89a01c7b8fed84a12a2a7f5a23a44cdbe4f62e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/8b8e17615d04f2fc2cd46fc1d2fd888fa21b3cf9
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/Hamddk /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/ff4efdd80e094a81fd6329b570c9a632f21d42b4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/134921bfca9b02d8f374c48381451da1d98402f9
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/Hamddk /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-parallel-lint/PHP-Console-Highlighter/zipball/5b4803384d3303cf8e84141039ef56c8a123138d
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6db563514f27e19595a19f45a4bf757b6401194e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/abeb5a8b58fda7ac21f15ee596f302f2959a7114
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/f94d246cc143ec5a23da868f8f7e1393b50eaa82
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/72a6721c9b64b3e4c9db55abbc38f790b318267e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/b564ca479e7e735f750aaac4935af965572a7845
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan/zipball/2770dcdf5078d0b0d53f94317e06affe88419aa8
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/complexity/zipball/bad4316aba5303d0221f43f8cee37eb58d384bbb
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/environment/zipball/24a711b5c916efc6d6e62aa65aa2ec98fef77f68
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/97ffee3bcfb5805568d6af7f0f893678fc076d2f
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a94ea4d26d865875803b23aaf78c3c2c670ea2ea
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/swissspidy/phpstan-no-private/zipball/f7a1890e350c8d8bf26370426a971d7490ae4245
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/console/zipball/c28ad91448f86c5f6d9d2c70f0cf68bf135f252a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/dependency-injection/zipball/98af8bb46c56aedd9dd5a7f0414fc72bf2dcfe69
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/event-dispatcher/zipball/b7dc69e71de420ac04bc9ab830cf3ffebba48191
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/finder/zipball/9f696d2f1e340484b4683f7853b273abff94421f
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/translation-contracts/zipball/65a8bc82080447fae78373aa10f8d13b38338977
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/translation/zipball/ec25870502d0c7072d086e8ffba1420c85965174
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/var-exporter/zipball/0f020b544a30a7fe8ba972e53ee48a74c0bc87f4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/yaml/zipball/90208e2fc6f68f613eae7ca25a2458a931b1bacc
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/7f8cfe992faa96b6a33bbd75c7bace98864161e7
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/cache-command/zipball/14f76b0bc8f9fa0a680e9c70e18fcf627774d055
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/db-command/zipball/c5277fe0335ea00c77b2790f2a892a692dfdf73c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/extension-command/zipball/cf68e1f3244a0a9557dd8cf4cc9fb03779b14678
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/media-command/zipball/a810ea0e68473fce6a234e67c6c5f19bb820a753
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/php-cli-tools/zipball/f12b650d3738e471baed6dd47982d53c5c0ab1c3
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/spyc/zipball/6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/super-admin-command/zipball/54ac063c384743ee414806d42cb8c61c6aa1fa8e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/wp-cli-tests/zipball/75b660dddaa9f512d104d93da4a0a3ede1183a93
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/wp-cli/wp-cli/zipball/ee4fb67b12eb904527bde1c4a0a4d6538a14681a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/VxutBp /usr/bin/composer install --no-interaction (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Abilities API support</issue_title>
<issue_description>The Abilities API introduced in WordPress 6.9 is a unified registry of callable WordPress capabilities with defined inputs and outputs, built for AI integrations and developer automation. See https://make.wordpress.org/ai/2025/07/17/abilities-api/ for the intro blog post.

Current code:

We want to make sure it works with WP-CLI out of the box. Conceptually that fits well into entity-command. I imagine commands such as:

  • wp ability list [--field=<field>] [--fields=<fields>] [--format=<format>] - list details about all abilities registered with wp_register_ability()
  • wp ability exists <name> - maps to wp_has_ability()
  • wp ability get <name>[--field=<field>] [--fields=<fields>] [--format=<format>] - show a specific ability instance retrieved via wp_get_ability()
  • wp ability execute <name> [<input>] - if input is omitted, the value is read from STDIN. We can probably simply expect a valid JSON string here.
  • wp ability category list [--field=<field>] [--fields=<fields>] [--format=<format>] - list categories
  • wp ability category exists <name> - whether a category exists
  • wp ability category get <name> [--field=<field>] [--fields=<fields>] [--format=<format>] - get an individual category

Filtering/querying abilities by categories will be added to core in the future, so we don't need to cover that for now.

Since this functionality is only available in 6.9+, we can add a before_invoke hook checking for the WordPress version.</issue_description>

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 10, 2025
Copilot AI and others added 3 commits November 10, 2025 11:12
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 support for Abilities API in WordPress Add WordPress 6.9+ Abilities API support Nov 10, 2025
Copilot AI requested a review from swissspidy November 10, 2025 11:21
Copilot finished work on behalf of swissspidy November 10, 2025 11:21
@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 2.96296% with 131 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Ability_Command.php 0.00% 77 Missing ⚠️
src/Ability_Category_Command.php 0.00% 40 Missing ⚠️
entity-command.php 22.22% 14 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review November 10, 2025 15:08
@swissspidy swissspidy requested a review from a team as a code owner November 10, 2025 15:08
@swissspidy swissspidy added this to the 2.9.0 milestone Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Abilities API support

2 participants