Draft regen/units/<unit>.toml for a module that has no unit record yet.
Everything that can be read from the tree is filled in: the first paragraph of the module docstring as summary, the public names (__all__, else public defs, classes and upper-case constants), the package imports as depends_on, and every file that references the module as a consumer (test files named after the module as unit_tests, and tests/test_regen_eval_<module>.py, which the unit’s durable evaluations are written in, as evaluations). The record names neither the unit nor its path: both follow from the file name. What only a person can supply is left open: the intent items, the evaluations, the decisions and the external consumers. The draft therefore fails check with INTENT01 until at least one intent item is written, so a scaffold can never pass the check unreviewed.
If the module has no file below the source directory.
Examples
from pathlib import Pathfrom tempfile import TemporaryDirectoryfrom babregen import load_spec, make_sample_repo, scaffold_unitwith TemporaryDirectory() as tmp: root = make_sample_repo(Path(tmp) /"demo") (root /"regen/units/core.calc.toml").unlink() target, text = scaffold_unit(load_spec(root), "core.calc", "slow")print(target.relative_to(root))print([line for line in text.splitlines() if line.startswith(("pace", "public"))])