Module scaffold

Module scaffold 

Source
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§

FileSpec
One file a scaffold writes: its path relative to the course directory and the exact bytes to write there.

Enums§

AddLessonError
Why a lesson could not be added to a course.
ScaffoldError
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 lesson lessons/foo.yaml pairs with the suite lessons/eval_foo.yaml. The single source of the convention — the scaffolding derives the sibling name through eval_sibling_path, and cli’s sibling_suite_path (which eval and eval-report resolve suites by) delegates to the same function, so the two ends of the convention can never drift apart.

Functions§

add_lesson
Add a language lesson id to the course rooted at dir: write lessons/<id>.yaml from lesson_template and its eval_-prefixed sibling suite from eval_template, then register the lesson in the manifest.
eval_sibling_path
The eval-suite sibling of lesson_path: the same file name prefixed with EVAL_SIBLING_PREFIX, in the same directory.
eval_template
Render a starter eval suite for language under the lesson slug id.
lesson_template
Render a starter lesson for language under the slug id.
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.