Files
curriculum-project-hub/crates
sjfhsjfh bd1699a4c0 feat(checker): align cph-typst + cph-check to export-as-build model (WU-D)
Integrate the WU-B (structured targets) and WU-C (numbly, config) changes.

cph-typst:
- World resolves any @preview/* package from the in-repo vendored dir
  (<render_dir>/vendor/typst-packages/preview/<name>/<version>/), fully offline —
  no typst-kit download. Proven: build_pdf_with_real_render compiles the real
  render package (which imports @preview/numbly:0.1.0) through the embedded
  engine, PDF out.
- Driver threads each target's presentation config: looks up the TargetConfig by
  name, emits `config: (numbering: (heading: (...)))` (escaped) when an override
  is present, else `config: (:)` (render default).
- target_precheck guards artifact/target: FileTree → blocking diagnostic (MVP is
  single-file, deferred per ADR-0009); --target not declared → blocking
  diagnostic; no-targets lesson still defaults through.

cph-check:
- Migrated to Lesson.targets: Vec<TargetConfig> (target_names() / target.name at
  the 6 sites). Pipeline unchanged (already matches ADR-0010 phases). Documented
  that !has_errors() implements Spec.Courseware.Legal (no error-level diagnostic).

Workspace: fmt + clippy -D warnings + all tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 08:47:13 +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