Wire specialist waves, Brain consolidation, and Classic-compatible reports so Agent mode can run end-to-end via OpenRouter without changing the default Classic path. Co-authored-by: Cursor <cursoragent@cursor.com>
70 lines
2.4 KiB
Python
70 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
run_check.py - CLI entry point for the conflict checker (the tuning loop).
|
|
|
|
Usage:
|
|
python cli/run_check.py path/to/set.pdf [--out out_dir]
|
|
|
|
Run from the project root so `backend` is importable.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import argparse
|
|
|
|
# Make the project root importable when run as a script.
|
|
_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
if _ROOT not in sys.path:
|
|
sys.path.insert(0, _ROOT)
|
|
|
|
from backend.agents.runner import run_agent_pipeline # noqa: E402
|
|
from backend.pipeline.runner import run_pipeline # noqa: E402
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description="Cross-discipline drawing conflict checker")
|
|
parser.add_argument("pdf", help="Path to the PDF drawing set")
|
|
parser.add_argument("--out", default=None,
|
|
help="Directory for artifacts (default: out/<pdf-stem>)")
|
|
parser.add_argument("--mode", choices=("classic", "agent"), default="classic",
|
|
help="Pipeline implementation to run (default: classic)")
|
|
parser.add_argument("--project-name", default=None)
|
|
parser.add_argument("--address", default=None)
|
|
parser.add_argument("--occupancy", default=None)
|
|
parser.add_argument("--work-type", default=None,
|
|
help="new_building | remodel | tenant_improvement | addition | ...")
|
|
args = parser.parse_args()
|
|
|
|
if not os.path.isfile(args.pdf):
|
|
print(f"Error: file not found: {args.pdf}")
|
|
return 1
|
|
|
|
project_input = {
|
|
k: v for k, v in {
|
|
"project_name": args.project_name, "address": args.address,
|
|
"occupancy": args.occupancy, "work_type": args.work_type,
|
|
}.items() if v
|
|
}
|
|
out_dir = args.out or os.path.join("out", os.path.splitext(os.path.basename(args.pdf))[0])
|
|
runner = run_agent_pipeline if args.mode == "agent" else run_pipeline
|
|
report = runner(
|
|
args.pdf,
|
|
out_dir=out_dir,
|
|
project_input=project_input or None,
|
|
source_name=os.path.basename(args.pdf),
|
|
)
|
|
|
|
s = report["summary"]
|
|
print("\n" + "=" * 60)
|
|
print(f" Conflicts found: {s['conflicts_found']} "
|
|
f"(high {s['by_severity']['high']}, "
|
|
f"medium {s['by_severity']['medium']}, "
|
|
f"low {s['by_severity']['low']})")
|
|
print(f" Report: {os.path.join(out_dir, 'report.md')}")
|
|
print("=" * 60)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|