Expand description
Course scaffolding: the templates a new course starts from and the plan that writes them.
Holds the embedded starter templates (include_str!), the pure
scaffold_plan that names the files a fresh course contains (testable with
no filesystem, §2.3), and scaffold_course — the single effectful step
that refuses a non-empty target before any write (§1.3.1) then writes that
plan into it. It also grows an existing course one lesson at a time: the pure
lesson_template selects a language-appropriate starter (§2.1), the pure
eval_template emits the lesson’s eval_-prefixed grading suite, and the
effectful add_lesson writes the pair and registers the lesson in the
manifest. This module owns what a course’s content is; it does not parse
CLI flags or decide where the course lives (§4.1). The templates are data the
writer consumes, so changing a template never changes the writer (§3.2).
Structs§
- File
Spec - One file a scaffold writes: its path relative to the course directory and the exact bytes to write there.
Enums§
- AddLesson
Error - Why a lesson could not be added to a course.
- Scaffold
Error - Why a course could not be scaffolded into a target directory.
Constants§
- EVAL_
SIBLING_ PREFIX - The
eval_prefix of the sibling-suite naming convention: a lessonlessons/foo.yamlpairs with the suitelessons/eval_foo.yaml. The single source of the convention — the scaffolding derives the sibling name througheval_sibling_path, andcli’ssibling_suite_path(whichevalandeval-reportresolve suites by) delegates to the same function, so the two ends of the convention can never drift apart.
Functions§
- add_
lesson - Add a
languagelessonidto the course rooted atdir: writelessons/<id>.yamlfromlesson_templateand itseval_-prefixed sibling suite fromeval_template, then register the lesson in the manifest. - eval_
sibling_ path - The eval-suite sibling of
lesson_path: the same file name prefixed withEVAL_SIBLING_PREFIX, in the same directory. - eval_
template - Render a starter eval suite for
languageunder the lesson slugid. - lesson_
template - Render a starter lesson for
languageunder the slugid. - scaffold_
course - Scaffold a fresh course into
dir, writing every file in the plan. - scaffold_
plan - Compute the set of files a fresh course scaffold writes.