feat: 增加 SealAI 官方规则 CSV 导出
This commit is contained in:
1 parent
382fc1a7ae
commit
f454d62be1
14 files changed
+143
-9
No files matched your search
@@ -327,6 +327,19 @@ export async function handleRulesCommand(
|
||||
if (action === "pull") {
|
||||
const version = resolveVersionOption(args, maybeName);
|
||||
const out = stringOption(args.options.out) ?? stringOption(args.options.file) ?? stringOption(args.options.f);
|
||||
if (booleanOption(args.options.official) === true) {
|
||||
if (version) {
|
||||
throw usageError("rules pull --official uses SealAI's official current-rules CSV export and cannot be combined with --version.");
|
||||
}
|
||||
await runCapability(
|
||||
"sealApprovalRulesExportCsv",
|
||||
client!,
|
||||
corp,
|
||||
{ out },
|
||||
outputOptions(args.options)
|
||||
);
|
||||
return;
|
||||
}
|
||||
await runCapability(
|
||||
"sealApprovalRulesPull",
|
||||
client!,
|
||||
|
||||
+7
-2
@@ -340,8 +340,13 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
},
|
||||
{
|
||||
name: "pull",
|
||||
summary: "Export rules to local JSON file",
|
||||
usage: ["seal-use rules pull [--version <number|latest>] [--out <file>] [--corp <corpId>]"]
|
||||
summary: "Pull rules as local JSON, or use --official for the server-generated CSV",
|
||||
usage: ["seal-use rules pull [--official] [--version <number|latest>] [--out <file>] [--corp <corpId>]"],
|
||||
options: [
|
||||
{ flag: "--official", description: "Call SealAI's official CSV export endpoint and save its returned CSV unchanged; cannot be combined with --version" },
|
||||
{ flag: "--version <number|latest>", description: "Pull a published version as JSON; unavailable with --official" },
|
||||
{ flag: "--out <file>", description: "Output path; defaults to ./rules.local.json for JSON or Downloads for official CSV" }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "push",
|
||||
|
||||
@@ -27,6 +27,10 @@ describe("parseArgs flag handling", () => {
|
||||
expect(parseArgs(["corps", "list", "--all"]).options.all).toBe(true);
|
||||
});
|
||||
|
||||
test("rules pull official is parsed as a boolean flag", () => {
|
||||
expect(parseArgs(["rules", "pull", "--official"]).options.official).toBe(true);
|
||||
});
|
||||
|
||||
test("value flags consume exactly one token", () => {
|
||||
const parsed = parseArgs(["approval-runs", "list", "--limit", "25", "--status", "completed"]);
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export const BOOLEAN_FLAGS = new Set([
|
||||
"exclude-deleted", "extract", "extract-expenses", "extractExpenses", "fail-on-flips", "flow", "force", "full", "glossary", "has-input", "has-output", "help",
|
||||
"has-extra-risk", "hasExtraRisk", "hose", "hose-outbound", "hose-sso", "hoseOutbound", "hoseSso", "include-deleted", "include-io-preview", "include-simulation", "include-unchanged",
|
||||
"include-bridge", "includeBridge", "includeSimulation", "includeUnchanged", "local", "no-attachments", "no-flow", "no-glossary",
|
||||
"no-wait", "noWait", "outbound", "overwrite", "plain", "publish", "quiet",
|
||||
"no-wait", "noWait", "official", "outbound", "overwrite", "plain", "publish", "quiet",
|
||||
"r", "raw-json", "rawJson", "recode", "refresh", "refresh-if-missing", "reveal", "rotate-secret", "rotateSecret",
|
||||
"save", "silent", "silent-save", "simulation", "skip-expense-extraction", "skip-extract", "skip-invoice-generation",
|
||||
"skipExpenseExtraction", "skipExtract", "skipInvoiceGeneration", "snippet-only", "snippetOnly", "sso", "strict",
|
||||
|
||||
Reference in new issue
Block a user