dev!: Mark WP\MCP\Cli classes as final and cleanup internals - #306
dev!: Mark WP\MCP\Cli classes as final and cleanup internals#306justlevine wants to merge 6 commits into
WP\MCP\Cli classes as final and cleanup internals#306Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
WP\MCP\Cli classes as final and cleanup internals
There was a problem hiding this comment.
Pull request overview
This PR tightens the public surface area and improves internal type-safety for the MCP adapter’s CLI and transport layers, primarily by marking CLI classes as final and refining response/error typing/documentation.
Changes:
- Mark
WP\MCP\Cli\McpCommandandWP\MCP\Cli\StdioServerBridgeasfinal. - Improve JSON-RPC response typing via array-shape PHPDoc updates and minor internal refactors.
- Refine PHPCS configuration to better support non-VIP environments.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| includes/Transport/Infrastructure/JsonRpcResponseBuilder.php | Refines PHPDoc for JSON-RPC success/error response shapes. |
| includes/Transport/Infrastructure/HttpRequestHandler.php | Adds array-shape typing for protocol-version header validation errors. |
| includes/Cli/StdioServerBridge.php | Marks class final, narrows/clarifies typing, and refactors JSON-RPC response formatting. |
| includes/Cli/McpCommand.php | Marks WP-CLI command class final. |
| .phpcs.xml.dist | Excludes a VIP-specific restriction to support non-VIP environments. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #306 +/- ##
=========================================
Coverage 88.78% 88.78%
Complexity 1264 1264
=========================================
Files 54 54
Lines 4164 4164
=========================================
Hits 3697 3697
Misses 467 467
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
What?
This PR audits and cleans up the PHP classes in the CLI namespace.
Note
While marking classes final is technically a breaking change, functionally the plugin doesn't support extending them anyway.
Why?
Reducing the footprint for potential breaking changes before the release to .org.
How?
phpcs:ignoreannotations with specific smells + reasonsCli\McpCommandandCli\StdioServerBridgeasfinalStdioServerBridgeand narrows the typehints to what those methods (and their callers expect).Use of AI Tools
None
Testing Instructions
N/a
Screenshots or screencast
Changelog Entry