From 27ec1c04a57d1cad403b9ab481d7bcc6e356fe72 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 11 Jun 2026 03:34:12 +0000 Subject: [PATCH] fix: polish agentrun mutation next steps --- scripts/src/agentrun.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/src/agentrun.ts b/scripts/src/agentrun.ts index eff81e48..8fd7eee1 100644 --- a/scripts/src/agentrun.ts +++ b/scripts/src/agentrun.ts @@ -592,7 +592,7 @@ function renderResultSummary(command: string, raw: Record, opti return renderedCliResult(raw.ok !== false, command, lines.join("\n")); } -function renderMutationSummary(command: string, raw: Record, options: AgentRunResourceOptions, headline: string): RenderedCliResult { +function renderMutationSummary(command: string, raw: Record, options: AgentRunResourceOptions, headline: string, overrideNextLines?: string[]): RenderedCliResult { if (options.raw) return renderMachine(command, raw, "json", raw.ok !== false); if (options.output === "json" || options.output === "yaml") return renderMachine(command, raw, options.output, raw.ok !== false); const data = record(innerData(raw)); @@ -603,11 +603,15 @@ function renderMutationSummary(command: string, raw: Record, op ]; if (id !== null) lines.push(`Name: ${id}`); const next = record(raw.next ?? data.next); - const nextLines = Object.values(next).map(String).filter((line) => line.length > 0).slice(0, 5); + const nextLines = (overrideNextLines ?? Object.values(next).map(String)).filter((line) => line.length > 0).slice(0, 5); if (nextLines.length > 0) lines.push("", "Next:", ...nextLines.map((line) => ` ${line}`)); return renderedCliResult(raw.ok !== false, command, lines.join("\n")); } +function rerunWithoutDryRun(command: string): string { + return `bun scripts/cli.ts ${command.replace(/\s+--dry-run\b/gu, "").trim()}`; +} + function renderMachine(command: string, value: unknown, mode: "json" | "yaml", ok = true): RenderedCliResult { const text = mode === "json" ? `${JSON.stringify(value, null, 2)}\n` : `${Bun.YAML.stringify(value)}\n`; return renderedCliResult(ok, command, text, mode === "json" ? "application/json" : "application/yaml");