Skip to content

[Blueprints] Add native Blueprint v2 CLI flow - #3915

Merged
adamziel merged 1 commit into
trunkfrom
add/native-blueprint-v2-cli-flow
Jul 7, 2026
Merged

[Blueprints] Add native Blueprint v2 CLI flow#3915
adamziel merged 1 commit into
trunkfrom
add/native-blueprint-v2-cli-flow

Conversation

@adamziel

@adamziel adamziel commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What it does

Adds the native Blueprint v2 execution flow to Playground CLI.

The CLI now routes Blueprint v2 declarations and explicit --mode runs through the TypeScript v2 compiler and v2 worker path. Existing v1 declarations stay on the v1 handler.

Rationale

The web/client v2 declaration path landed first. This follows with the matching CLI slice: enough to boot WordPress, apply v2 runtime options, and run the compiled v2 steps without pulling in website, remote, or package-manager changes.

Implementation

  • Exports compileBlueprintV2() from @wp-playground/blueprints and passes progress tracking through v2 compilation.
  • Adds BlueprintsV2Handler support for resolving v2 runtime configuration, downloading WordPress, preparing SQLite, booting the v2 worker, and running compiled v2 steps.
  • Reworks worker-thread-v2.ts around bootRequestHandler() and bootWordPress() instead of delegating the whole flow to the old PHP-side v2 runner.
  • Routes v2 declarations, --experimental-blueprints-v2-runner, and explicit --mode invocations to the v2 handler while preserving v1 handling for v1 declarations.
  • Applies CLI defaults for missing v2 runtime fields while preserving phpVersion, wordpressVersion, and login settings declared by the Blueprint.

Testing instructions

npx nx typecheck playground-cli
npx nx typecheck playground-blueprints
npx nx lint playground-cli
npx nx lint playground-blueprints
npx nx test-playground-cli playground-cli
npx nx build playground-cli

Part of #2592.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds native Blueprint v2 execution support to Playground CLI, routing v2 declarations and --mode runs through the TypeScript v2 compiler and v2 worker boot flow while preserving v1 handling.

Changes:

  • Routes Blueprint v2 declarations and explicit --mode invocations to a new BlueprintsV2Handler (native TS v2 compiler + runtime).
  • Reworks worker-thread-v2.ts to boot via bootRequestHandler() / bootWordPress() and aligns CLI option precedence with “explicit user intent” tracking.
  • Expands CLI test coverage for v2 routing/modes and start-command behaviors (including browser open default).

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/playground/cli/src/run-cli.ts Adds v2 handler selection, CLI-provided option tracking, and improved error describing/log handling.
packages/playground/cli/src/blueprints-v2/blueprints-v2-handler.ts Implements native v2 compilation, runtime option resolution, WordPress download + boot, and step execution.
packages/playground/cli/src/blueprints-v2/worker-thread-v2.ts Reworks v2 worker around bootRequestHandler/bootWordPress and post-install mount signaling.
packages/playground/blueprints/src/index.ts Exports compileBlueprintV2() (+ types) for CLI use.
packages/playground/blueprints/src/lib/v2/compile.ts Extends v2 compile options to pass progress tracking through compilation.
packages/playground/cli/src/mounts.ts Avoids auto-mount overriding an explicit mode.
packages/playground/cli/src/resolve-blueprint.ts Fixes .zip ArrayBuffer slicing to avoid incorrect buffer views.
packages/playground/cli/src/cli-output.ts Minor formatting adjustment for version display.
packages/playground/cli/tests/run-cli.spec.ts Adds v2 routing/mode/start tests; replaces external unzip with in-process extraction; stubs browser-open exec.
packages/playground/cli/tests/mounts.spec.ts Adds regression test ensuring explicit mode isn’t overridden by auto-mount expansion.
packages/playground/cli/tests/blueprints-v2-handler.spec.ts Adds focused unit tests for v2 handler overrides, mode mapping, and boot/runtime option behavior.
packages/playground/cli/README.md Documents v2 routing + --mode and updates blueprint example fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/cli/src/blueprints-v2/worker-thread-v2.ts
Comment thread packages/playground/cli/src/blueprints-v2/blueprints-v2-handler.ts Outdated
Comment thread packages/playground/cli/src/blueprints-v2/blueprints-v2-handler.ts Outdated
Comment thread packages/playground/cli/tests/run-cli.spec.ts Outdated
Comment thread packages/playground/cli/src/blueprints-v2/worker-thread-v2.ts
@adamziel
adamziel force-pushed the add/native-blueprint-v2-cli-flow branch 9 times, most recently from 149ff44 to f8c60c2 Compare July 7, 2026 11:28
@adamziel
adamziel force-pushed the add/native-blueprint-v2-cli-flow branch from f8c60c2 to b392e7b Compare July 7, 2026 11:29
@adamziel
adamziel merged commit 9f660c9 into trunk Jul 7, 2026
53 checks passed
@adamziel
adamziel deleted the add/native-blueprint-v2-cli-flow branch July 7, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment