diff --git a/.gitignore b/.gitignore index 1032be1..148293c 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.zcodeignore b/.zcodeignore index 148da44..bfdaa64 100644 --- a/.zcodeignore +++ b/.zcodeignore @@ -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 diff --git a/scripts/generate-embedded-skill.mjs b/scripts/generate-embedded-skill.mjs index c32ece3..aeb21e4 100644 --- a/scripts/generate-embedded-skill.mjs +++ b/scripts/generate-embedded-skill.mjs @@ -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" }); diff --git a/skills/seal-use/SKILL.md b/skills/seal-use/SKILL.md index 263c1bf..7ddb08a 100644 --- a/skills/seal-use/SKILL.md +++ b/skills/seal-use/SKILL.md @@ -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`)。改模板通常不用改代码。 - **无上游口径不编造**:人工审核准确率、失准原因分类等取不到的指标,保留模板示例值并在表后追加 `> ⚠️ 数据说明` 标注来源缺口——如实告知而非填假数字。 diff --git a/src/core/embedded-skill.generated.ts b/src/core/embedded-skill.generated.ts index 8e934ba..a871e68 100644 --- a/src/core/embedded-skill.generated.ts +++ b/src/core/embedded-skill.generated.ts @@ -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 = { "SKILL.md": file0, @@ -43,7 +43,7 @@ export const EMBEDDED_SKILL_TEXT_FILES: Record = { "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 = { @@ -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", ]; diff --git a/src/domains/seal/capabilities/reports.ts b/src/domains/seal/capabilities/reports.ts index 1f75ed3..8fd2b65 100644 --- a/src/domains/seal/capabilities/reports.ts +++ b/src/domains/seal/capabilities/reports.ts @@ -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() diff --git a/src/domains/seal/reports/files.test.ts b/src/domains/seal/reports/files.test.ts index d6ff4f5..c0017da 100644 --- a/src/domains/seal/reports/files.test.ts +++ b/src/domains/seal/reports/files.test.ts @@ -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: "测试企业" } }); diff --git a/src/domains/seal/reports/monthly.ts b/src/domains/seal/reports/monthly.ts index 7872e93..4600ff0 100644 --- a/src/domains/seal/reports/monthly.ts +++ b/src/domains/seal/reports/monthly.ts @@ -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; diff --git a/src/domains/seal/reports/reports.test.ts b/src/domains/seal/reports/reports.test.ts index c4c1fa4..f0be9fa 100644 --- a/src/domains/seal/reports/reports.test.ts +++ b/src/domains/seal/reports/reports.test.ts @@ -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 { return { diff --git a/src/domains/seal/reports/resources.ts b/src/domains/seal/reports/resources.ts index 3511dc0..392218a 100644 --- a/src/domains/seal/reports/resources.ts +++ b/src/domains/seal/reports/resources.ts @@ -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 = { diff --git a/report-templates/README.md b/src/domains/seal/reports/templates/README.md similarity index 84% rename from report-templates/README.md rename to src/domains/seal/reports/templates/README.md index 660f801..55a4b04 100644 --- a/report-templates/README.md +++ b/src/domains/seal/reports/templates/README.md @@ -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 --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 --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` 不同。 diff --git a/report-templates/assets/图1-准确率对比.svg b/src/domains/seal/reports/templates/assets/图1-准确率对比.svg similarity index 100% rename from report-templates/assets/图1-准确率对比.svg rename to src/domains/seal/reports/templates/assets/图1-准确率对比.svg diff --git a/report-templates/assets/图2-综合效益.svg b/src/domains/seal/reports/templates/assets/图2-综合效益.svg similarity index 100% rename from report-templates/assets/图2-综合效益.svg rename to src/domains/seal/reports/templates/assets/图2-综合效益.svg diff --git a/report-templates/assets/图3-示例截图.svg b/src/domains/seal/reports/templates/assets/图3-示例截图.svg similarity index 100% rename from report-templates/assets/图3-示例截图.svg rename to src/domains/seal/reports/templates/assets/图3-示例截图.svg diff --git a/report-templates/examples/赢家时尚-202608.md b/src/domains/seal/reports/templates/examples/赢家时尚-202608.md similarity index 100% rename from report-templates/examples/赢家时尚-202608.md rename to src/domains/seal/reports/templates/examples/赢家时尚-202608.md diff --git a/report-templates/monthly.md b/src/domains/seal/reports/templates/monthly.md similarity index 100% rename from report-templates/monthly.md rename to src/domains/seal/reports/templates/monthly.md diff --git a/report-templates/report.css b/src/domains/seal/reports/templates/report.css similarity index 100% rename from report-templates/report.css rename to src/domains/seal/reports/templates/report.css