Replace generated-driver compilation with the template model.
cph-typst:
- driver.rs DELETED (generate_driver, static-include driver, numbering-threading).
- New manifest.rs: build_augmented_manifest(&Lesson) emits a TOML doc with [info]
+ ordered [[parts]] each carrying a `fields` array = the kind's content fields
whose <root>/<path>/<field>.typ exists on disk. Reuses cph-schema's
content_field_names (new dep; no cycle). This closes the OPEN point WU-C'
surfaced: typst has no file-exists primitive, so the engine (which has disk
access) tells the template which optional content (lemma proof) is present.
- World main = the real engineering-file template (<root>/<template>); the
augmented manifest is served as an in-memory virtual file at /.cph/manifest.toml
(never written to the tree), injected via sys.inputs.manifest. render_dir kept
only for @local/cph-render + vendored @preview/numbly resolution.
- Artifact handling: SingleFile+TypstCompile compiles; FileTree, shell-only, and
undeclared-target are blocking "deferred/not-declared" diagnostics (ADR-0011).
- Engine public signatures unchanged; LessonWorld::new takes template+manifest_src.
cph-check: no source change needed (only uses lesson.targets/target.name +
unchanged Engine methods); pipeline + Legal alignment intact.
Fixtures: mini gets exports/{student,teacher}.typ (from render/templates/) + v2
manifest + a second proof-less lemma to exercise optional content. render-stub
retired (tests use the real render/). Through-template PDFs offline: student 44KB,
teacher 56KB; proof-less lemma compiles clean (optional-content confirmed).
Workspace: fmt + clippy -D warnings + all tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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