Refine report data collection to support unlimited runs without 500 cap
This commit is contained in:
1 parent
bea6a9cf4e
commit
04915c6ad6
7 files changed
+104
-21
No files matched your search
@@ -95,6 +95,16 @@ export async function handleLocalReportCommand(action: string | undefined, args:
|
||||
if (!result.validation.valid) throw new CliError("报告校验未通过,未生成渲染产物。请按 validation.issues 修正后重试。", 1);
|
||||
}
|
||||
|
||||
function resolveMaxRuns(args: ParsedArgs): number | undefined {
|
||||
return (
|
||||
numberOption(args.options.limit) ??
|
||||
numberOption(args.options.n) ??
|
||||
numberOption(args.options.count) ??
|
||||
numberOption(args.options["max-runs"]) ??
|
||||
numberOption(args.options.maxRuns)
|
||||
);
|
||||
}
|
||||
|
||||
/** `seal-use report generate` / `ledger` / `data` — AI 审核报告。 */
|
||||
export async function handleReportCommand(
|
||||
action: string | undefined,
|
||||
@@ -125,7 +135,7 @@ export async function handleReportCommand(
|
||||
|
||||
if ((!startDate || !endDate) && !month) {
|
||||
throw usageError(
|
||||
"Usage: seal-use report ledger --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD> [--templates <t1,t2...>] [--max-runs <n>] [--out <file.xlsx|csv>] [--corp <corpId>]"
|
||||
"Usage: seal-use report ledger --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD> [--templates <t1,t2...>] [--limit <n>] [--out <file.xlsx|csv>] [--corp <corpId>]"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,7 +146,7 @@ export async function handleReportCommand(
|
||||
month,
|
||||
corp: { id: corp.id, name: corp.name },
|
||||
templates,
|
||||
maxRuns: numberOption(args.options["max-runs"]) ?? numberOption(args.options.maxRuns)
|
||||
maxRuns: resolveMaxRuns(args)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -186,7 +196,7 @@ export async function handleReportCommand(
|
||||
|
||||
if (!ledgerPath && (!startDate || !endDate) && !month) {
|
||||
throw usageError(
|
||||
"Usage: seal-use report data (--ledger <台账.xlsx> | --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>) [--templates <t1,t2...>] [--max-runs <n>] [--corp <corpId>]"
|
||||
"Usage: seal-use report data (--ledger <台账.xlsx> | --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>) [--templates <t1,t2...>] [--limit <n>] [--corp <corpId>]"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -202,7 +212,7 @@ export async function handleReportCommand(
|
||||
month,
|
||||
templates,
|
||||
ledgerPath,
|
||||
maxRuns: numberOption(args.options["max-runs"]) ?? numberOption(args.options.maxRuns)
|
||||
maxRuns: resolveMaxRuns(args)
|
||||
}
|
||||
);
|
||||
printJson(result, outputOptions(args.options));
|
||||
@@ -225,7 +235,7 @@ export async function handleReportCommand(
|
||||
|
||||
if (!ledgerPath && (!startDate || !endDate) && !month) {
|
||||
throw usageError(
|
||||
"Usage: seal-use report generate (--ledger <台账.xlsx> | --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>) [--templates <t1,t2...>] [--template <file>] [--report-id <RPT-...>] [--corp <corpId>]"
|
||||
"Usage: seal-use report generate (--ledger <台账.xlsx> | --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>) [--templates <t1,t2...>] [--limit <n>] [--template <file>] [--report-id <RPT-...>] [--corp <corpId>]"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -243,7 +253,7 @@ export async function handleReportCommand(
|
||||
ledgerPath,
|
||||
templatePath: stringOption(args.options.template),
|
||||
reportId: stringOption(args.options["report-id"]) ?? stringOption(args.options.reportId),
|
||||
maxRuns: numberOption(args.options["max-runs"]) ?? numberOption(args.options.maxRuns),
|
||||
maxRuns: resolveMaxRuns(args),
|
||||
allowUnreviewed: booleanOption(args.options["allow-unreviewed"]) ?? booleanOption(args.options.force)
|
||||
}
|
||||
) as MonthlyReportResult;
|
||||
|
||||
+6
-6
@@ -625,7 +625,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{
|
||||
name: "ledger",
|
||||
summary: "Export standalone audit run ledger (.xlsx / .csv) with full AI & human opinions",
|
||||
usage: ["seal-use report ledger --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD> [--templates <t1,t2...>] [--out <file.xlsx>] [--corp <corpId>]"],
|
||||
usage: ["seal-use report ledger --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD> [--templates <t1,t2...>] [--limit <n>] [--out <file.xlsx>] [--corp <corpId>]"],
|
||||
options: [
|
||||
{ flag: "--start-date <YYYY-MM-DD>", description: "Statistics start date, YYYY-MM-DD (e.g. 2026-08-12)" },
|
||||
{ flag: "--end-date <YYYY-MM-DD>", description: "Statistics end date, YYYY-MM-DD (e.g. 2026-09-18)" },
|
||||
@@ -633,20 +633,20 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{ flag: "--ledger <file>", description: "Inspect or convert an existing ledger file" },
|
||||
{ flag: "--out <file>", description: "Output path (.xlsx or .csv); defaults to 台账-<corpId>-<period>.xlsx" },
|
||||
{ flag: "--format <xlsx|csv>", description: "Export format (default: xlsx, or inferred from --out)" },
|
||||
{ flag: "--max-runs <n>", description: "Cap approval-run fetch, default 500" }
|
||||
{ flag: "--limit <n>", description: "Cap approval-run fetch (alias: --max-runs, default: all records in period, max 100000)" }
|
||||
],
|
||||
description: "Exports full audit ledger containing recordId, SN, template, AI decisions, full AI opinions & conditions, human results & comments, agreement, and review verdict columns. Agents can freely trim rows/templates and fill verdicts."
|
||||
},
|
||||
{
|
||||
name: "data",
|
||||
summary: "Extract pure structured report data, metrics, diverged runs, and triggers without templates",
|
||||
usage: ["seal-use report data (--ledger <台账.xlsx> | --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>) [--templates <t1,t2...>] [--max-runs <n>] [--corp <corpId>]"],
|
||||
usage: ["seal-use report data (--ledger <台账.xlsx> | --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>) [--templates <t1,t2...>] [--limit <n>] [--corp <corpId>]"],
|
||||
options: [
|
||||
{ flag: "--start-date <YYYY-MM-DD>", description: "Statistics start date, YYYY-MM-DD" },
|
||||
{ flag: "--end-date <YYYY-MM-DD>", description: "Statistics end date, YYYY-MM-DD" },
|
||||
{ flag: "--ledger <file>", description: "Directly parse an edited Excel/CSV ledger file without remote requests" },
|
||||
{ flag: "--templates <names>", description: "Comma-separated template whitelist" },
|
||||
{ flag: "--max-runs <n>", description: "Cap approval-run detail fetch, default 500 (max 500)" }
|
||||
{ flag: "--limit <n>", description: "Cap approval-run detail fetch (alias: --max-runs, default: all records in period, max 100000)" }
|
||||
],
|
||||
description: "Template-free data pack for Agent authoring: returns performance metrics, formula fractions, template groups, top risk tags, diverged runs with exact triggered conditions, and reviews."
|
||||
},
|
||||
@@ -675,7 +675,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
name: "generate",
|
||||
aliases: ["monthly", "month"],
|
||||
summary: "Fill the audit report template with performance, risk, and approval-run data",
|
||||
usage: ["seal-use report generate (--ledger <台账.xlsx> | --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>) [--templates <t1,t2...>] [--out <报告.md>] [--template <file>] [--report-id <RPT-...>] [--max-runs <n>] [--allow-unreviewed] [--corp <corpId>]"],
|
||||
usage: ["seal-use report generate (--ledger <台账.xlsx> | --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>) [--templates <t1,t2...>] [--out <报告.md>] [--template <file>] [--report-id <RPT-...>] [--limit <n>] [--allow-unreviewed] [--corp <corpId>]"],
|
||||
options: [
|
||||
{ flag: "--start-date <YYYY-MM-DD>", description: "Statistics start date, YYYY-MM-DD (e.g. 2026-08-12)" },
|
||||
{ flag: "--end-date <YYYY-MM-DD>", description: "Statistics end date, YYYY-MM-DD (e.g. 2026-09-18)" },
|
||||
@@ -685,7 +685,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{ flag: "--out <file>", description: "Save Markdown plus local images and Excel/CSV ledgers beside the report; stdout stays JSON" },
|
||||
{ flag: "--overwrite", description: "Explicitly permit replacing existing output files" },
|
||||
{ flag: "--report-id <RPT-...>", description: "Custom report id; defaults to RPT-<dateTag>-<random>" },
|
||||
{ flag: "--max-runs <n>", description: "Cap approval-run detail fetch, default 500 (max 500)" },
|
||||
{ flag: "--limit <n>", description: "Cap approval-run detail fetch (alias: --max-runs, default: all records in period, max 100000)" },
|
||||
{ flag: "--allow-unreviewed", description: "Bypass pre-flight adjudication gate to generate draft when unreviewed diverged runs exist" }
|
||||
],
|
||||
description: "The template is the mutable skin: section headings, tables, and order may change and data demands are inferred from headings. Supports direct ledger-driven generation where user/Agent modifications to templates and rows are strictly respected."
|
||||
|
||||
Reference in new issue
Block a user