From b834dedb40341c8cdb03ae604cb556d94c857810 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Fri, 15 Aug 2025 00:53:58 +0300 Subject: [PATCH 1/3] chore: align reqs with WP6.9 --- CONTRIBUTING.md | 4 ++-- abilities-api.php | 4 ++-- ...lass-wp-rest-abilities-list-controller.php | 20 ++++++++-------- ...class-wp-rest-abilities-run-controller.php | 24 +++++++++---------- phpcs.xml.dist | 16 ++++++------- phpstan.neon.dist | 2 +- 6 files changed, 34 insertions(+), 36 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a1a79792..d0fae282 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,10 +10,10 @@ Join the `#core-ai` channel [on WordPress Slack](http://wordpress.slack.com) ([s ## Coding standards -In general, all code must follow the [WordPress Coding Standards and best practices](https://developer.wordpress.org/coding-standards/). All code in the Performance Lab plugin must follow these requirements: +In general, all code must follow the [WordPress Coding Standards and best practices](https://developer.wordpress.org/coding-standards/). All code in the Abilities API plugin must follow these requirements: - **WordPress**: As of Performance Lab v0.0.1, released {@todo}, the plugin's minimum WordPress version requirement is 6.7. -- **PHP**: The minimum required version right now is 7.4. This is subject to change and will be brought in sync with the WordPress core minimum PHP version requirement closer to release. +- **PHP**: The minimum required version of the code slated for WordPress Core includes is PHP7.2, but the tooling and development environment requires PHP 7.4 or higher. We include [several tools](#useful-commands) to help ensure your code meets contribution diff --git a/abilities-api.php b/abilities-api.php index 2ae5bed0..e89ebfc7 100644 --- a/abilities-api.php +++ b/abilities-api.php @@ -11,9 +11,9 @@ * Plugin Name: Abilities API * Plugin URI: https://github.com/WordPress/abilities-api * Description: Provides a framework for registering and executing AI abilities in WordPress. - * Requires at least: 6.7 + * Requires at least: 6.8 * Version: 0.0.1 - * Requires PHP: 7.4 + * Requires PHP: 7.2 * Author: WordPress.org Contributors * Author URI: https://github.com/WordPress/abilities-api/graphs/contributors * License: GPLv2 or later diff --git a/includes/rest-api/endpoints/class-wp-rest-abilities-list-controller.php b/includes/rest-api/endpoints/class-wp-rest-abilities-list-controller.php index 2b4e9d19..d7f6ad8e 100644 --- a/includes/rest-api/endpoints/class-wp-rest-abilities-list-controller.php +++ b/includes/rest-api/endpoints/class-wp-rest-abilities-list-controller.php @@ -69,7 +69,7 @@ public function register_routes(): void { array( 'args' => array( 'name' => array( - 'description' => __( 'Unique identifier for the ability.', 'abilities-api' ), + 'description' => __( 'Unique identifier for the ability.' ), 'type' => 'string', 'pattern' => '^[a-zA-Z0-9\-\/]+$', ), @@ -152,7 +152,7 @@ public function get_item( $request ) { if ( ! $ability ) { return new \WP_Error( 'rest_ability_not_found', - __( 'Ability not found.', 'abilities-api' ), + __( 'Ability not found.' ), array( 'status' => 404 ) ); } @@ -233,37 +233,37 @@ public function get_item_schema(): array { 'type' => 'object', 'properties' => array( 'name' => array( - 'description' => __( 'Unique identifier for the ability.', 'abilities-api' ), + 'description' => __( 'Unique identifier for the ability.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'Display label for the ability.', 'abilities-api' ), + 'description' => __( 'Display label for the ability.' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Description of the ability.', 'abilities-api' ), + 'description' => __( 'Description of the ability.' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'input_schema' => array( - 'description' => __( 'JSON Schema for the ability input.', 'abilities-api' ), + 'description' => __( 'JSON Schema for the ability input.' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'output_schema' => array( - 'description' => __( 'JSON Schema for the ability output.', 'abilities-api' ), + 'description' => __( 'JSON Schema for the ability output.' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta' => array( - 'description' => __( 'Meta information about the ability.', 'abilities-api' ), + 'description' => __( 'Meta information about the ability.' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -286,7 +286,7 @@ public function get_collection_params(): array { return array( 'context' => $this->get_context_param( array( 'default' => 'view' ) ), 'page' => array( - 'description' => __( 'Current page of the collection.', 'abilities-api' ), + 'description' => __( 'Current page of the collection.' ), 'type' => 'integer', 'default' => 1, 'sanitize_callback' => 'absint', @@ -294,7 +294,7 @@ public function get_collection_params(): array { 'minimum' => 1, ), 'per_page' => array( - 'description' => __( 'Maximum number of items to be returned in result set.', 'abilities-api' ), + 'description' => __( 'Maximum number of items to be returned in result set.' ), 'type' => 'integer', 'default' => self::DEFAULT_PER_PAGE, 'minimum' => 1, diff --git a/includes/rest-api/endpoints/class-wp-rest-abilities-run-controller.php b/includes/rest-api/endpoints/class-wp-rest-abilities-run-controller.php index 02c67345..c29bebf4 100644 --- a/includes/rest-api/endpoints/class-wp-rest-abilities-run-controller.php +++ b/includes/rest-api/endpoints/class-wp-rest-abilities-run-controller.php @@ -47,7 +47,7 @@ public function register_routes(): void { array( 'args' => array( 'name' => array( - 'description' => __( 'Unique identifier for the ability.', 'abilities-api' ), + 'description' => __( 'Unique identifier for the ability.' ), 'type' => 'string', 'pattern' => '^[a-zA-Z0-9\-\/]+$', ), @@ -84,7 +84,7 @@ public function run_ability_with_method_check( $request ) { if ( ! $ability ) { return new \WP_Error( 'rest_ability_not_found', - __( 'Ability not found.', 'abilities-api' ), + __( 'Ability not found.' ), array( 'status' => 404 ) ); } @@ -97,7 +97,7 @@ public function run_ability_with_method_check( $request ) { if ( 'resource' === $type && 'GET' !== $method ) { return new \WP_Error( 'rest_invalid_method', - __( 'Resource abilities require GET method.', 'abilities-api' ), + __( 'Resource abilities require GET method.' ), array( 'status' => 405 ) ); } @@ -105,7 +105,7 @@ public function run_ability_with_method_check( $request ) { if ( 'tool' === $type && 'POST' !== $method ) { return new \WP_Error( 'rest_invalid_method', - __( 'Tool abilities require POST method.', 'abilities-api' ), + __( 'Tool abilities require POST method.' ), array( 'status' => 405 ) ); } @@ -127,7 +127,7 @@ public function run_ability( $request ) { if ( ! $ability ) { return new \WP_Error( 'rest_ability_not_found', - __( 'Ability not found.', 'abilities-api' ), + __( 'Ability not found.' ), array( 'status' => 404 ) ); } @@ -156,7 +156,7 @@ public function run_ability( $request ) { if ( is_null( $result ) ) { return new \WP_Error( 'rest_ability_execution_failed', - __( 'Ability execution failed. Please check permissions and input parameters.', 'abilities-api' ), + __( 'Ability execution failed. Please check permissions and input parameters.' ), array( 'status' => 500 ) ); } @@ -183,7 +183,7 @@ public function run_ability_permissions_check( $request ) { if ( ! $ability ) { return new \WP_Error( 'rest_ability_not_found', - __( 'Ability not found.', 'abilities-api' ), + __( 'Ability not found.' ), array( 'status' => 404 ) ); } @@ -193,7 +193,7 @@ public function run_ability_permissions_check( $request ) { if ( ! $ability->has_permission( $input ) ) { return new \WP_Error( 'rest_cannot_execute', - __( 'Sorry, you are not allowed to execute this ability.', 'abilities-api' ), + __( 'Sorry, you are not allowed to execute this ability.' ), array( 'status' => rest_authorization_required_code() ) ); } @@ -223,7 +223,7 @@ private function validate_input( $ability, $input ) { 'rest_invalid_param', sprintf( /* translators: %s: error message */ - __( 'Invalid input parameters: %s', 'abilities-api' ), + __( 'Invalid input parameters: %s' ), $validation_result->get_error_message() ), array( 'status' => 400 ) @@ -255,7 +255,7 @@ private function validate_output( $ability, $output ) { 'rest_invalid_response', sprintf( /* translators: %s: error message */ - __( 'Invalid response from ability: %s', 'abilities-api' ), + __( 'Invalid response from ability: %s' ), $validation_result->get_error_message() ), array( 'status' => 500 ) @@ -299,7 +299,7 @@ private function get_input_from_request( $request ) { public function get_run_args(): array { return array( 'input' => array( - 'description' => __( 'Input parameters for the ability execution.', 'abilities-api' ), + 'description' => __( 'Input parameters for the ability execution.' ), 'type' => 'object', 'default' => array(), ), @@ -320,7 +320,7 @@ public function get_run_schema(): array { 'type' => 'object', 'properties' => array( 'result' => array( - 'description' => __( 'The result of the ability execution.', 'abilities-api' ), + 'description' => __( 'The result of the ability execution.' ), 'type' => 'mixed', 'context' => array( 'view' ), 'readonly' => true, diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 79789aec..05730e7b 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -41,13 +41,13 @@ Tests for PHP version compatibility. https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards#Recomended-additional-rulesets --> - + - + - + @@ -196,12 +195,11 @@ - - + - + @@ -209,8 +207,8 @@ - - + + diff --git a/phpstan.neon.dist b/phpstan.neon.dist index e26cb93a..5d52d6d5 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -15,7 +15,7 @@ parameters: # Configuration level: 8 phpVersion: - min: 70400 + min: 70200 max: 80300 bootstrapFiles: - abilities-api.php From 53413bcb14a01bdbeed629802130133bae8f7615 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Fri, 15 Aug 2025 01:02:13 +0300 Subject: [PATCH 2/3] ci: remove from test --- .github/workflows/test.yml | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b7eb83f4..5c4a9861 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -178,7 +178,7 @@ jobs: strategy: matrix: php: ['8.4', '8.3', '8.2', '8.1', '8.0', '7.4'] - wp: [latest, trunk, '6.7'] + wp: [latest, trunk ] coverage: [false] include: - php: '8.4' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d0fae282..c453e184 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ Join the `#core-ai` channel [on WordPress Slack](http://wordpress.slack.com) ([s In general, all code must follow the [WordPress Coding Standards and best practices](https://developer.wordpress.org/coding-standards/). All code in the Abilities API plugin must follow these requirements: -- **WordPress**: As of Performance Lab v0.0.1, released {@todo}, the plugin's minimum WordPress version requirement is 6.7. +- **WordPress**: The plugin's minimum WordPress version requirement is 6.8. - **PHP**: The minimum required version of the code slated for WordPress Core includes is PHP7.2, but the tooling and development environment requires PHP 7.4 or higher. We include [several tools](#useful-commands) to help ensure your code meets contribution From c92e1cb3729ca7e9684f228d01899b2891ce02fb Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 16 Aug 2025 14:28:46 +0300 Subject: [PATCH 3/3] chore: align version numbers to 0.1.0 --- abilities-api.php | 4 ++-- composer.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/abilities-api.php b/abilities-api.php index e89ebfc7..d38f481a 100644 --- a/abilities-api.php +++ b/abilities-api.php @@ -12,7 +12,7 @@ * Plugin URI: https://github.com/WordPress/abilities-api * Description: Provides a framework for registering and executing AI abilities in WordPress. * Requires at least: 6.8 - * Version: 0.0.1 + * Version: 0.1.0 * Requires PHP: 7.2 * Author: WordPress.org Contributors * Author URI: https://github.com/WordPress/abilities-api/graphs/contributors @@ -29,7 +29,7 @@ /** * Version of the plugin. */ -define( 'WP_ABILITIES_API_VERSION', '0.0.1' ); +define( 'WP_ABILITIES_API_VERSION', '0.1.0' ); /** * First the WP_Ability class that users can extend. diff --git a/composer.json b/composer.json index 5cc51ecf..72c9750d 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,7 @@ "description": "AI Abilities for WordPress", "license": "GPL-2.0-or-later", "type": "wordpress-plugin", + "version": "0.1.0", "keywords": [ "ai", "llm",