From 03cc7f41323aa4d18922edddda5e4944a8114ef9 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Wed, 4 Mar 2026 03:14:50 -0800 Subject: [PATCH] fix(interactive): honour --dry-run flag in single-agent interactive path (#2184) When a user ran `spawn claude --dry-run`, the dry-run flag was silently ignored and a real server was provisioned. `cmdAgentInteractive` was passing `dryRun` in the `debug` parameter position of `execScript`, so no preview was shown and `SPAWN_DEBUG=1` was set instead. Fix: - Export `showDryRunPreview` from `run.ts` - Import and call it in `cmdAgentInteractive` after cloud selection - Return early when `dryRun` is set (matches `cmdRun` behaviour) - Pass `undefined` for the `debug` argument (interactive path has no debug flag) Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 --- packages/cli/package.json | 2 +- packages/cli/src/commands/interactive.ts | 9 +++++++-- packages/cli/src/commands/run.ts | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 09f8119f..29a9fbe1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/spawn", - "version": "0.12.16", + "version": "0.12.17", "type": "module", "bin": { "spawn": "cli.js" diff --git a/packages/cli/src/commands/interactive.ts b/packages/cli/src/commands/interactive.ts index a53332b7..11b2e83e 100644 --- a/packages/cli/src/commands/interactive.ts +++ b/packages/cli/src/commands/interactive.ts @@ -15,7 +15,7 @@ import { preflightCredentialCheck, getAuthHint, } from "./shared.js"; -import { execScript } from "./run.js"; +import { execScript, showDryRunPreview } from "./run.js"; // Prompt user to select an agent with hints and type-ahead filtering async function selectAgent(manifest: Manifest): Promise { @@ -170,6 +170,11 @@ export async function cmdAgentInteractive(agent: string, prompt?: string, dryRun const { clouds, hintOverrides } = getAndValidateCloudChoices(manifest, resolvedAgent); const cloudChoice = await selectCloud(manifest, clouds, hintOverrides); + if (dryRun) { + showDryRunPreview(manifest, resolvedAgent, cloudChoice, prompt); + return; + } + await preflightCredentialCheck(manifest, cloudChoice); const spawnName = await promptSpawnName(); @@ -186,7 +191,7 @@ export async function cmdAgentInteractive(agent: string, prompt?: string, dryRun prompt, getAuthHint(manifest, cloudChoice), manifest.clouds[cloudChoice].url, - dryRun, + undefined, spawnName, ); } diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index 5b0a32b0..4f1d60a4 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -170,7 +170,7 @@ function buildPromptLines(prompt: string): string[] { return lines; } -function showDryRunPreview(manifest: Manifest, agent: string, cloud: string, prompt?: string): void { +export function showDryRunPreview(manifest: Manifest, agent: string, cloud: string, prompt?: string): void { p.log.info(pc.bold("Dry run -- no resources will be provisioned\n")); printDryRunSection("Agent", buildAgentLines(manifest.agents[agent]));