Add 4x Venn chart renderer and report package export
This commit is contained in:
1 parent
f788f9c6db
commit
c4a1148cbf
9 files changed
+281
-64
No files matched your search
@@ -4,15 +4,15 @@ import { runCapabilityResult } from "../helpers.js";
|
||||
import { booleanOption, numberOption, stringOption } from "../parser.js";
|
||||
import { outputOptions, printJson } from "../printer.js";
|
||||
import { CliError, usageError } from "../../core/errors.js";
|
||||
import { renderReportFile, saveReportMarkdown, validateReportFile } from "../../domains/seal/reports/files.js";
|
||||
import { exportReportPackage, renderReportFile, saveReportMarkdown, validateReportFile } from "../../domains/seal/reports/files.js";
|
||||
import type { MonthlyReportResult } from "../../domains/seal/reports/monthly.js";
|
||||
import { loadReviews, reviewFilePath, writeReview } from "../../domains/seal/reports/review-store.js";
|
||||
import type { ParsedArgs } from "../types.js";
|
||||
|
||||
/** Tenant-free commands: dispatch these before resolving enterprise configuration or authentication. */
|
||||
export async function handleLocalReportCommand(action: "validate" | "render", args: ParsedArgs) {
|
||||
export async function handleLocalReportCommand(action: "validate" | "render" | "export", args: ParsedArgs) {
|
||||
const file = args.command[2] ?? stringOption(args.options.file);
|
||||
if (!file) throw usageError(`Usage: seal-use report ${action} <报告文件.md>${action === "render" ? " --out <产物路径词干>" : ""}`);
|
||||
if (!file) throw usageError(`Usage: seal-use report ${action} <报告文件.md>${action === "render" ? " --out <产物路径词干>" : action === "export" ? " --out <目标文件夹>" : ""}`);
|
||||
if ("python" in args.options) throw usageError("报告工具已移除 Python 依赖,请去掉 --python 参数。");
|
||||
if (action === "validate") {
|
||||
const result = await validateReportFile(file);
|
||||
@@ -21,7 +21,16 @@ export async function handleLocalReportCommand(action: "validate" | "render", ar
|
||||
return;
|
||||
}
|
||||
const out = stringOption(args.options.out) ?? stringOption(args.options.o);
|
||||
if (!out) throw usageError("Usage: seal-use report render <报告文件.md> --out <产物路径词干>");
|
||||
if (!out) throw usageError(`Usage: seal-use report ${action} <报告文件.md> --out <${action === "export" ? "目标文件夹" : "产物路径词干"}>`);
|
||||
if (action === "export") {
|
||||
const result = await exportReportPackage(file, {
|
||||
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));
|
||||
if (!result.validation.valid) throw new CliError("报告校验未通过,未生成完整导出包。请按 validation.issues 修正后重试。", 1);
|
||||
return;
|
||||
}
|
||||
const result = await renderReportFile(file, {
|
||||
out, format: stringOption(args.options.format), width: numberOption(args.options.width),
|
||||
chrome: stringOption(args.options.chrome), overwrite: booleanOption(args.options.overwrite)
|
||||
|
||||
@@ -648,6 +648,19 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
],
|
||||
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: "export",
|
||||
summary: "Package Markdown, local 4x assets, self-contained HTML, and PDF into a dedicated directory",
|
||||
usage: ["seal-use report export <报告.md> --out <输出目录> [--format <all|html|pdf>]"],
|
||||
options: [
|
||||
{ flag: "--out <dir>", description: "Dedicated output directory for the report bundle" },
|
||||
{ flag: "--format <format>", description: "all (default), html, or pdf" },
|
||||
{ flag: "--width <px>", description: "PNG viewport width, default 1200" },
|
||||
{ flag: "--chrome <executable>", description: "Chrome/Chromium executable; otherwise auto-detected" },
|
||||
{ flag: "--overwrite", description: "Explicitly permit replacing existing output files" }
|
||||
],
|
||||
description: "Bundles the report into a clean single directory: includes the Markdown with its .md.assets/ companion folder, plus self-contained HTML and print-ready PDF."
|
||||
},
|
||||
{
|
||||
name: "review set",
|
||||
summary: "Record one human adjudication (who was right: AI or human) for a document",
|
||||
|
||||
+1
-1
@@ -224,7 +224,7 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (area === "report" && (action === "validate" || action === "render")) {
|
||||
if (area === "report" && (action === "validate" || action === "render" || action === "export")) {
|
||||
await (await import("./commands/report.js")).handleLocalReportCommand(action, args);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user