Making WordPress.org

Changeset 14711


Ignore:
Timestamp:
03/13/2026 05:18:29 PM (4 weeks ago)
Author:
obenland
Message:

WP.org Abilities: Accept URL input for readme validation tool

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/plugins/plugin-directory/tools/class-validate-readme.php

    r14710 r14711  
    2828            array(
    2929                'label'               => 'Validate Plugin Readme',
    30                 'description'         => 'Validates a WordPress plugin readme.txt file and returns errors, warnings, and notes.',
     30                'description'         => 'Validates a WordPress plugin readme.txt or readme.md file and returns errors, warnings, and notes. Accepts either the file content directly or a URL to fetch it from.',
    3131                'category'            => 'wporg-plugins-plugin-directory',
    3232                'input_schema'        => array(
     
    3737                            'description' => 'The full text content of the readme.txt or readme.md file to validate.',
    3838                        ),
     39                        'url'     => array(
     40                            'type'        => 'string',
     41                            'description' => 'URL to a readme.txt or readme.md file to fetch and validate. Must end in readme.txt or readme.md.',
     42                        ),
    3943                    ),
    40                     'required'   => array( 'content' ),
    4144                ),
    4245                'output_schema'       => array(
     
    7578
    7679    /**
    77      * Validate the provided readme content.
     80     * Validate the provided readme content or URL.
    7881     *
    79      * @param array $input The tool input containing 'content'.
     82     * @param array $input The tool input containing 'content' or 'url'.
    8083     * @return array MCP tool result.
    8184     */
     
    8992        }
    9093
    91         $results = Validator::instance()->validate_content( $input['content'] );
     94        if ( ! empty( $input['url'] ) ) {
     95            $results = Validator::instance()->validate_url( $input['url'] );
     96        } elseif ( ! empty( $input['content'] ) ) {
     97            $results = Validator::instance()->validate_content( $input['content'] );
     98        } else {
     99            return array(
     100                'error' => 'Provide either "content" or "url".',
     101            );
     102        }
    92103
    93104        // Convert HTML messages to markdown/plain text for AI agent consumption.
Note: See TracChangeset for help on using the changeset viewer.