这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@justlevine
Copy link
Contributor

What

This PR updates compatibility with the initial v0.1.0 release of the abilities-api and cleans up the unnecessary boilerplate from the RegisterAbilityAs* factories.

More specifically, RegisterAbilityAs*::make() now takes the actual WP_Ability instead of the name, and internal factory methods have been made private. Methods/tests that are no longer necessary have been removed.

Why

https://github.com/WordPress/abilities-api/releases/tag/v0.1.0

@justlevine justlevine marked this pull request as ready for review August 29, 2025 13:50
Copilot AI review requested due to automatic review settings August 29, 2025 13:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates compatibility with the initial v0.1.0 release of the abilities-api by refactoring the factory pattern to accept WP_Ability instances directly instead of ability names.

  • Updated RegisterAbilityAs*::make() methods to take WP_Ability objects instead of strings
  • Made internal factory methods private and removed public validation methods
  • Added validation at the server level before creating factory instances

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
includes/Core/McpServer.php Added ability validation and retrieval before calling factory methods
includes/Domain/Tools/RegisterAbilityAsMcpTool.php Refactored to accept WP_Ability directly, made methods private
includes/Domain/Resources/RegisterAbilityAsMcpResource.php Refactored to accept WP_Ability directly, made methods private
includes/Domain/Prompts/RegisterAbilityAsMcpPrompt.php Refactored to accept WP_Ability directly, made methods private
includes/Handlers/* Added comments explaining ability validation assumptions
tests/Unit/* Updated test calls and removed invalid ability test cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@justlevine justlevine mentioned this pull request Aug 29, 2025
@justlevine justlevine self-assigned this Aug 29, 2025
Copy link
Contributor

@galatanovidiu galatanovidiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Changes look correct, and the cleanup is solid.

There are a few more problems related to the compatibility, but they can be resolved on another PR. #39

@justlevine justlevine merged commit f6f7cd6 into WordPress:trunk Sep 4, 2025
14 of 16 checks passed
@justlevine justlevine deleted the dev/abilities-api-010 branch September 4, 2025 13:18
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.

2 participants