Skip to content

Add --develop mode to Playground CLI for streamlined WordPress development#525

Merged
jonathanbossenger merged 3 commits intodevelop-modefrom
copilot/add-develop-mode-option
Jan 28, 2026
Merged

Add --develop mode to Playground CLI for streamlined WordPress development#525
jonathanbossenger merged 3 commits intodevelop-modefrom
copilot/add-develop-mode-option

Conversation

Copy link

Copilot AI commented Jan 28, 2026

Adds a --develop (alias -dev) flag that automatically configures WordPress development environments with SQLite and debug mode enabled.

Changes

CLI Option

  • New --develop [path] option with path validation/resolution
  • Defaults to current directory if no path specified
  • Validates --develop and --auto-mount are mutually exclusive

Development Mode Configuration (applyDevelopmentMode())

  • Detects existing WordPress installations via containsFullWordPressInstallation()
  • Sets wordpressInstallMode to install-from-existing-files-if-needed when WordPress detected
  • Mounts develop path to /wordpress using mount-before-install
  • Injects blueprint steps:
    • Install sqlite-database-integration plugin
    • Copy db.copy to wp-content/db.php
    • Set debug constants: WP_DEBUG, WP_DEBUG_LOG, WP_DEBUG_DISPLAY, SCRIPT_DEBUG
  • Merges development blueprint with user-provided blueprints

Usage

# Mount current directory
npx nx dev playground-cli server --develop

# Explicit path
npx nx dev playground-cli server -dev /path/to/wordpress

# With custom blueprint
npx nx dev playground-cli server --develop --blueprint custom.json --login

Files Modified

  • packages/playground/cli/src/run-cli.ts - Core implementation
  • packages/playground/cli/tests/run-cli.spec.ts - Test coverage

Notes

  • SQLite setup is intentional for development mode even if MySQL is configured, providing consistent portable environments
  • installPlugin step activates plugins by default, removed redundant activatePlugin step

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /usr/local/bin/node node index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Playground CLI: --develop Mode</issue_title>
<issue_description># Playground CLI: --develop Mode Enhancement Plan

Overview

Add a new --develop (alias: -dev) option to the Playground CLI that provides a streamlined development workflow for existing WordPress installations. This option automatically configures mount paths, skips WordPress download if already present, sets up SQLite database integration, and enables WordPress debugging constants for optimal development experience.

Goals

  1. Simplify local WordPress development with Playground CLI
  2. Automatically detect existing WordPress installations to avoid redundant downloads
  3. Set up SQLite database integration automatically
  4. Enable WordPress debugging constants for development
  5. Provide a single option that replaces multiple manual configuration steps

User Experience

Command Usage

# Basic usage with current directory (defaults to current working directory)
npx nx dev playground-cli server --develop

# Using short alias with current directory
npx nx dev playground-cli server -dev

# With explicit WordPress directory path
npx nx dev playground-cli server --develop /path/to/wordpress

# Combined with other options
npx nx dev playground-cli server --develop /path/to/wordpress --login --php=8.4

# Current directory with other options
npx nx dev playground-cli server -dev --login --php=8.4

Expected Behavior

When --develop is used (with or without a path):

Path Resolution:

  • If no path is provided: Uses current working directory (process.cwd())
  • If path is provided: Resolves relative or absolute path to absolute path
  1. WordPress Detection: Check if the target directory contains a WordPress installation

    • Look for: wp-admin/, wp-includes/, wp-content/
    • If found: Skip WordPress download (--wordpress-install-mode=install-from-existing-files-if-needed)
    • If not found: Download WordPress as normal
  2. Auto-Mount: Automatically apply --mount-before-install=<path>:/wordpress

    • Mounts before WordPress installation to allow detection
    • Maps to /wordpress root in Playground filesystem
  3. SQLite Setup: Execute blueprint to install and configure SQLite integration

    • Install sqlite-database-integration plugin
    • Copy db.copy to wp-content/db.php
    • Activate the plugin
  4. Enable Debug Mode: Configure WordPress debugging constants

    • Set WP_DEBUG to true - Enables WordPress debug mode
    • Set WP_DEBUG_LOG to true - Logs errors to wp-content/debug.log
    • Set WP_DEBUG_DISPLAY to true - Displays errors on screen
    • Set SCRIPT_DEBUG to true - Uses non-minified JS/CSS files for debugging

Technical Implementation

1. Add Option Definition

File: packages/playground/cli/src/cli.ts

Location: Add to sharedOptions object (lines 95-311)

develop: {
    alias: 'dev',
    type: 'string',
    describe: 'Enable development mode with automatic WordPress detection and SQLite setup. Accepts optional path to WordPress directory (defaults to current directory).',
    requiresArg: false,
    default: undefined, // Will be resolved to process.cwd() in coerce if flag is present
    coerce: (value: string | boolean | undefined) => {
        // If --develop is specified without a value, Yargs may pass true or empty string
        // If --develop is not specified at all, value will be undefined
        // If --develop is specified with a value, value will be that string

        // Return undefined if flag not used at all (this signals to applyDevelopmentMode to skip)
        if (value === undefined) {
            return undefined;
        }

        // Default to current directory if flag is present but no path provided
        const targetPath = (typeof value === 'string' && value.length > 0) ? value : process.cwd();

        // Resolve relative paths to absolute
        const absolutePath = path.resolve(process.cwd(), targetPath);

        // Validate path exists
        if (!fs.existsSync(absolutePath)) {
            throw new Error(`--develop path does not exist: ${absolutePath}`);
        }

        // Validate it's a directory
        if (!fs.statSync(absolutePath).isDirectory()) {
            throw new Error(`--develop path must be a directory: ${absolutePath}`);
        }

        return absolutePath;
    }
}

2. Update TypeScript Interfaces

File: packages/playground/cli/src/run-cli.ts

Location: Update RunCLIArgs interface (around line 717)

export interface RunCLIArgs {
    // ... existing fields ...

    /**
     * Enable development mode with a local WordPress directory.
     * Automatically configures mount, WordPress detection, and SQLite setup.
     * If provided, should be an absolute path. If not provided, uses current working directory.
     */
    develop?: string;

    // ... rest of ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes jonathanbossenger/wordpress-playground#524

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Copilot AI and others added 2 commits January 28, 2026 07:28
Co-authored-by: jonathanbossenger <180629+jonathanbossenger@users.noreply.github.com>
…ivation, add auto-mount conflict validation

Co-authored-by: jonathanbossenger <180629+jonathanbossenger@users.noreply.github.com>
Copilot AI changed the title [WIP] Add --develop mode option to Playground CLI Add --develop mode to Playground CLI for streamlined WordPress development Jan 28, 2026
@jonathanbossenger jonathanbossenger changed the base branch from trunk to develop-mode January 28, 2026 07:59
@jonathanbossenger jonathanbossenger marked this pull request as ready for review January 28, 2026 07:59
@jonathanbossenger jonathanbossenger merged commit 04a304c into develop-mode Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants