Editor support
The records under regen/ are TOML. An editor that reads a JSON Schema completes their keys and marks unknown keys, values of the wrong type and values outside a vocabulary while you type. This page says what to copy into a repository that uses babregen and how VS Code picks it up. The schemas cannot know the names in your source tree (a misspelled evaluation or decision id): babregen check finds those.
What to copy
Run these three commands once, in the root of your repository, and commit the result:
mkdir -p regen/schemas
babregen schema architecture -o regen/schemas/architecture.schema.json
babregen schema unit -o regen/schemas/unit.schema.json
babregen schema decision -o regen/schemas/decision.schema.jsonbabregen schema needs no regen/ tree and prints deterministic JSON, so the files change only when babregen changes the schema (babregen.spec.FIELDS). Run the commands again after an upgrade. Then copy three files from the babregen repository (the links give the raw files):
| file | what it is for |
|---|---|
.taplo.toml |
maps regen/architecture.toml, regen/units/*.toml and regen/decisions/*.toml to the three schemas |
.vscode/tasks.json |
the task “babregen check” with a problem matcher |
.vscode/regen.code-snippets |
snippets for an intent item, a consumer, a decision record and an alternative |
If your repository already has a .taplo.toml or a .vscode/tasks.json, merge the entries instead of replacing the file. The repository of babregen keeps .vscode/tasks.json and the snippets under version control, although it ignores the rest of .vscode/.
VS Code with Even Better TOML
Install the extension Even Better TOML (Taplo). It reads .taplo.toml from the workspace root, loads the schema that matches the open file and shows
- the keys that are allowed at the cursor, with the one-sentence description of each,
- a mark on a key that the schema does not list, on a value of the wrong type and on a value outside a vocabulary (a consumer
kind, a decisionstatus, apace), - a mark on a required key that is missing.
A description that ends in “prose: line breaks are folded” belongs to a prose field: you wrap the paragraph over several lines in a multi-line string and write no backslash at the line ends (see Prose fields are folded). A prose field is for sentences, not for code, because line breaks fold into spaces. A TOML date has a description and no type in the schema, because JSON has no date, and a string that holds only blanks passes minLength; the loader and babregen check still reject both.
The task and the snippets
The task “babregen check” runs uv run babregen check and turns every finding line, path:line: level ID message or path: level ID message when the check cannot tell the line, into an entry of the Problems panel. Run it with Terminal > Run Task. The summary line is not a finding and is ignored.
The snippets work in TOML files. Type intent, consumer, decision or alternative and press Tab. A snippet fills the key names and the parts that every record has; it does not put a placeholder into the record, because the loader rejects an empty required string. The same blocks can be written from the command line, with the text as options and the names checked before anything is written: babregen add-intent, babregen add-consumer and babregen new-decision (see Commands).
Checking the schemas without an editor
taplo lint checks the records against the schemas on the command line. babregen’s own tests run it when taplo is installed and skip it otherwise.