Remove Python from report validation and rendering
This commit is contained in:
1 parent
c1a5cc20e9
commit
fb7948307c
19 files changed
+743
-90
No files matched your search
@@ -13,9 +13,9 @@ import type { ParsedArgs } from "../types.js";
|
||||
export async function handleLocalReportCommand(action: "validate" | "render", args: ParsedArgs) {
|
||||
const file = args.command[2] ?? stringOption(args.options.file);
|
||||
if (!file) throw usageError(`Usage: seal-use report ${action} <报告文件.md>${action === "render" ? " --out <产物路径词干>" : ""}`);
|
||||
const python = stringOption(args.options.python);
|
||||
if ("python" in args.options) throw usageError("报告工具已移除 Python 依赖,请去掉 --python 参数。");
|
||||
if (action === "validate") {
|
||||
const result = await validateReportFile(file, { python });
|
||||
const result = await validateReportFile(file);
|
||||
printJson(result, outputOptions(args.options));
|
||||
if (!result.valid) throw new CliError("报告校验未通过,请按 issues 修正后重试。", 1);
|
||||
return;
|
||||
@@ -23,7 +23,7 @@ export async function handleLocalReportCommand(action: "validate" | "render", ar
|
||||
const out = stringOption(args.options.out) ?? stringOption(args.options.o);
|
||||
if (!out) throw usageError("Usage: seal-use report render <报告文件.md> --out <产物路径词干>");
|
||||
const result = await renderReportFile(file, {
|
||||
out, python, format: stringOption(args.options.format), width: numberOption(args.options.width),
|
||||
out, format: stringOption(args.options.format), width: numberOption(args.options.width),
|
||||
chrome: stringOption(args.options.chrome), overwrite: booleanOption(args.options.overwrite)
|
||||
});
|
||||
printJson(result, outputOptions(args.options));
|
||||
|
||||
+3
-4
@@ -631,8 +631,8 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{
|
||||
name: "validate",
|
||||
summary: "Check a local report's structure, images, totals, and formulas",
|
||||
usage: ["seal-use report validate <报告.md> [--python <executable>]"],
|
||||
options: [{ flag: "--python <executable>", description: "Python 3 executable; defaults to python3 on PATH" }],
|
||||
usage: ["seal-use report validate <报告.md>"],
|
||||
options: [],
|
||||
description: "Local only: no --corp, credentials, or Seal requests. Returns JSON issues; exit 1 if validation fails."
|
||||
},
|
||||
{
|
||||
@@ -643,11 +643,10 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{ flag: "--out <stem>", description: "Output filename stem; extensions are appended" },
|
||||
{ flag: "--format <format>", description: "all (default), html, png, or pdf; PNG/PDF also produce HTML" },
|
||||
{ flag: "--width <px>", description: "PNG viewport width, default 1200 (320–5000)" },
|
||||
{ flag: "--python <executable>", description: "Python 3 executable; defaults to python3 on PATH" },
|
||||
{ flag: "--chrome <executable>", description: "Chrome/Chromium executable; otherwise auto-detected" },
|
||||
{ flag: "--overwrite", description: "Explicitly permit replacing existing output files after successful rendering" }
|
||||
],
|
||||
description: "No enterprise login. Validation failure produces JSON issues and no artifacts. Requires Python 3; PNG/PDF also need Chrome/Chromium, PNG needs Pillow. First use of math fetches and caches KaTeX resources. Markdown parsing is bundled, with no runtime npm/npx dependency."
|
||||
description: "No enterprise login. Validation failure produces JSON issues and no artifacts. Validation and HTML use the bundled runtime; PNG/PDF need Chrome/Chromium. No Python or Pillow required. First use of math fetches and caches KaTeX resources. Markdown parsing is bundled, with no runtime npm/npx dependency."
|
||||
},
|
||||
{
|
||||
name: "review set",
|
||||
|
||||
+3
-2
@@ -61,7 +61,7 @@ export const VALUE_FLAGS = new Set([
|
||||
"out-dir", "outDir", "outgoing-result-webhook", "outgoingResultWebhook", "output", "output-file",
|
||||
"outputFile", "p", "package-id", "package-ids", "packageId", "packageIds",
|
||||
"path", "phone", "policyId", "poll-interval", "pollInterval", "port",
|
||||
"prod", "prod-corp", "prodCorp", "purpose", "python", "q", "query",
|
||||
"prod", "prod-corp", "prodCorp", "purpose", "q", "query",
|
||||
"record-id", "record-ids", "recordId", "recordIds", "reject-node", "rejectNode", "rejection-num", "rejectionNum",
|
||||
"reviewed-by", "reviewedBy",
|
||||
"report-id",
|
||||
@@ -115,7 +115,7 @@ export const KNOWN_FLAGS = new Set([
|
||||
"outgoing-result-webhook", "outgoingResultWebhook", "output", "output-file", "outputFile", "overwrite",
|
||||
"p", "package-id", "package-ids", "packageId", "packageIds", "path",
|
||||
"phone", "plain", "policyId", "poll-interval", "pollInterval", "port",
|
||||
"prod", "prod-corp", "prodCorp", "publish", "purpose", "python", "q",
|
||||
"prod", "prod-corp", "prodCorp", "publish", "purpose", "q",
|
||||
"query", "quiet", "r", "recode", "record-id", "record-ids",
|
||||
"recordId", "recordIds", "refresh", "refresh-if-missing", "reject-node", "rejectNode", "rejection-num", "rejectionNum", "repo",
|
||||
"report-id",
|
||||
@@ -169,6 +169,7 @@ export function parseArgs(argv: string[]): ParsedArgs {
|
||||
const eqIdx = raw.indexOf("=");
|
||||
const key = raw.slice(0, eqIdx);
|
||||
const val = raw.slice(eqIdx + 1);
|
||||
if (key === "python") throw usageError("--python 已移除:报告工具不再依赖 Python。");
|
||||
options[key] = val;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user