Standardize export date range, defaults, and 180-day safety limit

This commit is contained in:
gitea committed 2026-09-14 10:13:19 +08:00
1 parent c5aa1c9958
commit a39ad09278
12 files changed
+475 -202

No files matched your search

+2 -1
View File
@@ -84,7 +84,8 @@ export async function handleAnalyticsCommand(
endDate: stringOption(args.options.endDate) ?? stringOption(args.options["end-date"]),
limit: numberOption(args.options.limit),
outputFile: stringOption(args.options.out) ?? stringOption(args.options["output-file"]) ?? stringOption(args.options.outputFile),
toDownloads: booleanOption(args.options.downloads) ?? booleanOption(args.options["to-downloads"])
toDownloads: booleanOption(args.options.downloads) ?? booleanOption(args.options["to-downloads"]),
force: booleanOption(args.options.force)
});
printJson(result);
return;
+2 -1
View File
@@ -332,7 +332,8 @@ export async function handleApprovalRunsCommand(
stringOption(args.options.out) ??
stringOption(args.options.output) ??
stringOption(args.options.file),
toDownloads: booleanOption(args.options.downloads) ?? booleanOption(args.options.download)
toDownloads: booleanOption(args.options.downloads) ?? booleanOption(args.options.download),
force: booleanOption(args.options.force)
});
printJson(result, outputOptions(args.options));
return;
+9 -1
View File
@@ -226,6 +226,14 @@ describe("CLI help execution for lifecycle commands", () => {
expect(result.exitCode).toBe(0);
expect(result.isError).toBe(false);
expect(result.stdout).toContain("approval-runs count [--status APPROVED] [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>]");
expect(result.stdout).toContain("approval-runs export [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--status <status>] [--manual-status <status>] [--completed-only]");
expect(result.stdout).toContain("approval-runs export [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--force] [--status <status>] [--manual-status <status>] [--completed-only]");
});
test("analytics export --help prints force parameter usage", async () => {
const result = await runCli(["analytics", "export", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.isError).toBe(false);
expect(result.stdout).toContain("--force");
expect(result.stdout).toContain("Force export when time range exceeds 180 days");
});
});
+3 -2
View File
@@ -328,7 +328,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
{
name: "export",
summary: "Export approval run audit records to Excel workbook",
usage: ["seal-use approval-runs export [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--status <status>] [--manual-status <status>] [--completed-only] [--limit <n>] [--downloads] [--out <file>] [--corp <corpId>]"]
usage: ["seal-use approval-runs export [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--force] [--status <status>] [--manual-status <status>] [--completed-only] [--limit <n>] [--downloads] [--out <file>] [--corp <corpId>]"]
},
{
name: "list",
@@ -796,12 +796,13 @@ export const HELP_REGISTRY: AreaHelp[] = [
name: "export",
aliases: ["report", "download"],
summary: "Export smart insights risk report to high-fidelity Excel workbook",
usage: ["seal-use analytics export [--downloads] [--out <file>] [--start-date <ISO>] [--end-date <ISO>] [--limit <n>] [--corp <corpId>]"],
usage: ["seal-use analytics export [--downloads] [--out <file>] [--start-date <ISO>] [--end-date <ISO>] [--force] [--limit <n>] [--corp <corpId>]"],
options: [
{ flag: "--downloads", description: "Save directly to the user's Downloads directory" },
{ flag: "--out <file>", description: "Custom destination file path" },
{ flag: "--start-date <ISO>", description: "Filter beginning time range" },
{ flag: "--end-date <ISO>", description: "Filter ending time range" },
{ flag: "--force", description: "Force export when time range exceeds 180 days" },
{ flag: "--limit <n>", description: "Maximum risk tags to drill down into" }
]
}