LocalWP Assistant — VS Code Chat Participant
A GitHub Copilot Chat participant (@localwp) that lets you query and manage your Local by Flywheel WordPress sites directly from VS Code.
Features
Section titled “Features”- Auto-detects the active site from your open file or workspace root
- Direct MySQL connection — no WP-CLI overhead for read queries
- WP-CLI for everything else, using Local’s bundled PHP and MySQL binaries
- LM-powered answers — free-form questions are answered in human-readable Markdown, not raw JSON
- Follow-up suggestions after every response
- Remembers your site — pick once, reuse for the session
- Cross-platform — macOS, Windows, and Linux
Requirements
Section titled “Requirements”- Local by Flywheel installed
- WP-CLI in your PATH
- macOS:
brew install wp-cli - Other: see WP-CLI install docs
- macOS:
- GitHub Copilot Chat extension
Install
Section titled “Install”Install from the VS Code Marketplace, or search for LocalWP Assistant in VS Code Extensions.
Development
Section titled “Development”git clone https://github.com/soderlind/localwp-assistantcd localwp-assistantnpm installnpm run compilePress F5 in VS Code to launch the Extension Development Host, or package with vsce package.
Open Copilot Chat and type @localwp followed by your question.
Slash commands
Section titled “Slash commands”| Command | Description |
|---|---|
@localwp /sites | List all Local sites with running status |
@localwp /plugins | List active plugins (fast — direct DB) |
@localwp /options siteurl | Fetch options matching a pattern |
@localwp /db SELECT ... | Run a raw read-only SQL query |
Free-form examples
Section titled “Free-form examples”@localwp What plugins are active?@localwp What is the siteurl?@localwp List all users@localwp What WordPress version is running?@localwp Show me all transients matching _site_transient_%@localwp --site=my-other-site What theme is active?Targeting a specific site
Section titled “Targeting a specific site”If multiple sites are running, the extension auto-detects from your open file. To override:
@localwp --site=my-site-name What plugins are active?If auto-detection can’t determine the site, a QuickPick will appear. Your choice is remembered for the session — subsequent messages reuse the last selected site automatically. Use --site=<name> to switch.
Architecture
Section titled “Architecture”src/├── extension.ts ← Registers the chat participant├── localwp/│ ├── sites.ts ← Reads sites.json + site-statuses.json│ ├── mysql.ts ← Direct MySQL connection via socket/TCP│ └── wpcli.ts ← Runs WP-CLI via Local's bundled PHP└── participant/ ├── handler.ts ← Routes requests to MySQL or WP-CLI └── siteSelector.ts ← Auto-detects or QuickPicks the target siteWhy direct MySQL?
Section titled “Why direct MySQL?”On macOS/Linux, Local exposes a MySQL Unix socket per site. On Windows, it exposes a TCP port. Connecting directly with mysql2 is much faster than spinning up a PHP process for WP-CLI — especially for simple reads like listing plugins or fetching options.
WP-CLI is still used for write operations and anything that needs WordPress context (hooks, filters, PHP eval).
License
Section titled “License”📦 Source: soderlind/vs-local-wp · Edit on GitHub