feat: flavor-correct rmgr scaffold; record C-15/C-23 file-wins
RMGR-WP-0004-T03: project repos get GOAL.md and a required prefix. RMGR-WP-0005-T06 implemented in state-hub consistency.
This commit is contained in:
parent
0c5177ec4c
commit
a6d4a9b615
6 changed files with 294 additions and 3 deletions
65
tests/test_scaffold.py
Normal file
65
tests/test_scaffold.py
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
from pathlib import Path
|
||||
|
||||
from repo_manager.cli import main
|
||||
from repo_manager.commands.scaffold import scaffold_repository
|
||||
from repo_manager.standards import check_repository
|
||||
|
||||
|
||||
def test_prj_scaffold_requires_prefix(tmp_path: Path):
|
||||
dest = tmp_path / "prj-example"
|
||||
result = scaffold_repository(dest, flavor="project", commit=False)
|
||||
assert result.status == "rejected"
|
||||
assert "wp-prefix" in (result.error or {}).get("message", "").lower() or "PRJ" in str(
|
||||
result.error
|
||||
)
|
||||
|
||||
|
||||
def test_prj_scaffold_refuses_flavor_prefix(tmp_path: Path):
|
||||
dest = tmp_path / "prj-example"
|
||||
result = scaffold_repository(dest, flavor="project", wp_prefix="PRJ-WP", commit=False)
|
||||
assert result.status == "rejected"
|
||||
|
||||
|
||||
def test_prj_scaffold_writes_goal_not_intent(tmp_path: Path):
|
||||
dest = tmp_path / "prj-example-cutover"
|
||||
result = scaffold_repository(
|
||||
dest, flavor="project", wp_prefix="EXCO-WP", commit=False
|
||||
)
|
||||
assert result.status == "applied"
|
||||
assert (dest / "GOAL.md").is_file()
|
||||
assert not (dest / "INTENT.md").exists()
|
||||
goal = (dest / "GOAL.md").read_text()
|
||||
for heading in ("Outcome", "Invariants", "Success gates", "Project retirement"):
|
||||
assert heading in goal
|
||||
assert not list((dest / "workplans").glob("*-0001-*.md"))
|
||||
report = check_repository(dest)
|
||||
assert report.ok, report.to_dict()
|
||||
|
||||
|
||||
def test_durable_scaffold_writes_intent(tmp_path: Path):
|
||||
dest = tmp_path / "some-tool"
|
||||
result = scaffold_repository(dest, flavor="tooling", commit=False)
|
||||
assert result.status == "applied"
|
||||
assert (dest / "INTENT.md").is_file()
|
||||
assert not (dest / "GOAL.md").exists()
|
||||
assert (dest / "workplans" / "SOMETOOL-WP-0001-foundation.md").is_file()
|
||||
report = check_repository(dest)
|
||||
assert report.ok, report.to_dict()
|
||||
|
||||
|
||||
def test_cli_scaffold(tmp_path: Path):
|
||||
dest = tmp_path / "cli-tool"
|
||||
assert (
|
||||
main(
|
||||
[
|
||||
"scaffold",
|
||||
"--path",
|
||||
str(dest),
|
||||
"--flavor",
|
||||
"tooling",
|
||||
"--no-commit",
|
||||
]
|
||||
)
|
||||
== 0
|
||||
)
|
||||
assert (dest / "INTENT.md").is_file()
|
||||
Loading…
Add table
Add a link
Reference in a new issue