Append one [[intent]] block to a unit record: the writer behind babregen add-intent.
The prose is given, never drafted: the loader rejects an empty required string, and a placeholder that passed it would pass in silence. Every evaluation must be defined in an evaluation file of the unit and every decision must exist; all wrong names are reported at once, each with a similar name when there is one.
The id of the item. By default the dominant PREFIX- of the existing ids plus the highest number plus one; with no such item, the first three letters of the module name in upper case and -1.
If the unit or an evaluation or a decision is unknown, the id exists, the record keeps its intent as an inline array, a prose value holds a blank line, a name holds a line break or the result would not load.
Examples
from pathlib import Pathfrom tempfile import TemporaryDirectoryfrom babregen import add_intent, load_spec, make_sample_repowith TemporaryDirectory() as tmp: root = make_sample_repo(Path(tmp) /"demo") done = add_intent( load_spec(root),"core.calc", scope="add", invariant="add(0, x) == x", reason="zero is the identity", evaluations=["test_add"], dry_run=True, )print(done.text)
[[intent]]
id = "C-2"
scope = "add"
invariant = "add(0, x) == x"
reason = "zero is the identity"
evaluations = ["test_add"]