Files
curriculum-project-hub/crates
sjfhsjfh 5dc29fe558 feat(model): author 是有序列表;Info(canonical) vs RawInfo(授权 surface) 入契约
一节课可多人署名(教研组),故 canonical author 是**有序列表**而非单值。on-disk
形式接受裸字符串(单作者)或数组(多作者),但此"字符串或数组"二态**只活在加载边界**:
RawInfo 经归一化折叠成 canonical Info,其后系统只见 List。

Lean 母本(ADR-0008 范围):新增 Model/Info.lean,把 Info(canonical,authors: List
String)与 RawInfo/RawAuthor(授权便利 surface)+ 归一化 RawInfo.toInfo 钉死——
canonical 接收端恒为列表,raw 形式不泄漏。ADR-0008 [info] 块补 author-as-list 决策。

impl 对齐:cph-model Info.author: Option<String> → authors: Vec<String>;RawAuthor
untagged enum(One|Many)+ into_vec 归一化;augmented manifest 发射 author 数组
(typst document(author:) 与模板已接受 string/array)。doc 两端互引 spec。

测试:load.rs 单作者→单元素列表;target-configs fixture 加数组作者断言多作者。
验证:lake build 绿(25 jobs);cargo test 全绿;clippy 静默;TH-141(单字符串作者)
check+build PDF 无回归。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 00:11:03 +08:00
..

crates/

These crates implement the rule-based lesson checker that aligns to the semantic master in spec/: it reads an engineering-file (one lesson, ADR-0005) laid out per ADR-0008 (declarative manifest.toml + per-element element.toml), validates structure and content, and emits diagnostics. cph-diag (the shared diagnostic vocabulary), cph-model (the ADR-0008 loader), and cph-typst (the typst World / compile / span-mapping layer) are deliberately reusable by future components such as an exporter, which is why they live in this repo-wide crates/ directory rather than under any single component; cph-schema (kind JSON Schemas + validation), cph-check (orchestration + render-coverage) and cph-cli (the cph command-line entrypoint) are the checker proper.

Crate map

crate owner role
cph-diag WU-1 shared diagnostic vocabulary (Severity, DiagCode, Diagnostic, SourceSpan) — reusable
cph-model WU-1 parses the ADR-0008 layout into an in-memory ordered Lesson — reusable
cph-schema WU-3 the 4 stdlib kind JSON Schemas + structural validation
cph-typst WU-4 typst World, driver generation, compile, PDF, span mapping — reusable
cph-check WU-5 orchestration: render-coverage and the full check pipeline
cph-cli WU-5 the cph command-line entrypoint

Build

# from the repository root (the cargo workspace root)
cargo build      # all crates
cargo test       # cph-diag + cph-model unit/integration tests
cargo clippy --all-targets -- -D warnings
cargo fmt --check