Files
claude-code/scripts/cc2_board.py
bellman 45b43b5a96 Make the CC2 board schema executable for G001
The canonical Stream 0 board must be machine-checkable before Ultragoal can checkpoint G001, so the generated board and validation wrapper now share the same rich board schema and Markdown renderer.

Constraint: G001 requires .omx/cc2/board.json and .omx/cc2/board.md to prove all frozen ROADMAP.md headings and ordered actions are mapped.

Rejected: Relying on worker-reported validation alone | leader-side validation found schema drift between the status-only and lifecycle_status board entrypoints.

Confidence: high

Scope-risk: narrow

Directive: Keep scripts/generate_cc2_board.py, scripts/validate_cc2_board.py, scripts/cc2_board.py, and .omx/cc2/render_board_md.py aligned on board schema changes.

Tested: python3 scripts/generate_cc2_board.py; python3 scripts/validate_cc2_board.py; python3 scripts/cc2_board.py validate; python3 .omx/cc2/validate_issue_parity_intake.py; python3 .omx/cc2/render_board_md.py .omx/cc2/board.json .omx/cc2/board.md --check; python3 -m py_compile scripts/generate_cc2_board.py scripts/validate_cc2_board.py scripts/cc2_board.py .omx/cc2/validate_issue_parity_intake.py .omx/cc2/render_board_md.py; cargo check --manifest-path rust/Cargo.toml --workspace.

Not-tested: Full cargo test workspace has unrelated existing failures reported by workers in session lifecycle/permission-mode tests.

Co-authored-by: OmX <omx@oh-my-codex.dev>
2026-05-14 17:14:07 +09:00

55 lines
2.1 KiB
Python
Executable File

#!/usr/bin/env python3
"""Canonical CC2 board command wrapper.
This script intentionally delegates to the richer G001 board generator,
validator, and Markdown renderer so all entrypoints enforce the same schema.
"""
from __future__ import annotations
import argparse
import subprocess
import sys
from pathlib import Path
def run(cmd: list[str], cwd: Path) -> int:
return subprocess.run(cmd, cwd=str(cwd)).returncode
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("command", choices=["generate", "validate"])
parser.add_argument("--repo-root", type=Path, default=Path.cwd(), help="repository root containing ROADMAP.md")
parser.add_argument("--context-root", type=Path, default=None, help="accepted for compatibility; source .omx is auto-detected by the generator")
parser.add_argument("--board-json", default=".omx/cc2/board.json")
parser.add_argument("--board-md", default=".omx/cc2/board.md")
args = parser.parse_args(argv)
repo_root = args.repo_root.resolve()
board_json = repo_root / args.board_json
board_md = repo_root / args.board_md
generator = repo_root / "scripts" / "generate_cc2_board.py"
validator = repo_root / "scripts" / "validate_cc2_board.py"
renderer = repo_root / ".omx" / "cc2" / "render_board_md.py"
if args.command == "generate":
rc = run([sys.executable, str(generator), "--repo-root", str(repo_root), "--out-dir", str(board_json.parent)], repo_root)
if rc:
return rc
return run([sys.executable, str(renderer), str(board_json), str(board_md)], repo_root)
checks = [
[sys.executable, str(validator), "--repo-root", str(repo_root), "--board", str(board_json)],
[sys.executable, str(renderer), str(board_json), str(board_md), "--check"],
]
for cmd in checks:
rc = run(cmd, repo_root)
if rc:
return rc
print(f"CC2 board validation PASS: {board_json} and {board_md} are canonical and in sync")
return 0
if __name__ == "__main__":
raise SystemExit(main())