init 生成可 check 的工程根(manifest.toml + .cph-version + 默认 exports/student.typ + 空 kind 目录); add 按 kind 建 part 目录/element.toml/必填内容文件并追加 [[parts]]。均纯本地,不涉及 hub 语义; Engine 改惰性构造。cph-schema 新增 required_content_field_names() 作为 add 建文件合同。
crates/
These crates implement the rule-based lesson checker whose semantics are
pinned by the ADRs in docs/adr/: it reads an engineering-file (one lesson,
ADR-0005)
laid out per ADR-0029 (a nested outline manifest — every container folder
carries manifest.toml, every leaf carries element.toml; supersedes
ADR-0008's flat [[parts]]), validates structure and content, and emits
diagnostics. cph-diag (the shared diagnostic vocabulary), cph-model (the
ADR-0029 loader, also loading bundle.toml arrangements per ADR-0030), 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-0029 nested outline layout (+ ADR-0030 bundles) into an in-memory ordered Lesson/Bundle — 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