#!/usr/bin/env python3 """Run the read-only Blender/WBV2 continuation gates.""" from __future__ import annotations import argparse import subprocess from wbv2_runtime import ROOT, queue_pointer, terminal_pointer CHECKS = ( ("task-context", ["node", "tools/web/check-task-context.mjs"]), ("context-governance", ["node", "tools/web/check-context-governance.mjs"]), ("execution-control-plane", ["node", "tools/web/check-execution-control-plane.mjs"]), ("v2-task-index", ["node", "tools/web/check-v2-task-index.mjs"]), ("v2-handoff", ["node", "tools/web/check-v2-handoff.mjs"]), ) def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--quiet", action="store_true") args = parser.parse_args() pointer = queue_pointer() failures = [] for name, command in CHECKS: result = subprocess.run(command, cwd=ROOT, text=True, capture_output=True, check=False) if not args.quiet: output = (result.stdout or result.stderr).strip() if output: print(output) if result.returncode != 0: failures.append(f"{name} exit={result.returncode}") if failures: print("WBV2 CONTINUATION INVALID: " + "; ".join(failures)) return 1 state = "terminal" if terminal_pointer(pointer) else "ready" print(f"WBV2 CONTINUATION READY: state={state} task={pointer.get('task') or 'NONE'}") return 0 if __name__ == "__main__": raise SystemExit(main())