wp-cli-local
An AI agent skill that runs WP-CLI commands against Local (by Flywheel) sites on macOS.
- Auto-detects the Local site from your current directory
- Falls back to
--site=<name>when outside a site folder - Uses Local’s own PHP and MySQL binaries with the correct
php.ini
More example prompts below
Installation
Section titled “Installation”npx skills add https://github.com/soderlind/wp-cli-local --skill wp-cli-local -gThe --all flag installs the skill for all detected AI agents (GitHub Copilot, Claude Code, Cursor, Cline, etc.) without prompting:
npx skills add https://github.com/soderlind/wp-cli-local --skill wp-cli-local -g --allWithout --all, you’ll be prompted to select which agents to install for.
Prerequisites
Section titled “Prerequisites”- macOS (Apple Silicon or Intel)
- Local installed with at least one site
- WP-CLI installed and in
PATH(e.g.brew install wp-cli) - The target site must be running in Local
How It Works
Section titled “How It Works”The wrapper script at scripts/wp:
- Reads
~/Library/Application Support/Local/sites.jsonto find all sites - Matches the current working directory against site paths (longest prefix match)
- Resolves the correct PHP and MySQL binaries from Local’s
lightning-services/ - Loads the site-specific
php.ini(which contains the MySQL socket path) - Sets
MYSQL_UNIX_PORTsowp dbcommands use the correct socket - Executes WP-CLI with the correct environment
Once installed, just ask your AI agent to run WP-CLI commands in natural language. The skill is triggered automatically.
Example prompts
Section titled “Example prompts”- “List all plugins on my Local site”
- “Activate the woocommerce plugin”
- “What version of WordPress is running?”
- “Flush the cache”
- “Export the database”
- “Show all options matching
siteurl” - “List scheduled cron events”
- “Run
wp db query \"SELECT * FROM wp_options LIMIT 5;\"”
If your working directory is inside a Local site folder, the site is detected automatically. Otherwise the agent will ask which site to target, or you can specify it: “List plugins on the my-site site”.
Manual / testing
Section titled “Manual / testing”You can also call the wrapper script directly in a terminal:
# Auto-detect site from CWDbash scripts/wp plugin list
# Explicit site namebash scripts/wp --site=my-site core version
# List all Local sites with running/halted statusbash scripts/wp --listExample output of --list
Section titled “Example output of --list”Local by Flywheel sites:
● plugins running /Users/you/Sites/plugins ○ my-site halted /Users/you/Sites/my-siteCredit
Section titled “Credit”Inspired by local-wp-cli skill, but rewritten from scratch with better site detection and MySQL socket support.
License
Section titled “License”MIT
📦 Source: soderlind/wp-cli-local · Edit on GitHub