| name | lwp |
| description | Manage Local WordPress development sites using the lwp CLI. Use when the user asks about WordPress sites, Local development, starting/stopping sites, running WP-CLI commands, or managing local WordPress environments. Local is a free development tool built and supported by WP Engine. |
| allowed-tools | Bash(lwp *) |
Local CLI (lwp)
The lwp command manages WordPress sites in Local, a local WordPress development environment built and supported by WP Engine.
Prerequisites
- Local must be installed and running
- CLI installed:
npm install -g @local-labs-jpollock/local-cli
Quick Reference
Site Management
lwp sites list
lwp sites list --size
lwp sites list --status running
lwp sites list --json
lwp sites get <site>
lwp sites start <site>
lwp sites stop <site>
lwp sites restart <site>
lwp sites create <name>
lwp sites delete <site>
lwp sites open <site>
lwp sites open <site> --admin
WP-CLI Commands
Run any WP-CLI command against a Local site:
lwp wp <site> plugin list
lwp wp <site> plugin install <plugin> --activate
lwp wp <site> theme list
lwp wp <site> option get siteurl
lwp wp <site> user list --format=json
lwp wp <site> db query "SELECT * FROM wp_options LIMIT 5"
lwp wp <site> cache flush
lwp wp <site> search-replace 'old' 'new' --dry-run
Plugin-provided CLI commands (e.g., wp migrate):
By default, plugins are skipped for safety. Use --with-plugins to load them.
Important: Options must come BEFORE the site name:
lwp wp --with-plugins <site> migrate push <target>
lwp wp --with-plugins <site> migrate pull <source>
lwp wp <site> --with-plugins migrate push
Database Operations
lwp db export <site>
lwp db export <site> -o path.sql
lwp db import <site> <file.sql>
lwp db adminer <site>
Site Configuration
lwp sites php <site> 8.2.10
lwp sites xdebug <site> --on
lwp sites xdebug <site> --off
lwp sites logs <site>
lwp sites logs <site> -t nginx
lwp sites ssl <site>
lwp sites rename <site> <newName>
Blueprints
lwp blueprints list
lwp blueprints save <site> <name>
lwp sites create <name> --blueprint <blueprint>
Clone & Export
lwp sites clone <site> <newName>
lwp sites export <site>
lwp sites import <zipFile>
Common Workflows
Create and configure a new site
lwp sites create my-project
lwp sites start my-project
lwp wp my-project plugin install woocommerce --activate
lwp sites open my-project --admin
Backup before making changes
lwp db export my-site -o ~/backups/my-site-backup.sql
lwp db import my-site ~/backups/my-site-backup.sql
Debug PHP issues
lwp sites xdebug my-site --on
lwp sites logs my-site -t php -n 100
Output Formats
- Default: Human-readable tables
--json: Machine-readable JSON (use for parsing)
--quiet: Names/IDs only (for scripting)
lwp sites get my-site --json | jq '.url'
lwp sites list --json | jq '.[].name'
Error Handling
| Error | Solution |
|---|
| "Local is not installed" | Install Local from localwp.com |
| "Timed out waiting for Local" | Start the Local application |
| "Site not found" | Check site name with lwp sites list |
Destructive Commands - Confirm First
Always confirm with the user before running these commands:
| Command | Risk |
|---|
lwp sites delete <site> | Permanently deletes site and files |
lwp db import <site> <file> | Overwrites entire database |
lwp wpe push <site> | Pushes to production WP Engine site |
lwp backups restore <site> | Overwrites site from backup |
lwp wp <site> db reset | Drops all database tables |
lwp wp <site> search-replace | Modifies database content |
Safe practices:
- Export first - Always run
lwp db export <site> before destructive operations
- Dry run - Use
--dry-run when available to preview changes:
lwp wp <site> search-replace 'old' 'new' --dry-run
- Confirm intent - Ask "Are you sure you want to delete/overwrite X?" before proceeding
- Never auto-confirm - Do not add
-y or --yes flags without explicit user approval
Tips
- Always check site status before running WP-CLI commands
- Use
--json output for reliable parsing
- Export database before destructive operations
- Site names are case-sensitive