Files
curriculum-project-hub/spec/Spec/Courseware/Artifact.lean
T
sjfhsjfh 09b026f598 feat(spec): backfill Export terminology + diagnostics/legality/pipeline (ADR-0009/0010)
Lift the business decisions the MVP made into the Lean master, per constitution
rule 5. lake build green (20 jobs), no sorry.

- Artifact.lean: `inductive Artifact | singleFile | fileTree` — product shape is
  part of a target's value (ADR-0009); it determines the assemble/reduce step.
- Render.lean reworked target-centric (ADR-0009, amends ADR-0005's matrix):
  `TargetSpec` carries `artifact` + a per-kind `renders` map (field visibility
  lives in this map); `RenderConfig.spec : TargetId → Option TargetSpec`; `covers`
  rewritten (target must exist AND its map covers the kind) — semantics continuous
  with ADR-0005 so renderIgnored still typechecks. `BuildStepForm` (declarative |
  shell) is a structural anchor for the build form (shell hatch = ADR-0005's
  medium-only category b) without replicating the schema.
- Diagnostic.lean extended: `DiagKind` (7 classes) + `DiagKind.severity` (six
  error, renderIgnored warning); `Oracle` makes external-facility verdicts
  (compiles/refsResolve/dataConforms/contentFilesPresent) an explicit
  implementation boundary; `Legal` = no error-level diagnostic (backfills
  ADR-0005's deferred full-legality), with renderIgnored deliberately excluded
  (it's a warning).
- Pipeline.lean: the 5 phases (load→structural→schema→compile→coverage) as
  structure — order + the compile gate (compile runs only on zero prior errors) +
  load halts the pipeline. Algorithms stay out of Lean (depth ceiling).

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

31 lines
1.2 KiB
Lean4

/-!
# Artifact —— export target 的产物形状
ADR-0009:一个 export target 是**一次 build**,产出一个**有类型的产物**(artifact)。
产物的**形状**是 target 值的一部分——"产出单个文件还是一棵文件树"是真分歧点,因为它
改变 `cph build` 到底吐出什么、消费方期待什么,故进契约。
本模块只钉**形状**这一层。具体后端/格式(用哪个 PDF 引擎、哪种 markdown 方言)是
ADR-0009 显式 OPEN 的,不在此承诺。
-/
namespace Spec.Courseware
/--
export 产物的形状(`PINNED`, ADR-0009)。
- `singleFile` —— 一份打包文档(讲义 PDF、教案 PDF)。
- `fileTree` —— 一棵文件树 + 索引(第三方平台 archive)。
**为什么这是分歧点而非实现细节**:产物是单件还是多件,决定 reduce/assemble 这一步
怎么折叠(见 `Render`:`singleFile` 按 lesson 序拼成一份文档再编译——这也是交叉引用
`@ref` 与 例题N 计数器能工作的前提;`fileTree` 每 part 一文件 + 索引),也决定
`cph build` 写一个文件还是一个目录。后端/格式(typst→PDF、markdown 方言…)仍 OPEN,
故此处**只枚举形状**,不带后端标签。
-/
inductive Artifact where
| singleFile
| fileTree
end Spec.Courseware