mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-20 01:11:18 +00:00
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:
parent
c9ea6384da
commit
03cc7f4132
3 changed files with 9 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@openrouter/spawn",
|
||||
"version": "0.12.16",
|
||||
"version": "0.12.17",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"spawn": "cli.js"
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue