feat(checker): cph-model manifest v2 — Artifact-with-fields + typed steps (WU-B', ADR-0011)

[targets.*] reworked: artifact is now an inline table with a type discriminator
({type="single-file",filepath} / {type="file-tree",root,outputs}) and steps is an
ordered array-of-tables ({type="typst-compile",template} / {type="shell",run}).
numbering removed entirely (presentation lives in the template per ADR-0011).

TargetConfig { name, artifact: Artifact, steps: Vec<Step> }; Artifact and Step
mirror Spec.Courseware.Artifact / Spec.Courseware.Step (doc-cited). Sensible
defaults so a bare [targets.student] still works: single-file build/<name>.pdf +
one typst-compile exports/<name>.typ. Malformed artifact/step type → non-fatal
SchemaViolation with fallback. 8 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 09:57:50 +08:00
parent de87cddaf1
commit d5bce1bede
4 changed files with 473 additions and 190 deletions
@@ -5,15 +5,24 @@ name = "target-configs"
[info]
title = "测试课:导出目标的结构化 build 配置"
# Full config: explicit artifact + numbering.heading override.
# Full v2 config: explicit single-file artifact + an ordered typst-compile step.
[targets.student]
artifact = "single-file"
[targets.student.numbering]
heading = ["{1:一}、", "{1:1}.{2:1}", "{1:1}.{2:1}.{3:1}"]
artifact = { type = "single-file", filepath = "build/student.pdf" }
[[targets.student.steps]]
type = "typst-compile"
template = "exports/student.typ"
# file-tree artifact, no presentation override.
# file-tree artifact + multiple steps (typst-compile then a shell step),
# exercising both step types and order preservation.
[targets.archive]
artifact = "file-tree"
artifact = { type = "file-tree", root = "build/archive", outputs = "**/*.{html,js,json}" }
[[targets.archive.steps]]
type = "typst-compile"
template = "exports/archive.typ"
[[targets.archive.steps]]
type = "shell"
run = "npm run build"
# Empty body → all defaults.
# Empty body → all defaults (single-file build/teacher.pdf, one typst-compile
# step exports/teacher.typ).
[targets.teacher]