Add stable-ID rule version diff
This commit is contained in:
1 parent
c4428efd19
commit
a8a28623df
9 files changed
+599
-158
No files matched your search
@@ -112,6 +112,28 @@ export async function handleRulesCommand(
|
||||
return;
|
||||
}
|
||||
|
||||
if (action === "diff") {
|
||||
const from = stringOption(args.options.from) ?? maybeName;
|
||||
const to = stringOption(args.options.to) ?? args.command[3];
|
||||
if (!from || !to) {
|
||||
throw new Error("Usage: seal-use rules diff <fromVersion> <toVersion> [--rule-id <stableRuleId>]");
|
||||
}
|
||||
await runTool(
|
||||
"seal_approval_rule_version_diff",
|
||||
client,
|
||||
corp,
|
||||
{
|
||||
from,
|
||||
to,
|
||||
ruleId: stringOption(args.options.ruleId) ?? stringOption(args.options["rule-id"]),
|
||||
includeUnchanged: booleanOption(args.options.includeUnchanged) ?? booleanOption(args.options["include-unchanged"]),
|
||||
format: stringOption(args.options.format)
|
||||
},
|
||||
outputOptions(args.options)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (action === "get") {
|
||||
await runTool(
|
||||
"seal_approval_rule_get",
|
||||
@@ -260,5 +282,5 @@ export async function handleRulesCommand(
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error(`Unknown rules command: ${action ?? ""}. Available: count, list, clear, versions, version, get, search, lint, linters, pull, push, map. Run 'seal-use help' for available commands.`);
|
||||
throw new Error(`Unknown rules command: ${action ?? ""}. Available: count, list, clear, versions, version, diff, get, search, lint, linters, pull, push, map. Run 'seal-use help' for available commands.`);
|
||||
}
|
||||
@@ -243,6 +243,17 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
summary: "Inspect a specific rule version",
|
||||
usage: ["seal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]"]
|
||||
},
|
||||
{
|
||||
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>]"],
|
||||
options: [
|
||||
{ flag: "--rule-id <id>", description: "Compare only one stable rule ID; never fall back to code or position" },
|
||||
{ flag: "--include-unchanged", description: "Include unchanged rules in the structured changes list" },
|
||||
{ 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."
|
||||
},
|
||||
{
|
||||
name: "get",
|
||||
summary: "Get single rule by code or record ID",
|
||||
|
||||
@@ -28,7 +28,7 @@ const AREA_ALIASES: Record<string, string> = {
|
||||
*/
|
||||
const READ_ONLY_COMMANDS: Record<string, string[]> = {
|
||||
corps: ["list", "search", "get", "current"],
|
||||
rules: ["count", "list", "versions", "version", "get", "search", "lint", "linters", "pull", "map"],
|
||||
rules: ["count", "list", "versions", "version", "diff", "get", "search", "lint", "linters", "pull", "map"],
|
||||
webhook: ["ready", "status", "list", "get", "resource-pack export", "resource-pack preview"],
|
||||
"approval-runs": [
|
||||
"summary",
|
||||
|
||||
Reference in new issue
Block a user