#!/usr/bin/env python3 from __future__ import annotations import argparse import json import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT / "backend")) from app.agents.evaluation_agent import evaluate_project # noqa: E402 from app.agents.validation_agent import validate_project # noqa: E402 def main() -> None: parser = argparse.ArgumentParser(description="Run local evaluation and validation agents.") parser.add_argument("--build", action="store_true", help="also run pytest and frontend build") parser.add_argument("--live", action="store_true", help="also check live backend/frontend HTTP endpoints") parser.add_argument("--acceptance", action="store_true", help="run the lightweight live acceptance smoke") parser.add_argument("--real", action="store_true", help="run real workspace data acceptance through the live backend") parser.add_argument("--no-deep", action="store_true", help="skip synthetic deep training acceptance") parser.add_argument("--out", default="var/agent_reports/latest.json") args = parser.parse_args() report = { "evaluation": evaluate_project(), "validation": validate_project( run_build=args.build, run_live=args.live, run_acceptance=args.acceptance, run_real=args.real, run_deep=not args.no_deep, ), } out = ROOT / args.out out.parent.mkdir(parents=True, exist_ok=True) out.write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8") print(json.dumps(report, ensure_ascii=False, indent=2)) if not report["evaluation"]["passed"] or not report["validation"]["passed"]: raise SystemExit(1) if __name__ == "__main__": main()