Merge pull request #228 from yunyingk/mac15/sink-report-templates-to-domain

Consolidate report templates into reports domain and ignore reports
This commit is contained in:
yunyingk authored and GitHub committed 2026-10-12 16:49:19 +08:00
commit d3659c076c
17 files changed
+24 -22

No files matched your search

+1
View File
@@ -12,6 +12,7 @@ tmp/
# Local runtime state (rule snapshots, bridge, reports) — never committed
.local/
reports/
# Developer-only build-time credentials for compile-time injection — never committed
.env.langfuse
+1
View File
@@ -12,6 +12,7 @@ tmp/
# Local runtime state (rule snapshots, bridge, reports) — never committed
.local/
reports/
# Developer-only build-time credentials for compile-time injection — never committed
.env.langfuse
+2 -2
View File
@@ -28,10 +28,10 @@ const files = walk(skillRoot).map((fullPath) => ({
}));
// The skill's report reference is owned by the repository too; install it without maintaining a second copy.
const reportReadme = resolve(root, "report-templates", "README.md");
const reportReadme = resolve(root, "src", "domains", "seal", "reports", "templates", "README.md");
files.push({
fullPath: reportReadme,
relativePath: "report-templates/README.md",
relativePath: "references/report-templates.md",
importPath: relative(resolve(root, "src", "core"), reportReadme).split("\\").join("/"),
kind: "text"
});
+2 -2
View File
@@ -99,7 +99,7 @@ Hose 专属命令应从命令名或选项中明确可见:`auth hose-*`、`appr
| Langfuse trace 检索、observation IO、session 大纲、规则/附件流追踪 | `references/langfuse-trace.md` | 已定位到 trace 后需要附件归因时,再读 `approval-attachment-trace.md` |
| 附件、发票、收据、OCR 或界面高亮结论争议 | `references/approval-attachment-trace.md` | 先完成追踪和归因后,才读 `approval-bad-cases.md` 做案例对照 |
| 已完成当前追踪后的相似坏案例对照 | `references/approval-bad-cases.md` | 不能作为首次诊断入口 |
| 月度审核准确率报告、月报生成、accuracy report | 本文「月度审核准确率报告」一节 | 校验/渲染参数先查 `seal-use report render --help`;CLI 安装的 Skill 另附 `report-templates/README.md` |
| 月度审核准确率报告、月报生成、accuracy report | 本文「月度审核准确率报告」一节 | 校验/渲染参数先查 `seal-use report render --help`;CLI 安装的 Skill 另附 `references/report-templates.md` |
冲突时遵循三条优先级:材料获取先于来源判断;来源判断先于 Hose 具体探测;审批事实追踪先于坏案例类比。跨阶段请求也要按阶段顺序读取,不能用后置 reference 替代前置 reference。
@@ -136,7 +136,7 @@ seal-use report validate reports/报告.md
seal-use report render reports/报告.md --out build/报告
```
按模板结构(`report-templates/monthly.md`)自动从效能/风险/审批运行接口取数填充,返回填充后的 Markdown、各章节数据完备度(`sections`)与数据缺口标注(`notes`)。要点:
按模板结构(内置 `monthly.md`)自动从效能/风险/审批运行接口取数填充,返回填充后的 Markdown、各章节数据完备度(`sections`)与数据缺口标注(`notes`)。要点:
- **模板是可变的皮**:章节增删改名只要关键词仍命中,取数需求自动跟着走(`src/domains/seal/reports/describe.ts`)。改模板通常不用改代码。
- **无上游口径不编造**:人工审核准确率、失准原因分类等取不到的指标,保留模板示例值并在表后追加 `> ⚠️ 数据说明` 标注来源缺口——如实告知而非填假数字。
+3 -3
View File
@@ -23,7 +23,7 @@ import file19 from "../../skills/seal-use/references/rule-lightweight.md" with {
import file20 from "../../skills/seal-use/references/rule-lint.md" with { type: "text" };
import file21 from "../../skills/seal-use/references/staging-simulation-workflow.md" with { type: "text" };
import file22 from "../../skills/seal-use/references/webhook-resource-pack.md" with { type: "text" };
import file23 from "../../report-templates/README.md" with { type: "text" };
import file23 from "../domains/seal/reports/templates/README.md" with { type: "text" };
export const EMBEDDED_SKILL_TEXT_FILES: Record<string, string> = {
"SKILL.md": file0,
@@ -43,7 +43,7 @@ export const EMBEDDED_SKILL_TEXT_FILES: Record<string, string> = {
"references/rule-lint.md": file20,
"references/staging-simulation-workflow.md": file21,
"references/webhook-resource-pack.md": file22,
"report-templates/README.md": file23,
"references/report-templates.md": file23,
};
export const EMBEDDED_SKILL_ASSET_DATA: Record<string, string> = {
@@ -79,5 +79,5 @@ export const EMBEDDED_SKILL_ALL_PATHS = [
"references/rule-lint.md",
"references/staging-simulation-workflow.md",
"references/webhook-resource-pack.md",
"report-templates/README.md",
"references/report-templates.md",
];
+1 -1
View File
@@ -16,7 +16,7 @@ export const reportCapabilities = [
templatePath: z
.string()
.optional()
.describe("自定义模板 Markdown 路径;缺省用随 CLI 内嵌的仓内 report-templates/monthly.md,不依赖当前目录"),
.describe("自定义模板 Markdown 路径;缺省用随 CLI 内嵌的仓内 monthly.md,不依赖当前目录"),
reportId: z.string().optional().describe("自定义报告编号(RPT-YYYYMM-XXXXXX)"),
maxRuns: z
.number()
+2 -2
View File
@@ -42,8 +42,8 @@ function localReport(dir: string, content = validReport) {
describe("bundled report templates", () => {
test("monthly ignores cwd templates and returns the same generated id as the document", async () => {
const dir = workspace();
mkdirSync(join(dir, "report-templates"));
writeFileSync(join(dir, "report-templates", "monthly.md"), "# IMPOSTOR");
mkdirSync(join(dir, "templates"));
writeFileSync(join(dir, "templates", "monthly.md"), "# IMPOSTOR");
process.chdir(dir);
const client = { get: async () => ({ json: async () => ({ data: { records: [] } }) }) } as never;
const result = await buildMonthlyReport(client, { month: "2026-08", corp: { id: "test-corp", name: "测试企业" } });
+1 -1
View File
@@ -11,7 +11,7 @@ import { renderMonthlyReport, type RenderOptions } from "./render.js";
export type MonthlyReportOptions = {
month: string; // YYYY-MM
corp: { id: string; name: string };
/** 模板路径;缺省用仓内 report-templates/monthly.md,随二进制内嵌 */
/** 模板路径;缺省用仓内内置 monthly.md,随二进制内嵌 */
templatePath?: string;
reportId?: string;
maxRuns?: number;
+1 -1
View File
@@ -7,7 +7,7 @@ import { collectReportData, type ReportData } from "./collect.js";
import { renderMonthlyReport } from "./render.js";
import { loadReviews, writeReview, reviewFilePath } from "./review-store.js";
const TEMPLATE = join(import.meta.dirname, "..", "..", "..", "..", "report-templates", "monthly.md");
const TEMPLATE = join(import.meta.dirname, "templates", "monthly.md");
function sampleData(overrides: Partial<ReportData> = {}): ReportData {
return {
+6 -6
View File
@@ -1,12 +1,12 @@
import monthly from "../../../../report-templates/monthly.md" with { type: "text" };
import css from "../../../../report-templates/report.css" with { type: "text" };
import accuracy from "../../../../report-templates/assets/图1-准确率对比.svg" with { type: "text" };
import benefits from "../../../../report-templates/assets/图2-综合效益.svg" with { type: "text" };
import screenshot from "../../../../report-templates/assets/图3-示例截图.svg" with { type: "text" };
import monthly from "./templates/monthly.md" with { type: "text" };
import css from "./templates/report.css" with { type: "text" };
import accuracy from "./templates/assets/图1-准确率对比.svg" with { type: "text" };
import benefits from "./templates/assets/图2-综合效益.svg" with { type: "text" };
import screenshot from "./templates/assets/图3-示例截图.svg" with { type: "text" };
// Git owns the source files; Bun embeds these imports in both developer and release binaries.
// Loading the built-in template never depends on cwd, a checkout, or skill installation.
export const BUILTIN_TEMPLATE_PATH = "builtin:report-templates/monthly.md";
export const BUILTIN_TEMPLATE_PATH = "builtin:reports/templates/monthly.md";
export const BUILTIN_MONTHLY_TEMPLATE = monthly;
export const REPORT_CSS = css;
export const REPORT_ASSETS: Record<string, string> = {
@@ -11,12 +11,12 @@
模板纪律见模板仓库 README:不引入 frontmatter/占位符标记(结构即契约)、正文不含 HTML 注释、表格只换数据行。
默认模板和配图由本仓库 Git 管理,构建时直接内嵌进二进制;无需原模板仓库、当前目录下的 `report-templates/` 或已安装的 Skill。模板修改通过 PR 合入,再随构建/发版分发。`--template` 仅用于显式覆盖。
默认模板和配图由本仓库 Git 管理(位于 `src/domains/seal/reports/templates/`),构建时直接内嵌进二进制;无需外置模板目录或已安装的 Skill。模板修改通过 PR 合入,再随构建/发版分发。`--template` 仅用于显式覆盖。
```bash
seal-use report monthly --month 2026-08 --corp <corpId> --out reports/报告.md
seal-use report validate reports/报告.md
seal-use report render reports/报告.md --out build/报告
seal-use report monthly --month 2026-08 --corp <corpId> --out 报告.md
seal-use report validate 报告.md
seal-use report render 报告.md --out build/报告
```
`monthly --out` 保存 Markdown 和同目录的 `<报告名>.assets/` 配图目录,返回文件路径、数据缺口与后续命令;不指定 `--out` 时继续返回 `content`。自定义模板的本地配图也一并复制。已有文件默认拒绝覆盖,显式 `--overwrite` 才允许替换。通用 `--output-file` 仍只保存 JSON,与 `--out` 不同。
File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 605 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 581 B

After

Width:  |  Height:  |  Size: 581 B

File renamed without changes.
File renamed without changes.