#!/usr/bin/env python3
"""dispatch.py와 orchestrator.py 프롬프트 일치 검증"""

import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent.parent))

from dispatch import build_prompt as dispatch_bp  # type: ignore[reportAttributeAccessIssue]
from orchestrator import build_prompt as orch_bp  # type: ignore[reportAttributeAccessIssue]

# dev3-team 검증
dp = dispatch_bp("dev3-team", "API 개발", "task-10.1", "normal")
op = orch_bp({"id": "task-10.1", "desc": "API 개발", "level": "normal"}, "dev3-team")

if dp == op:
    print("[OK] dev3-team: dispatch.py와 orchestrator.py 프롬프트 동일!")
else:
    print("[FAIL] dev3-team: 프롬프트가 다릅니다!")
    dp_lines = dp.split("\n")
    op_lines = op.split("\n")
    for i, (a, b) in enumerate(zip(dp_lines, op_lines)):
        if a != b:
            print(f"  Line {i}: dispatch={repr(a)}")
            print(f"           orch   ={repr(b)}")

# dev1-team 검증
dp1 = dispatch_bp("dev1-team", "UI 개발", "task-11.1", "critical")
op1 = orch_bp({"id": "task-11.1", "desc": "UI 개발", "level": "critical"}, "dev1-team")

if dp1 == op1:
    print("[OK] dev1-team: dispatch.py와 orchestrator.py 프롬프트 동일!")
else:
    print("[FAIL] dev1-team: 프롬프트가 다릅니다!")

# dev2-team + security 검증
dp2 = dispatch_bp("dev2-team", "보안 작업", "task-12.1", "security")
op2 = orch_bp({"id": "task-12.1", "desc": "보안 작업", "level": "security"}, "dev2-team")

if dp2 == op2:
    print("[OK] dev2-team (security): dispatch.py와 orchestrator.py 프롬프트 동일!")
else:
    print("[FAIL] dev2-team (security): 프롬프트가 다릅니다!")

print("\n=== 일치성 검증 완료 ===")
