Project Commands
Project-specific commands manage individual WordPress project development, PHP versions, and build processes.
Command Format
wdg <project-name> <command> [options]PHP Version Management
Check PHP Version
wdg my-site phpOutput:
Project: my-site
PHP Version: 8.2
Container: wdg-wp-my-site
Status: RunningSet PHP Version
wdg my-site php set 8.3What happens:
- Stops project container
- Rebuilds with new PHP version
- Preserves database and files
- Restarts container
- Updates project config
Available versions:
8.0- Legacy support8.1- Stable8.2- Default8.3- Latest
💡 TIP
Changing PHP versions rebuilds the container but keeps all data intact including database, uploads, and configurations.
List Available PHP Versions
wdg my-site php availableOutput:
Available PHP Versions:
8.0 - PHP 8.0.x (Legacy)
8.1 - PHP 8.1.x (Stable)
8.2 - PHP 8.2.x (Default) ✓ Current
8.3 - PHP 8.3.x (Latest)Development Mode
Start Development Server
wdg my-site devWhat it does:
- Detects
package.jsonin theme or app directory - Runs
npm startornpm run dev - Watches for file changes
- Auto-rebuilds assets
- Enables hot module replacement (if configured)
Priority order:
- Theme directory (
wp-content/themes/project-name/) - App directory (
wp-content/plugins/wikit-app/) - First found
package.jsonin repositories
Example output:
Starting development mode for my-site...
Found package.json: wp-content/themes/my-site/package.json
Running: npm start
> my-site-theme@1.0.0 start
> webpack serve --mode development
webpack 5.88.0 compiled with 0 warnings in 2453 ms
Development server running at: http://localhost:3000
Watching for changes...Stop Development Mode
# Press Ctrl+C in the terminal where dev server is running
# Or kill the process:
pkill -f "npm start"Build Commands
Production Build
wdg my-site buildWhat it does:
- Finds all
package.jsonfiles in project - Runs
npm run buildin each location - Minifies and optimizes assets
- Generates production-ready bundles
- Reports build status
Example output:
Building production assets for my-site...
[1/2] Building theme...
Location: wp-content/themes/my-site
Running: npm run build
✓ Theme built successfully (12.3s)
Output: dist/
[2/2] Building app...
Location: wp-content/plugins/wikit-app
Running: npm run build
✓ App built successfully (8.7s)
Output: build/
Build complete! Total time: 21.0sDevelopment Build
wdg my-site build --devBuilds with development flags:
- Unminified code
- Source maps enabled
- Debug mode on
Watch Mode Build
wdg my-site build --watchRebuilds automatically on file changes.
Repository Commands
Add Repository
wdg my-site repo add <git-url> [branch]Examples:
# Add repository (default branch)
wdg my-site repo add https://github.com/client/custom-plugin
# Add specific branch
wdg my-site repo add https://github.com/client/theme develop
# Add with SSH
wdg my-site repo add git@github.com:client/plugin.gitWhat it does:
- Clones repository to project's
repositories/directory - Installs git hooks for auto-indexing
- Indexes code for AI search
- Updates project configuration
List Repositories
wdg my-site repo listOutput:
Repositories for my-site:
my-site (wp-content)
Path: repositories/my-site
Branch: main
Status: ✓ Clean
Last commit: abc123 (2 hours ago)
Indexed: Yes (1,450 vectors)
custom-plugin (plugin)
Path: repositories/custom-plugin
Branch: develop
Status: ⚠ Modified (3 files)
Last commit: def456 (1 day ago)
Indexed: Yes (234 vectors)Update Repository
wdg my-site repo pull <repo-name>Example:
wdg my-site repo pull custom-pluginWhat it does:
- Pulls latest changes from remote
- Shows commit history
- Re-indexes if code changed
- Updates vector database
Sync All Repositories
wdg my-site repo syncPulls latest changes from all repositories in project.
Repository Status
wdg my-site repo status [repo-name]Shows git status for project repositories.
Container Management
Restart Container
wdg restart my-siteStops and starts the WordPress container.
Rebuild Container
wdg rebuild my-siteRebuilds Docker image and container (useful after config changes).
Container Logs
wdg logs my-site [--follow]Examples:
# View recent logs
wdg logs my-site
# Follow logs in real-time
wdg logs my-site --follow
# Last 100 lines
wdg logs my-site --tail 100Container Shell Access
wdg shell my-siteOpens bash shell inside WordPress container:
# You're now inside the container
www-data@my-site:/var/www/html$ wp plugin list
www-data@my-site:/var/www/html$ php -v
www-data@my-site:/var/www/html$ exitDatabase Commands
Export Database
wdg db export my-site [filename]Examples:
# Auto-generated filename
wdg db export my-site
# Custom filename
wdg db export my-site backup-$(date +%Y%m%d).sql
# With compression
wdg db export my-site | gzip > backup.sql.gzImport Database
wdg db import my-site <sql-file>Example:
wdg db import my-site production-db.sql⚠️ WARNING
This will replace all existing data in the project database!
Database Reset
wdg db reset my-siteResets database to fresh WordPress installation.
Search & Replace
wdg db search-replace my-site <search> <replace>Examples:
# Change domain
wdg db search-replace my-site \
"oldsite.com" \
"newsite.com"
# Update URLs
wdg db search-replace my-site \
"http://localhost" \
"https://production.com"WordPress CLI
Run WP-CLI Commands
wdg wp my-site <wp-cli-command>Examples:
# List plugins
wdg wp my-site plugin list
# Activate plugin
wdg wp my-site plugin activate custom-plugin
# Create user
wdg wp my-site user create john john@example.com \
--role=administrator \
--user_pass=password123
# Clear cache
wdg wp my-site cache flush
# Run cron
wdg wp my-site cron event run --all
# Export content
wdg wp my-site export --dir=exports/
# Import content
wdg wp my-site import exports/data.xml --authors=create
# Database operations
wdg wp my-site db query "SELECT * FROM wp_users"
wdg wp my-site db optimize
wdg wp my-site db checkIndexing Commands
Index Project
wdg index my-site [options]Options:
--force- Re-index all files--update- Pull repo updates first--types <types>- Index only specific file types
Examples:
# Full index
wdg index my-site
# Force re-index
wdg index my-site --force
# Index only PHP
wdg index my-site --types php
# Update and index
wdg index my-site --updateIndex Status
wdg status my-siteOutput:
Project: my-site
Status: Running
URL: https://my-site.localhost:8443
PHP: 8.2
Database: wp_my_site (45.2 MB)
Indexing Status:
Collection: project_my_site
Vectors: 1,450
Last indexed: 2024-10-14 10:30:00
Auto-indexing: Enabled
Repositories:
✓ my-site (main) - 1,200 vectors
✓ custom-plugin (develop) - 250 vectorsConfiguration Commands
View Project Config
wdg config show my-siteOutput:
{
"name": "my-site",
"created": "2024-10-14T10:30:00Z",
"php_version": "8.2",
"domain": "my-site.localhost",
"ssl": true,
"database": {
"name": "wp_my_site",
"user": "wordpress",
"host": "mysql"
},
"repositories": [...],
"indexing": {
"enabled": true,
"auto_index": true,
"collection": "project_my_site"
}
}Update Project Config
wdg config set my-site <key> <value>Examples:
# Enable debug mode
wdg config set my-site wp_debug true
# Set memory limit
wdg config set my-site php_memory_limit 512M
# Set timezone
wdg config set my-site timezone America/New_YorkEnvironment Commands
Set Environment Variables
wdg env set my-site <key> <value>Examples:
# Set custom environment variable
wdg env set my-site API_KEY abc123
# Enable debugging
wdg env set my-site WP_DEBUG true
# Set custom domain
wdg env set my-site WP_HOME https://my-custom-domain.testList Environment Variables
wdg env list my-sitePerformance Commands
Check Performance
wdg perf my-siteOutput:
Performance Metrics for my-site:
Container Resources:
CPU: 12.5%
Memory: 450 MB / 2 GB
Disk I/O: 2.3 MB/s
WordPress Performance:
Database queries: 42 per page
Page load time: 1.2s
Memory usage: 45 MB peak
Recommendations:
✓ PHP-FPM configured correctly
⚠ Consider object caching
✓ Database indexes optimalOptimize Database
wdg optimize my-siteOptimizes database tables and clears expired transients.
Backup Commands
Create Backup
wdg backup my-site [--full]Options:
- Default: Database only
--full: Database + files
Output:
Creating backup for my-site...
✓ Database exported: backups/my-site-20241014.sql
✓ Files archived: backups/my-site-files-20241014.tar.gz
Backup complete: backups/my-site-20241014-full.tar.gz (145 MB)Restore from Backup
wdg restore my-site <backup-file>Common Workflows
Daily Development
# Start project and dev server
wdg start my-site
wdg my-site dev
# Make changes...
# Commit triggers auto-indexing
# Stop when done
# Ctrl+C to stop dev server
wdg stop my-siteSwitching PHP Versions
# Check current version
wdg my-site php
# Output: 8.2
# Change to 8.3
wdg my-site php set 8.3
# Container rebuilds automatically
# Verify
wdg my-site php
# Output: 8.3Production Build Process
# 1. Build assets
wdg my-site build
# 2. Export database
wdg db export my-site production.sql
# 3. Search/replace domains
wdg db search-replace my-site \
"my-site.localhost:8443" \
"production-domain.com"
# 4. Create full backup
wdg backup my-site --full
# 5. Deploy (manual or automated)See Also: