Add resilient rule version diff fallback

This commit is contained in:
gitea committed 2026-09-21 18:00:19 +08:00
1 parent c1aebc13b1
commit 3812625c30
11 files changed
+525 -303

No files matched your search

+12 -4
View File
@@ -245,14 +245,22 @@ export const HELP_REGISTRY: AreaHelp[] = [
},
{
name: "diff",
summary: "Compare two published rule versions by stable rule ID",
usage: ["seal-use rules diff <fromVersion> <toVersion> [--rule-id <stableRuleId>] [--include-unchanged] [--format unified|json] [--corp <corpId>]"],
summary: "Compare two published rule versions by persisted ID or code",
usage: ["seal-use rules diff <fromVersion> <toVersion> [--rule-id <stableRuleId>|--code <code>] [--include-unchanged] [--full] [--corp <corpId>]"],
options: [
{ flag: "--rule-id <id>", description: "Compare only one stable rule ID; never fall back to code or position" },
{ flag: "--rule-id <id>", description: "Compare only one stable rule ID" },
{ flag: "--code <code>", description: "Compare only one rule code when stable ID mapping is unavailable" },
{ flag: "--include-unchanged", description: "Include unchanged rules in the structured changes list" },
{ flag: "--full", description: "Expand an oversized diff; small diffs are returned in full by default" },
{ flag: "--format unified|json", description: "Return unified diff text together with structured metadata" }
],
description: "Compares published snapshots with stable rule IDs. The command refuses to guess when a snapshot lacks an ID, so code reordering cannot create a false match."
description: "Uses locally persisted draft IDs when available and otherwise falls back to code. Output is truncated only when the total diff exceeds the safety limit; use --full to expand it."
},
{
name: "diff-one",
summary: "Inspect one rule change",
usage: ["seal-use rules diff-one <fromVersion> <toVersion> <ruleId> [--full] [--corp <corpId>]"],
description: "Single-rule alias for rules diff; use --code when the published snapshots have no stable ID."
},
{
name: "get",