Lazy-import an adapter to keep CLI fast when only one harness is targeted.
(harness_id: str, output_root: Path)
| 39 | |
| 40 | |
| 41 | def get_adapter(harness_id: str, output_root: Path) -> HarnessAdapter: |
| 42 | """Lazy-import an adapter to keep CLI fast when only one harness is targeted.""" |
| 43 | if harness_id == "codex": |
| 44 | from tools.adapters.codex import CodexAdapter |
| 45 | |
| 46 | return CodexAdapter(output_root=output_root) |
| 47 | if harness_id == "cursor": |
| 48 | from tools.adapters.cursor import CursorAdapter |
| 49 | |
| 50 | return CursorAdapter(output_root=output_root) |
| 51 | if harness_id == "opencode": |
| 52 | from tools.adapters.opencode import OpenCodeAdapter |
| 53 | |
| 54 | return OpenCodeAdapter(output_root=output_root) |
| 55 | if harness_id == "gemini": |
| 56 | from tools.adapters.gemini import GeminiAdapter |
| 57 | |
| 58 | return GeminiAdapter(output_root=output_root) |
| 59 | if harness_id == "copilot": |
| 60 | from tools.adapters.copilot import CopilotAdapter |
| 61 | |
| 62 | return CopilotAdapter(output_root=output_root) |
| 63 | raise ValueError(f"Unknown harness: {harness_id}. Supported: {supported_harnesses()}") |
| 64 | |
| 65 | |
| 66 | def _validate_output_root(output_root: Path) -> str | None: |
no test coverage detected