MASON-WP-0010-T02 done: ops-mason plan --case renders a construction plan from a SecurityCase
Uses net-kingdom's case validator and renderer, adds a read-only collision review against live structure, and puts the case acceptance in place of the executive summary. 8 tests; suite 167 passed. WP-0010 now blocked on the type being implemented; WP-0004-T04 blocker made precise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 327203@bnt-lap001 Assistant-Session: 55028ae3-4914-4bd1-8f5c-815f3527aef0
This commit is contained in:
parent
21b5a076f6
commit
4dafcf5ed4
5 changed files with 355 additions and 6 deletions
|
|
@ -39,11 +39,38 @@ def _parser() -> argparse.ArgumentParser:
|
|||
apply_parser.add_argument("--readiness-repo", type=Path)
|
||||
apply_parser.add_argument("--activation", choices=("APPROVED", "BREAK_GLASS"), default="APPROVED")
|
||||
apply_parser.add_argument("--break-glass-reason")
|
||||
|
||||
plan = families.add_parser("plan", help="construction plan derived from a SecurityCase")
|
||||
plan.add_argument("--case", required=True, type=Path)
|
||||
plan.add_argument("--out", type=Path, help="write the plan here (default: stdout)")
|
||||
plan.add_argument("--no-live", action="store_true",
|
||||
help="skip the live OpenBao survey (marks the plan's survey source 'none')")
|
||||
plan.add_argument("--netkingdom-root", type=Path, default=None)
|
||||
return parser
|
||||
|
||||
|
||||
def _plan(args) -> int:
|
||||
from ops_mason import case_plan
|
||||
|
||||
nk_root = args.netkingdom_root or case_plan.DEFAULT_NK_ROOT
|
||||
try:
|
||||
doc, collisions, rendered = case_plan.plan_from_case(
|
||||
args.case, nk_root=nk_root, structure=case_plan.Structure() if args.no_live else None)
|
||||
except case_plan.CasePlanError as exc:
|
||||
print(json.dumps({"ok": False, "error": str(exc), "issues": exc.issues}), file=sys.stderr)
|
||||
return 2
|
||||
if args.out:
|
||||
args.out.write_text(doc)
|
||||
else:
|
||||
sys.stdout.write(doc)
|
||||
print(json.dumps({"ok": not collisions, "digest": rendered["digest"], "collisions": collisions}), file=sys.stderr)
|
||||
return 1 if collisions else 0
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
args = _parser().parse_args(argv)
|
||||
if args.family == "plan":
|
||||
return _plan(args)
|
||||
try:
|
||||
bundle = PlaneBundle.load(args.bundle)
|
||||
if args.command == "render":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue