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 <noreply@anthropic.com>
This commit is contained in:
A 2026-03-04 03:14:50 -08:00 committed by GitHub
parent c9ea6384da
commit 03cc7f4132
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@openrouter/spawn",
"version": "0.12.16",
"version": "0.12.17",
"type": "module",
"bin": {
"spawn": "cli.js"

View file

@ -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<string> {
@ -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,
);
}

View file

@ -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]));