"""아키텍처 v3 검증 스크립트. 사용법: 프로젝트 루트 또는 tests/ 디렉토리 어디서든 실행 가능. cd variet-agent && python tests/test_architecture.py cd variet-agent/tests && python test_architecture.py """ import sys import os # 프로젝트 루트를 sys.path에 추가 _root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if _root not in sys.path: sys.path.insert(0, _root) errors = [] # 1. core 계층 try: from core.gemini_caller import GeminiCaller, GeminiCallError print("✅ core.gemini_caller OK") except Exception as e: errors.append(f"❌ core.gemini_caller: {e}") try: from core.orchestrator import Orchestrator print("✅ core.orchestrator OK") except Exception as e: errors.append(f"❌ core.orchestrator: {e}") try: from core.task_pipeline import TaskPipeline print("✅ core.task_pipeline OK") except Exception as e: errors.append(f"❌ core.task_pipeline: {e}") # 2. tools 계층 (CLI 스크립트) try: from tools.anime_pipeline import AnimePipeline print("✅ tools.anime_pipeline OK") except Exception as e: errors.append(f"❌ tools.anime_pipeline: {e}") try: from tools.anissia_client import AnissiaClient, AnimeInfo print("✅ tools.anissia_client OK") except Exception as e: errors.append(f"❌ tools.anissia_client: {e}") try: from tools.nyaa_client import NyaaClient, TorrentResult print("✅ tools.nyaa_client OK") except Exception as e: errors.append(f"❌ tools.nyaa_client: {e}") try: from tools.qbit_client import QBitClient print("✅ tools.qbit_client OK") except Exception as e: errors.append(f"❌ tools.qbit_client: {e}") try: from tools.nas_scanner import NasScanner print("✅ tools.nas_scanner OK") except Exception as e: errors.append(f"❌ tools.nas_scanner: {e}") try: from tools.title_matcher import match_titles, japanese_to_romaji print("✅ tools.title_matcher OK") except Exception as e: errors.append(f"❌ tools.title_matcher: {e}") # 3. handlers 계층 try: from handlers.renderer import safe_send_embed print("✅ handlers.renderer OK") except Exception as e: errors.append(f"❌ handlers.renderer: {e}") # 4. 삭제 확인 for should_not_exist in ["tools/base.py", "tools/registry.py", "tools/anime_tool.py", "prompts/planner.md", "prompts/coder.md", "prompts/summarizer.md"]: path = os.path.join(_root, should_not_exist) if os.path.exists(path): errors.append(f"❌ 삭제해야 할 파일 존재: {should_not_exist}") else: print(f"✅ {should_not_exist} 삭제됨") # 5. 필수 파일 확인 for should_exist in ["prompts/agent.md", "prompts/unified.md", "prompts/reviewer.md", ".gemini/skills/anime/SKILL.md"]: path = os.path.join(_root, should_exist) if os.path.exists(path): print(f"✅ {should_exist} 존재") else: errors.append(f"❌ 필수 파일 없음: {should_exist}") # 결과 print(f"\n{'='*40}") if errors: print(f"❌ {len(errors)}개 오류:") for e in errors: print(f" {e}") sys.exit(1) else: print("✅ v3 아키텍처 검증 통과!") sys.exit(0)