Skip to content

Commit 9f1945f

Browse files
author
lyfhf
committed
feat: expand report template catalog and fidelity tests
1 parent 6ad2773 commit 9f1945f

37 files changed

Lines changed: 1122 additions & 67 deletions

.github/workflows/smoke-tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
shell: powershell
2525
run: powershell -ExecutionPolicy Bypass -File .\scripts\run-smoke-tests.ps1
2626

27-
- name: Validate five neutral built-in templates
27+
- name: Validate ten neutral built-in templates
2828
shell: powershell
2929
run: powershell -ExecutionPolicy Bypass -File .\tests\run-neutral-template-catalog.ps1
30+
31+
- name: Validate uploaded-template fidelity corpus
32+
shell: powershell
33+
run: powershell -ExecutionPolicy Bypass -File .\tests\run-template-fidelity-corpus.ps1

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The format is based on Keep a Changelog, and this project currently tracks chang
88

99
### Added
1010

11-
- Added five original, school-neutral DOCX templates for classic, bordered, engineering, course-design, and modern-minimal report styles, together with a machine-readable catalog and reproducible builder.
11+
- Added ten original, school-neutral DOCX templates covering classic, bordered, engineering, course-design, modern-minimal, compact-header, review-panel, code-notebook, data-analysis, and project-dossier report styles, together with a machine-readable catalog and reproducible builder.
1212
- Added template selection and catalog-audit commands. User-supplied templates always win; built-ins are checked for institution names, example identities, embedded media, provenance, and license metadata.
13-
- Added a persistent five-template integration test that builds every neutral template through the main report pipeline.
13+
- Added a persistent ten-template integration test that builds every neutral template through the main report pipeline, plus a five-family uploaded-template fidelity corpus.
1414
- Added the `universal_report` core package for cross-machine configuration, structured pipeline traces, content planning, template contracts, image manifests, format validation, and strict visual validation.
1515
- Added `TemplateStyleContract` analysis with effective style inheritance, template-hash/version caching, page and section settings, role-based typography, table geometry, headers, footers, placeholders, and structural risks.
1616
- Added ten generated compatibility fixtures, Python unit tests, core smoke tests, five universal end-to-end scenarios, and real-template regression coverage.
@@ -30,7 +30,7 @@ The format is based on Keep a Changelog, and this project currently tracks chang
3030

3131
### Changed
3232

33-
- The CLI, PowerShell wrappers, Web UI, documentation, and skill instructions now ask about a preferred template once and otherwise select from exactly five neutral built-in templates.
33+
- The CLI, PowerShell wrappers, Web UI, documentation, and skill instructions now ask about a preferred template once and otherwise select from exactly ten neutral built-in templates.
3434
- The former `experiment-report-template.docx` and `course-design-report-template.docx` files are now compatibility aliases for the classic laboratory and course-design templates.
3535
- User-supplied templates now default to fidelity-preserving mode; repository style normalization and course-design enhancements run only when explicitly requested or when using a repository default template.
3636
- The main wrappers and Web UI now expose structured progress, generation status, template/format/image/visual artifacts, exact image-count requests, and actionable quality recommendations.

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,22 @@ powershell -ExecutionPolicy Bypass -File .\scripts\install-skill.ps1
6262
- 生成后用 `format-validation.json` 对照模板契约逐项验证;
6363
- 只有显式传入 `-TemplateStyleMode normalize -StyleFinalDocx` 时,才应用仓库样式 profile。
6464

65-
如果用户要 DOCX 但尚未说明模板,Skill 会先问一次是否有老师、学校或自己认可的优秀模板。用户上传的模板始终优先;明确没有模板时,再从五套不含学校标识的内置模板中选择
65+
如果用户要 DOCX 但尚未说明模板,Skill 会先问一次是否有老师、学校或自己认可的优秀模板。用户上传的模板始终优先;明确没有模板时,再从十套不含学校标识的内置模板中选择
6666

6767
| ID | 风格 | 适用场景 |
6868
| --- | --- | --- |
6969
| `neutral-classic-lab` | 经典实验报告 | 普通课程实验默认选择 |
7070
| `neutral-bordered-lab` | 闭合外框 | 强调传统纸质版式或页面外框 |
71-
| `neutral-engineering-lab` | 工程技术 | 计算机网络、操作系统、数据库、Java、Web、Android |
71+
| `neutral-engineering-lab` | 工程技术 | 计算机网络、操作系统、数据库、Web、Android、软件工程等 |
7272
| `neutral-course-design` | 课程设计 | 课程设计、综合实验和项目报告 |
7373
| `neutral-modern-minimal` | 现代简洁 | 不要求传统表格式的轻量报告 |
74+
| `neutral-compact-header-lab` | 紧凑信息条 | 周实验、短实验和快速记录 |
75+
| `neutral-review-panel-lab` | 评阅记录 | 需要成绩、教师评语和签名归档 |
76+
| `neutral-code-notebook-lab` | 程序设计 | C/C++、Python、Java、算法、测试和调试记录 |
77+
| `neutral-data-analysis-lab` | 数据分析 | 测量、统计、原始数据、趋势与误差分析 |
78+
| `neutral-project-dossier` | 项目技术 | 长篇系统设计、完整课程项目和参考文献型报告 |
7479

75-
五份 DOCX 都由仓库脚本从零生成,不包含真实学校名、校徽、示例学生身份或第三方图片。公开模板只作为设计原则参考,来源和使用边界记录在 `examples/report-templates/catalog.json`
80+
十份 DOCX 都由仓库脚本从零生成,不包含真实学校名、校徽、示例学生身份或第三方图片。公开模板只作为设计原则参考,来源和使用边界记录在 `examples/report-templates/catalog.json``docs/template-research.md`
7681

7782
图片默认一图一行、图注在下。系统会按内容哈希去重,记录选择和拒绝原因;传入 `-RequestedImageCount` 时会严格满足数量,不会复制图片凑数。
7883

@@ -294,7 +299,7 @@ powershell -ExecutionPolicy Bypass -File .\scripts\build-report-from-feishu.ps1
294299
| 输入 | 说明 | 示例 |
295300
| --- | --- | --- |
296301
| `TemplatePath` | 用户上传的学校或教师模板,优先级最高 | `materials/teacher-template.docx` |
297-
| `BuiltInTemplateId` | 无用户模板时选择五套中性模板之一 | `neutral-engineering-lab` |
302+
| `BuiltInTemplateId` | 无用户模板时选择十套中性模板之一 | `neutral-engineering-lab` |
298303
| `ReportPath` | 已有报告正文 | `examples/sample-report.txt` |
299304
| `MetadataPath` | 姓名、学号、课程名、实验名等短字段 | `examples/cases/network-dos/metadata.json` |
300305
| `RequirementsPath` | 章节、关键词和禁用词检查 | `examples/cases/network-dos/requirements.json` |
@@ -381,6 +386,7 @@ experiment-report-skill/
381386

382387
- [docs/README.md](docs/README.md):文档总导航
383388
- [docs/architecture.md](docs/architecture.md):分阶段流水线、模板契约和验证架构
389+
- [docs/template-research.md](docs/template-research.md):高校与 GitHub 常见模板调研、采用边界和十套覆盖关系
384390
- [docs/compatibility.md](docs/compatibility.md):平台、依赖、跨机器配置和模板边界
385391
- [docs/troubleshooting.md](docs/troubleshooting.md):严格模式、格式漂移、图片数量和 Office 转换排障
386392
- [docs/usage-flow.md](docs/usage-flow.md):完整使用流程
@@ -418,6 +424,8 @@ powershell -ExecutionPolicy Bypass -File .\scripts\run-smoke-tests.ps1
418424
python -m unittest discover -s tests -v
419425
powershell -ExecutionPolicy Bypass -File .\tests\run-core-smoke.ps1
420426
powershell -ExecutionPolicy Bypass -File .\tests\run-universal-e2e.ps1
427+
powershell -ExecutionPolicy Bypass -File .\tests\run-neutral-template-catalog.ps1
428+
powershell -ExecutionPolicy Bypass -File .\tests\run-template-fidelity-corpus.ps1
421429
```
422430

423431
可选 OpenClaw 智能通道检查:
@@ -436,7 +444,7 @@ powershell -ExecutionPolicy Bypass -File .\scripts\self-check.ps1
436444

437445
仓库包含 Gradio 界面,支持学生信息、课程与实验名称、正文长度、参考链接、对话材料、DOCX/DOC 模板、截图和代码文件。上传模板默认走保真模式,界面会展示阶段进度、模板契约、图片清单、格式检查、视觉检查和质量建议。
438446

439-
界面提供“无上传模板时使用”选项,可自动推荐或手工选择五套中性模板。只要上传了用户模板,该选择就会被忽略。
447+
界面提供“无上传模板时使用”选项,可自动推荐或手工选择十套中性模板。只要上传了用户模板,该选择就会被忽略。
440448

441449
默认工作目录是仓库下的 `outputs/web-ui/`,不会绑定某个盘符。可通过环境变量或 JSON 配置覆盖:
442450

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Status: substantially implemented by the universal report refactor.
3535

3636
Before adding more document types, the current experiment-report flow should become easier to trust, debug, and reuse.
3737

38-
Completed foundations include user-template-first fidelity, five reproducible school-neutral fallback templates, catalog-based automatic selection, provenance/identity auditing, and a five-template pipeline regression.
38+
Completed foundations include user-template-first fidelity, ten reproducible school-neutral fallback templates, catalog-based automatic selection, provenance/identity auditing, a ten-template pipeline regression, and a five-family uploaded-template fidelity corpus.
3939

4040
Priority work:
4141

SKILL.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ description: Write Chinese university lab reports and course-design reports, or
2121
- actual steps, code, screenshots, outputs, data, or conclusions
2222
- whether the user wants a factual report or a clearly labeled sample version
2323
- If the user already provides enough facts to write the report body, do not stop to ask for optional metadata such as name, class, date, or template files.
24-
- For a DOCX or other template-controlled deliverable, if the user has not said whether a preferred template exists, ask once: `你有老师、学校或自己认可的优秀 DOCX/DOC 模板吗?有的话请上传,我会优先保持原格式;没有的话,我会从五套不含学校标识的内置模板中选择`
24+
- For a DOCX or other template-controlled deliverable, if the user has not said whether a preferred template exists, ask once: `你有老师、学校或自己认可的优秀 DOCX/DOC 模板吗?有的话请上传,我会优先保持原格式;没有的话,我会从十套不含学校标识的内置模板中选择`
2525
- Do not ask this template question when the user only wants report-body text. Do not ask it again after the user says no, chooses an internal template, or provides a template.
2626
2. Write the full report content before touching template formatting.
2727
3. If critical facts are missing, do not fabricate exact data, screenshots, or measurements.
28-
4. If a local docx template exists and shell execution is available, run `scripts/analyze-docx-template.ps1 -TemplatePath <template.docx>` first. Use `scripts/extract-docx-template.ps1 -Path <template.docx>` when a readable outline is also useful. If the user has no template, run `python -m universal_report select-template --repo-root <repo> --report-type <type> --course <course>` or choose from the five entries in `examples/report-templates/catalog.json`.
28+
4. If a local docx template exists and shell execution is available, run `scripts/analyze-docx-template.ps1 -TemplatePath <template.docx>` first. Use `scripts/extract-docx-template.ps1 -Path <template.docx>` when a readable outline is also useful. If the user has no template, run `python -m universal_report select-template --repo-root <repo> --report-type <type> --course <course>` or choose from the ten entries in `examples/report-templates/catalog.json`.
2929
5. Treat the generated `TemplateStyleContract` and extracted structure as the source of truth. The contract includes effective style inheritance, page setup, title/body/caption roles, table geometry, headers, footers, sections, image placeholders, and structural risks.
3030
6. If a template exists, adapt the finished content to the template order and field names.
3131
7. If the user explicitly wants a filled local docx output and the template matches common report patterns, generate a field map with `scripts/generate-docx-field-map.ps1` and then run `scripts/apply-docx-field-map.ps1`.
@@ -51,8 +51,9 @@ description: Write Chinese university lab reports and course-design reports, or
5151

5252
- A user-supplied DOCX template has the highest formatting priority. Default to `-TemplateStyleMode preserve`; do not replace its page setup, fonts, paragraph spacing, title hierarchy, tables, borders, headers, footers, sections, or caption style with repository defaults.
5353
- A user upload always wins over a selected internal template. Do not blend the uploaded template with an internal design.
54-
- When no user template exists, choose exactly one of: `neutral-classic-lab`, `neutral-bordered-lab`, `neutral-engineering-lab`, `neutral-course-design`, or `neutral-modern-minimal`. Use `-BuiltInTemplateId` for local wrappers when the choice is explicit.
55-
- Prefer `neutral-engineering-lab` for computer-network, operating-system, database, Java, Web, Android, programming, and software-engineering experiments; prefer `neutral-course-design` for course-design or comprehensive-project reports; otherwise default to `neutral-classic-lab`. Use the bordered or modern template only when the requested visual direction calls for it.
54+
- When no user template exists, choose exactly one of the ten catalog entries: `neutral-classic-lab`, `neutral-bordered-lab`, `neutral-engineering-lab`, `neutral-course-design`, `neutral-modern-minimal`, `neutral-compact-header-lab`, `neutral-review-panel-lab`, `neutral-code-notebook-lab`, `neutral-data-analysis-lab`, or `neutral-project-dossier`. Use `-BuiltInTemplateId` for local wrappers when the choice is explicit.
55+
- Prefer `neutral-code-notebook-lab` for programming, algorithm, code, test, and debug experiments; `neutral-data-analysis-lab` for measurement, statistics, raw-data, and error-analysis work; `neutral-compact-header-lab` for short weekly records; and `neutral-review-panel-lab` when teacher comments, score, or signature fields are required.
56+
- Prefer `neutral-engineering-lab` for computer-network, operating-system, database, Web, Android, and software-engineering experiments. Prefer `neutral-project-dossier` for long-form system projects and `neutral-course-design` for ordinary course-design reports. Otherwise default to `neutral-classic-lab`; use the bordered or modern template when the requested visual direction calls for it.
5657
- Internal templates must pass `python -m universal_report audit-template-catalog --repo-root <repo>`. They may not contain real school/college names, logos, watermarks, example student identities, embedded third-party media, or copied sample report content.
5758
- Treat the internal DOCX files as original neutral reconstructions under the repository license. Public templates and GitHub projects are design references only; do not copy their branding, sample text, media, or restricted assets into the internal files.
5859
- Before rendering, create or reuse a `TemplateStyleContract`. After rendering, run `scripts/validate-docx-format.ps1` and report the exact failed contract items instead of saying only that formatting is wrong.

agents/openai.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
interface:
22
display_name: "Experiment Report Skill"
33
short_description: "Generate Chinese lab and course-design reports from templates, screenshots, code, tutorial pages, and results"
4-
default_prompt: "Use $experiment-report to create or complete a Chinese lab or course-design report. If I need a DOCX and have not said whether I have a preferred template, ask once; preserve my uploaded template, otherwise choose from the five neutral built-in templates."
4+
default_prompt: "Use $experiment-report to create or complete a Chinese lab or course-design report. If I need a DOCX and have not said whether I have a preferred template, ask once; preserve my uploaded template, otherwise choose from the ten neutral built-in templates."

docs/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
## 核心文档
1717

1818
- [architecture.md](architecture.md)
19-
说明分阶段流水线、五套中性模板选型、`TemplateStyleContract`、保留/规范化模式、图片清单和严格验证链路。
19+
说明分阶段流水线、十套中性模板选型、`TemplateStyleContract`、保留/规范化模式、图片清单和严格验证链路。
20+
21+
- [template-research.md](template-research.md)
22+
记录高校公开模板和 GitHub 项目的调研结论、采用边界与十套模板覆盖关系。
2023

2124
- [usage-flow.md](usage-flow.md)
2225
从收集材料、生成正文、填模板、插截图到交付检查的完整流程。

docs/architecture.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
本项目是一条“材料到可交付报告”的通用实验报告流水线。核心约束是:
66

77
1. 用户提供 DOCX 模板时,模板版式是最高优先级。
8-
2. 用户没有模板时,从五套原创中性模板中选择,不直接复制学校模板。
8+
2. 用户没有模板时,从十套原创中性模板中选择,不直接复制学校模板。
99
3. 正文、图片和元数据按模板结构填入,不默认统一套版。
1010
4. 每个阶段都有结构化产物和可定位错误。
1111
5. 快速模式适合日常生成;严格模式必须完成 PDF 逐页视觉验收,否则状态为 `needs-fix`
@@ -81,18 +81,22 @@
8181

8282
课程设计自动流程图和自动结构表格也只在默认模板或显式规范化模式启用,避免破坏用户模板。
8383

84-
## 五套中性模板
84+
## 十套中性模板
8585

8686
模板目录位于 `examples/report-templates/catalog.json`。选型顺序为:
8787

8888
1. 用户上传模板:直接使用并保真。
89-
2. 课程设计:`neutral-course-design`
90-
3. 明确要求闭合外框:`neutral-bordered-lab`
91-
4. 明确要求现代简洁:`neutral-modern-minimal`
92-
5. 计算机或工程课程:`neutral-engineering-lab`
93-
6. 其他普通实验:`neutral-classic-lab`
94-
95-
所有内置模板由 `scripts/build-neutral-templates.py` 从零生成。`audit-template-catalog` 会检查数量、文件、来源字段、真实学校/学院名称、示例长数字身份和嵌入媒体;审计不通过的模板不能作为回退模板。
89+
2. 长篇系统项目:`neutral-project-dossier`;普通课程设计:`neutral-course-design`
90+
3. 代码、测试或调试实验:`neutral-code-notebook-lab`
91+
4. 测量、统计、数据处理或误差分析:`neutral-data-analysis-lab`
92+
5. 教师评语、成绩或签名归档:`neutral-review-panel-lab`
93+
6. 周实验、短实验或紧凑记录:`neutral-compact-header-lab`
94+
7. 明确要求闭合外框:`neutral-bordered-lab`
95+
8. 明确要求现代简洁:`neutral-modern-minimal`
96+
9. 计算机网络、操作系统、数据库、Web、Android 或软件工程:`neutral-engineering-lab`
97+
10. 其他普通实验:`neutral-classic-lab`
98+
99+
所有内置模板由 `scripts/build-neutral-templates.py` 从零生成。`audit-template-catalog` 会检查数量、文件、来源字段、真实学校/学院名称、示例长数字身份和嵌入媒体;审计不通过的模板不能作为回退模板。`run-neutral-template-catalog.ps1` 负责十套成品填充回归,`run-template-fidelity-corpus.ps1` 负责五类上传模板保真回归。
96100

97101
## 图片策略
98102

docs/compatibility.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ $env:EXPERIMENT_REPORT_CONFIG = "D:\config\experiment-report.json"
4747

4848
环境变量优先于配置文件,配置文件优先于仓库默认值。
4949

50-
没有配置外部默认模板时,仓库使用五套中性模板目录。普通实验默认 `neutral-classic-lab`,课程设计默认 `neutral-course-design`;也可通过 `-BuiltInTemplateId` 或 Web UI 下拉框选择其他模板
50+
没有配置外部默认模板时,仓库使用十套中性模板目录。普通实验默认 `neutral-classic-lab`,课程设计默认 `neutral-course-design`代码、数据、评阅、短实验和长篇项目可自动推荐专用模板,也可通过 `-BuiltInTemplateId` 或 Web UI 下拉框选择
5151

5252
## 模板兼容性
5353

5454
已覆盖的自动化夹具包括:
5555

56-
- 五套仓库中性模板及身份/来源审计
56+
- 十套仓库中性模板及身份/来源审计
57+
- 五类结构差异明显的上传模板保真回归
5758
- 仓库默认模板
5859
- 4 列学生信息表
5960
- 5 列学生信息表

0 commit comments

Comments
 (0)