Skip to main content

review.coding.start

review.coding.start(root, directory, runs)

Open a coding: write the manifest, the two briefs and proposals/.

Parameters

Name Type Description Default
root Path The project root. required
directory Path | str The review directory DIR; below regen/runs/, holding no run.toml, and absent or empty. required
runs list[Path] | tuple[Path, …] The run directories in the order of the page, each below regen/runs/. required

Returns

Name Type Description
list[str] list[str]: The files written, relative to the project root.

Raises

Name Type Description
ConfigurationError If a run is aborted, a canary or accepted, a path lies outside regen/runs/, a run is named twice, or directory is not empty.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from babregen import make_sample_repo
from babregen.review.coding import start

record = (
    'unit = "calc"\nprotocol = "score"\nstatus = "completed"\n'
    'accepted = false\n[base]\ncommit = "' + "a" * 40 + '"\n'
    "[[attempt]]\nn = 1\nwrote_module = false\n"
)
with TemporaryDirectory() as tmp:
    root = make_sample_repo(Path(tmp) / "demo")
    run = root / "regen" / "runs" / "rejected"
    run.mkdir(parents=True)
    (run / "run.toml").write_text(record)
    print(start(root, root / "regen" / "runs" / "coding", [run]))
['regen/runs/coding/coding.toml', 'regen/runs/coding/BRIEF.md', 'regen/runs/coding/BRIEF-CHECK.md']