https://github.com/soderlind/wp-cli-local
An AI agent skill that runs WP-CLI commands against Local (by Flywheel) sites on macOS.
https://github.com/soderlind/wp-cli-local
ai-skills localwp wordpress-cli
Last synced: 5 days ago
JSON representation
An AI agent skill that runs WP-CLI commands against Local (by Flywheel) sites on macOS.
- Host: GitHub
- URL: https://github.com/soderlind/wp-cli-local
- Owner: soderlind
- Created: 2026-03-11T22:01:36.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-03-11T23:42:56.000Z (about 2 months ago)
- Last Synced: 2026-03-12T03:22:53.336Z (about 2 months ago)
- Topics: ai-skills, localwp, wordpress-cli
- Language: Shell
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# wp-cli-local
An AI agent skill that runs [WP-CLI](https://wp-cli.org/) commands against [Local](https://localwp.com/) (by Flywheel) sites on macOS.
- **Auto-detects** the Local site from your current directory
- Falls back to `--site=` when outside a site folder
- Uses Local's own PHP and MySQL binaries with the correct `php.ini`
## Installation
```bash
npx skills add https://github.com/soderlind/wp-cli-local --skill wp-cli-local -g
```
The `--all` flag installs the skill for all detected AI agents (GitHub Copilot, Claude Code, Cursor, Cline, etc.) without prompting:
```bash
npx skills add https://github.com/soderlind/wp-cli-local --skill wp-cli-local -g --all
```
Without `--all`, you'll be prompted to select which agents to install for.
## Prerequisites
- **macOS** (Apple Silicon or Intel)
- **[Local](https://localwp.com/)** installed with at least one site
- **[WP-CLI](https://wp-cli.org/)** installed and in `PATH` (e.g. `brew install wp-cli`)
- The target site must be **running** in Local
## How It Works
The wrapper script at `scripts/wp`:
1. Reads `~/Library/Application Support/Local/sites.json` to find all sites
2. Matches the current working directory against site paths (longest prefix match)
3. Resolves the correct PHP and MySQL binaries from Local's `lightning-services/`
4. Loads the site-specific `php.ini` (which contains the MySQL socket path)
5. Sets `MYSQL_UNIX_PORT` so `wp db` commands use the correct socket
6. Executes WP-CLI with the correct environment
## Usage
Once installed, just ask your AI agent to run WP-CLI commands in natural language. The skill is triggered automatically.
### 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
You can also call the wrapper script directly in a terminal:
```bash
# Auto-detect site from CWD
bash scripts/wp plugin list
# Explicit site name
bash scripts/wp --site=my-site core version
# List all Local sites with running/halted status
bash scripts/wp --list
```
### Example output of `--list`
```
Local by Flywheel sites:
● plugins running /Users/you/Sites/plugins
○ my-site halted /Users/you/Sites/my-site
```
## Credit
Inspired by [local-wp-cli](https://github.com/aslamdoctor/local-wp-cli) skill, but rewritten from scratch with better site detection and MySQL socket support.
## License
MIT