Add rules clear command

This commit is contained in:
gitea committed 2026-07-08 15:22:04 +08:00
1 parent eeba2a4ea4
commit 2611ce4c85
8 files changed
+234 -1

No files matched your search

+22
View File
@@ -173,6 +173,27 @@ async function main() {
return;
}
if (area === "rules" && action === "clear") {
const confirmed = booleanOption(args.options.yes) === true;
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]) ?? !confirmed;
if (!confirmed && !dryRun) {
throw new Error("Refusing to clear rules without --yes. Use --dry-run to preview.");
}
const result = await runToolResult("seal_approval_rules_clear", client, corp, {
dryRun,
recode: booleanOption(args.options.recode)
});
if (!confirmed && dryRun && result && typeof result === "object") {
printJson({
...result,
nextCommand: `seal-home rules clear --corp ${corp.id} --yes`
}, outputOptions(args.options));
return;
}
printJson(result, outputOptions(args.options));
return;
}
if (area === "rules" && action === "versions") {
await runTool("seal_approval_rule_versions_list", client, corp, {}, outputOptions(args.options));
return;
@@ -1130,6 +1151,7 @@ Usage:
seal-home tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
seal-home rules count [--corp <corpId>]
seal-home rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]
seal-home rules clear [--corp <corpId>] [--dry-run|--yes]
seal-home rules versions [--corp <corpId>]
seal-home rules version <versionId|versionNumber|latest> [--corp <corpId>]
seal-home rules get --version <number|latest> --code '#0038'