oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1#!/usr/bin/env python3
2"""Refuse release while runtime copy or the Plan 3 review inventory is pending."""
3from pathlib import Path
4import re
5import sys
6import runpy
7
8
9SURFACES = (
10 "internal/equipo/copy.go",
11 "docs/api/equipo-v1.md",
12 "docs/plan-3-acceptance.md",
13 "docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md",
14)
15
16
17def copy_reviewed(root):
18 for name in SURFACES:
19 try:
20 text = (root / name).read_text()
21 except (OSError, UnicodeError):
22 return False
23 if name.endswith("CONTROLLER-REPORT-plan-3.md"):
24 # Historical task reports keep their original evidence. Only the
25 # consolidated current inventory represents the review decision.
26 heading = "## Plan 3 copy inventory (for Paul's review)"
27 if heading in text:
28 text = text.split(heading, 1)[1].split("\n## ", 1)[0]
29 if re.search(r"COPY REVIEW REQUIRED|COPY REVIEW PENDING|pending copy review", text, re.I):
30 return False
31 adapter = root / "scripts/copy-contract.py"
32 if adapter.exists():
33 api = runpy.run_path(str(adapter))
34 return api["status"]({"candidate": str(root)}, "verify")["valid"]
35 return True
36
37
38if __name__ == "__main__":
39 sys.exit(0 if copy_reviewed(Path(__file__).resolve().parent.parent) else 1)
40