Skip to content

Conversation

@karmatosed
Copy link
Member

@karmatosed karmatosed commented Oct 31, 2025

What?

This is an initial very raw version PR to add an Abilities Explorer to the plugin. Responds to #62.
For now this adds a new menu item where you can see the abilities. You can also view or test them
Requires 6.9 beta to work.

Why?

Responds to the proposal in #62 and focuses on making them visible whilst providing a learning opportunity.

How?

This is a simpler implementation, adding a menu item and keeping it totally seperate as proposed for features.

Testing Instructions

Once using branch and installed you should be able to access it from Abilities menu item.

Screenshots or screencast

CleanShot 2025-10-31 at 16 07 50@2x

Note: as this is a work in progress going to keep as a draft until both decided on as direction and had some robust code review. This is being created from an experiment so there likely are code dragons - let’s slay them!

Open WordPress Playground Preview

@karmatosed karmatosed requested a review from jeffpaul October 31, 2025 16:09
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 56.89655% with 225 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.35%. Comparing base (a876ab6) to head (69e5faf).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...udes/Experiments/Abilities_Explorer/Admin_Page.php 30.37% 165 Missing ⚠️
...Experiments/Abilities_Explorer/Ability_Handler.php 78.74% 27 Missing ⚠️
...eriments/Abilities_Explorer/Abilities_Explorer.php 38.70% 19 Missing ⚠️
...s/Experiments/Abilities_Explorer/Ability_Table.php 88.88% 14 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop      #63      +/-   ##
=============================================
+ Coverage      47.97%   50.35%   +2.38%     
- Complexity       243      366     +123     
=============================================
  Files             22       26       +4     
  Lines           1430     1952     +522     
=============================================
+ Hits             686      983     +297     
- Misses           744      969     +225     
Flag Coverage Δ
unit 50.35% <56.89%> (+2.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul jeffpaul linked an issue Oct 31, 2025 that may be closed by this pull request
@jeffpaul jeffpaul added this to the 0.2.0 milestone Oct 31, 2025
Copy link
Contributor

@mindctrl mindctrl left a comment

Choose a reason for hiding this comment

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

I'm digging this so far. I left a question or two and some feedback, mostly about coding standards.

*
* @since 0.1.0
*/
class Admin_Page {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to other classes, I think we could type arguments and returns.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did a first pass in 86d7754, got everything but the array shapes, since I want to investigate those more directly.

Copy link

@jonathanbossenger jonathanbossenger left a comment

Choose a reason for hiding this comment

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

I think this will be a great feature for the plugin. Left a bunch of suggestions, happy to discuss any of them further.

* @since 0.1.0
*/
private function render_detail_view() {
$ability_slug = isset( $_GET['ability'] ) ? sanitize_text_field( wp_unslash( $_GET['ability'] ) ) : '';

Choose a reason for hiding this comment

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

This code is duplicated again at line 316. Is it worth calling this once higher up the chain, and then passing the $ability_slug to the relevant render_ method?

@JasonTheAdams JasonTheAdams self-requested a review November 12, 2025 17:23
@JasonTheAdams JasonTheAdams marked this pull request as ready for review November 13, 2025 17:25
@github-actions
Copy link

github-actions bot commented Nov 13, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: karmatosed <karmatosed@git.wordpress.org>
Co-authored-by: JasonTheAdams <jason_the_adams@git.wordpress.org>
Co-authored-by: justlevine <justlevine@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: mindctrl <mindctrl@git.wordpress.org>
Co-authored-by: jonathanbossenger <psykro@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: juanmaguitar <juanmaguitar@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@jeffpaul jeffpaul changed the base branch from trunk to develop November 26, 2025 22:09
@jeffpaul jeffpaul modified the milestones: 0.1.1, 0.2.0 Dec 2, 2025
@justlevine
Copy link
Contributor

PS: our CI/CD assumes trunk-based development so CI/CD isnt running on develop.

Here's the PHPStan output from this branch atm. The missing array shapes are likely noise, but the type conflicts are likely pointing to real bugs that need addressing (h/t @jeffpaul )

 ------ ------------------------------------------------------------------------------------------ 
  Line   includes/Features/Abilities_Explorer/Abilities_Explorer.php                               
 ------ ------------------------------------------------------------------------------------------ 
  :30    Constant WordPress\AI\Features\Abilities_Explorer\Abilities_Explorer::VERSION is unused.  
         🪪  classConstant.unused                                                                   
         💡  See: https://phpstan.org/developing-extensions/always-used-class-constants             
 ------ ------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   includes/Features/Abilities_Explorer/Ability_Handler.php                                                                                                           
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  :33    Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::get_all_abilities() return type has no value type specified in iterable type array.               
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :51    Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::get_ability() return type has no value type specified in iterable type array.                     
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :73    Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::format_abilities() has parameter $abilities with no value type specified in iterable type array.  
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :73    Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::format_abilities() return type has no value type specified in iterable type array.                
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :95    Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::format_single_ability() return type has no value type specified in iterable type array.           
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :130   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::detect_provider() has parameter $meta with no value type specified in iterable type array.        
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :165   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::invoke_ability() has parameter $input with no value type specified in iterable type array.        
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :165   PHPDoc tag @return with type array is incompatible with native type string.                                                                                        
         🪪  return.phpDocType                                                                                                                                               
  :167   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::invoke_ability() should return string but returns array<string, string|false>.                    
         🪪  return.type                                                                                                                                                     
  :176   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::invoke_ability() should return string but returns array<string, string|false>.                    
         🪪  return.type                                                                                                                                                     
  :192   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::invoke_ability() should return string but returns array<string, mixed>.                           
         🪪  return.type                                                                                                                                                     
  :200   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::invoke_ability() should return string but returns array<string, mixed>.                           
         🪪  return.type                                                                                                                                                     
  :215   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::validate_input() has parameter $input with no value type specified in iterable type array.        
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :215   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::validate_input() has parameter $schema with no value type specified in iterable type array.       
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :215   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::validate_input() return type has no value type specified in iterable type array.                  
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
  :290   Method WordPress\AI\Features\Abilities_Explorer\Ability_Handler::get_statistics() return type has no value type specified in iterable type array.                  
         🪪  missingType.iterableValue                                                                                                                                       
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                          
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   includes/Features/Abilities_Explorer/Ability_Table.php                                                                                                                                                    
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  :52    Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::get_columns() return type has no value type specified in iterable type array.                                                              
         🪪  missingType.iterableValue                                                                                                                                                                              
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                                                                 
  :69    Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::get_sortable_columns() return type has no value type specified in iterable type array.                                                     
         🪪  missingType.iterableValue                                                                                                                                                                              
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                                                                 
  :82    Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::prepare_items() has no return type specified.                                                                                              
         🪪  missingType.return                                                                                                                                                                                     
  :139   Parameter #1 $args of method WP_List_Table::set_pagination_args() expects array{total_items?: int, total_pages?: int, per_page?: int}, array{total_items: int<0, max>, per_page: 20, total_pages: float}  
         given.                                                                                                                                                                                                    
         🪪  argument.type                                                                                                                                                                                          
         💡  Offset 'total_pages' (int) does not accept type float.                                                                                                                                                 
  :158   Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::column_default() has parameter $item with no value type specified in iterable type array.                                                  
         🪪  missingType.iterableValue                                                                                                                                                                              
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                                                                 
  :170   Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::column_cb() has parameter $item with no value type specified in iterable type array.                                                       
         🪪  missingType.iterableValue                                                                                                                                                                              
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                                                                 
  :185   Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::column_name() has parameter $item with no value type specified in iterable type array.                                                     
         🪪  missingType.iterableValue                                                                                                                                                                              
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                                                                 
  :211   Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::column_slug() has parameter $item with no value type specified in iterable type array.                                                     
         🪪  missingType.iterableValue                                                                                                                                                                              
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                                                                 
  :226   Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::column_provider() has parameter $item with no value type specified in iterable type array.                                                 
         🪪  missingType.iterableValue                                                                                                                                                                              
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                                                                 
  :245   Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::column_actions() has parameter $item with no value type specified in iterable type array.                                                  
         🪪  missingType.iterableValue                                                                                                                                                                              
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                                                                 
  :280   Method WordPress\AI\Features\Abilities_Explorer\Ability_Table::extra_tablenav() has no return type specified.                                                                                             
         🪪  missingType.return                                                                                                                                                                                     
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   includes/Features/Abilities_Explorer/Admin_Page.php                                                                                                              
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  :100   Method WordPress\AI\Features\Abilities_Explorer\Admin_Page::render_statistics() has no return type specified.                                                    
         🪪  missingType.return                                                                                                                                            
  :133   Method WordPress\AI\Features\Abilities_Explorer\Admin_Page::render_list_view() has no return type specified.                                                     
         🪪  missingType.return                                                                                                                                            
  :153   Method WordPress\AI\Features\Abilities_Explorer\Admin_Page::render_detail_view() has no return type specified.                                                   
         🪪  missingType.return                                                                                                                                            
  :209   Parameter #1 $text of function esc_html expects string, string|false given.                                                                                      
         🪪  argument.type                                                                                                                                                 
  :217   Parameter #1 $text of function esc_html expects string, string|false given.                                                                                      
         🪪  argument.type                                                                                                                                                 
  :224   Parameter #1 $text of function esc_html expects string, string|false given.                                                                                      
         🪪  argument.type                                                                                                                                                 
  :235   Method WordPress\AI\Features\Abilities_Explorer\Admin_Page::render_test_runner() has no return type specified.                                                   
         🪪  missingType.return                                                                                                                                            
  :303   Parameter #1 $text of function esc_textarea expects string, string|false given.                                                                                  
         🪪  argument.type                                                                                                                                                 
  :328   Parameter #1 $text of function esc_html expects string, string|false given.                                                                                      
         🪪  argument.type                                                                                                                                                 
  :347   Method WordPress\AI\Features\Abilities_Explorer\Admin_Page::generate_example_input() has parameter $schema with no value type specified in iterable type array.  
         🪪  missingType.iterableValue                                                                                                                                     
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                        
  :347   Method WordPress\AI\Features\Abilities_Explorer\Admin_Page::generate_example_input() return type has no value type specified in iterable type array.             
         🪪  missingType.iterableValue                                                                                                                                     
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                        
  :369   Method WordPress\AI\Features\Abilities_Explorer\Admin_Page::get_example_value() has parameter $prop_schema with no value type specified in iterable type array.  
         🪪  missingType.iterableValue                                                                                                                                     
         💡  See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type                                                                        
  :402   Method WordPress\AI\Features\Abilities_Explorer\Admin_Page::ajax_invoke_ability() has no return type specified.                                                  
         🪪  missingType.return                                                                                                                                            
  :455   Offset 'success' does not exist on string.                                                                                                                       
         🪪  offsetAccess.notFound                                                                                                                                         
  :459   Offset 'data' does not exist on string.                                                                                                                          
         🪪  offsetAccess.notFound                                                                                                                                         
  :465   Offset 'error' on string in isset() does not exist.                                                                                                              
         🪪  isset.offset                                                                                                                                                  
  :466   Offset 'trace' on string in isset() does not exist.                                                                                                              
         🪪  isset.offset                                                                                                                                                  
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 

                                                                                                                        
 [ERROR] Found 45 errors          

@dkotter
Copy link
Collaborator

dkotter commented Dec 9, 2025

PS: our CI/CD assumes trunk-based development so CI/CD isnt running on develop.

So our test workflow has always been set to run when a pull request is opened, not depending on the base branch (see https://github.com/WordPress/ai/blob/develop/.github/workflows/test.yml#L9-L13). This is working on other PRs (see example run https://github.com/WordPress/ai/actions/runs/20016361492/job/57394802798) so not sure why this didn't work on the latest commit to this PR. I'm assuming (hoping) if the latest changes from develop are merged into this PR that will fix things

@justlevine
Copy link
Contributor

justlevine commented Dec 9, 2025

PS: our CI/CD assumes trunk-based development so CI/CD isnt running on develop.

So our test workflow has always been set to run when a pull request is opened, not depending on the base branch (see https://github.com/WordPress/ai/blob/develop/.github/workflows/test.yml#L9-L13). This is working on other PRs (see example run https://github.com/WordPress/ai/actions/runs/20016361492/job/57394802798) so not sure why this didn't work on the latest commit to this PR. I'm assuming (hoping) if the latest changes from develop are merged into this PR that will fix things

Oooh thanks for correcting me. Saw - develop missing, didnt notice it was scoped to push.

Interestingly, the workflows were running up until the latest commit, but the only changes in the diff are PHP-related 🤔

image

@jeffpaul
Copy link
Member

@jeffpaul jeffpaul modified the milestones: 0.2.0, 0.3.0 Jan 7, 2026
@justlevine
Copy link
Contributor

justlevine commented Jan 10, 2026

e40898b merged develop -> this branch but did not relocate the files from Features to experiments, so I could keep the feedback history intact. Will move those last.

@dkotter
Copy link
Collaborator

dkotter commented Jan 15, 2026

I've made a decent amount of changes here and in my opinion, this is ready to go. For anyone following along, here's the most recent updates:

  • Moved the JS and CSS file into our src directory, ensure those are built using wp-scripts and load those using our Asset_Loader class, matching what we do elsewhere: 085e594
    • In doing this, I noticed a previous commit removed the loading of these files all together (including adding the needed inline script data) so this experiment wasn't working at all. This data was added back in eadf439 and as far as I can tell, things work as expected now
  • Fixed all PHPCS and PHPStan errors: a0aeb38. Also fixed ESlint errors in the commit above
  • Renamed from Features to Experiments: 37fb4f9
  • Added some basic documentation: 0884763
  • Added unit tests and E2E tests

I wouldn't expect most of these changes to have an impact other than changing things around with the asset files (particularly since those had previously been removed). Probably worth someone else testing things again to ensure it all still works as expected (cc @jeffpaul @karmatosed)

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.

Add feature to show what abilities are on site

7 participants