Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

soderlind/wp-cli-local

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
7 Commits
 
 
 
 

Repository files navigation

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
Screenshot 2026-03-12 at 00 54 40

More example prompts below

Installation

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:

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 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

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:

# 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 skill, but rewritten from scratch with better site detection and MySQL socket support.

License

MIT

About

An AI agent skill that runs WP-CLI commands against Local (by Flywheel) sites on macOS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.