fix(approval): keep dry-run paths free of remote and local mutations

This commit is contained in:
gitea committed 2026-10-20 17:50:06 +08:00
1 parent fac81b08e8
commit ae2a1a9d60
5 files changed
+231 -184

No files matched your search

+7 -2
View File
@@ -1,3 +1,4 @@
import { isDryRun, mutationPreview } from "../mutation.js";
import { CliParsedArgs, CliResult, CliRuntime } from "../types.js";
import { printJson, printTable } from "../printer.js";
import { stringOption, booleanOption, numberOption } from "../parser.js";
@@ -19,9 +20,7 @@ export async function handleApprovalCommand(
);
}
const client = await createSessionClient(corp);
const corpId = corp.corpId || corp.id;
const service = new ApprovalService();
// 解析命令层级:
// 形式 A: hose-use approval audit points S26000001
@@ -40,6 +39,12 @@ export async function handleApprovalCommand(
const targetSn = args[0] || stringOption(parsed.options, ["code", "sn", "target", "id"]);
if (targetSn && isDryRun(parsed, runtime) && ["audit", "points", "inject", "review", "eval", "evaluate", "decide", "approve", "reject"].includes(subAction || "audit")) {
return mutationPreview(parsed, runtime, "预览审批操作", targetSn, { action: subAction || "audit", corpId, apply: booleanOption(parsed.options, ["apply", "execute", "run", "do"]) });
}
const client = await createSessionClient(corp);
const service = new ApprovalService();
switch (subAction) {
// ── 1. 规则注入与出明细级审核要点清单 ─────────────────────────────────────
case "points":