From f26eae7b08682165be10dcb189fee49f66066173 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Fri, 11 Sep 2026 17:41:58 +0800 Subject: [PATCH] fix: make dry-run next steps executable --- src/cli/mutation.test.ts | 2 ++ src/cli/mutation.ts | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cli/mutation.test.ts b/src/cli/mutation.test.ts index e4e28f9..d070e4e 100644 --- a/src/cli/mutation.test.ts +++ b/src/cli/mutation.test.ts @@ -36,6 +36,8 @@ describe("CLI mutation protocol", () => { expect(preview.dryRun).toBe(true); expect(preview.operation).toBe("同意单据审批"); expect(preview.target).toBe("S26000001"); + expect(preview.nextAction).not.toContain("--dry-run"); + expect(preview.nextAction).toContain("--yes"); }); test("bill write without confirmation is rejected before the API call", async () => { diff --git a/src/cli/mutation.ts b/src/cli/mutation.ts index 3edb460..92cf820 100644 --- a/src/cli/mutation.ts +++ b/src/cli/mutation.ts @@ -52,12 +52,14 @@ export function mutationPreview( target: string, changes: Record ): CliResult { + const confirmedArgs = parsed.raw.filter((arg) => !["--dry-run", "--dryRun", "--dryrun"].includes(arg)); + const nextAction = `hose-use ${confirmedArgs.join(" ")} --yes`; const payload = { dryRun: true, operation, target, changes, - nextAction: `hose-use ${parsed.raw.join(" ")} --yes`, + nextAction, }; if (runtime.jsonMode) { @@ -74,7 +76,7 @@ export function mutationPreview( `目标: ${target}`, "变更:", ...Object.entries(changes).map(([key, value]) => ` ${key}: ${formatPreviewValue(value)}`), - `下一步: hose-use ${parsed.raw.join(" ")} --yes`, + `下一步: ${nextAction}`, ]; return { stdout: `${lines.join("\n")}\n`, stderr: "", exitCode: 0 }; }