WordPress.org

Plugin Check with Playground CLI

While working on the WordPress.org MCP server (yes, WordPress.org now accepts plugin submissions directly from your you AI assistant), I wanted to make it easy for AI agents to run plugins against Plugin Check before trying to submit a plugin to the Plugin Directory for review.

The best Claude could come up with was a convoluted prompt, explaining how to set up wp-env, set up Plugin Check, and run it locally. It was long, required a lot of steps, and gave ample opportunity for AI agents to get stuck or confused and give up.

While participating in Automattic’s AI Enablement training in New York, I managed to come up with a much easier way with the help of WordPress Playground (Thank you Adam and Bero for you help)! Turns out it supports running inline CLI commands now, albeit still requiring a blueprint.json file.

The whole command can now be condensed down to:

  1. Create blueprint.json
{
  "steps": [
    {"step": "installPlugin", "pluginData": {"resource": "wordpress.org/plugins", "slug": "plugin-check"}},
    {"step": "wp-cli", "command": "wp plugin activate plugin-check"}
  ]
}
  1. Run the check
npx @wp-playground/cli php \
  --blueprint=blueprint.json \
  --mount=/path/to/my-plugin:/wordpress/wp-content/plugins/my-plugin \
  --quiet \
  -- /tmp/wp-cli.phar plugin check my-plugin \
  --categories=plugin_repo --format=json \
  --error-severity=7 --warning-severity=6 \
  --include-low-severity-errors --exclude-checks=prefixing

If it accepted an inline json blob as a blueprint, it could even be a one-liner! Albeit a very long one.


Pretty cool what’s possible with WordPress Playground these days. And if you’ve not had a chance to check out WordPress.org’s MCP yet, take it for a spin! Let me know what you think.

Standard

Leave a comment