MCPcopy
hub / github.com/wshobson/agents / get_adapter

Function get_adapter

tools/generate.py:41–63  ·  view source on GitHub ↗

Lazy-import an adapter to keep CLI fast when only one harness is targeted.

(harness_id: str, output_root: Path)

Source from the content-addressed store, hash-verified

39
40
41def 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
66def _validate_output_root(output_root: Path) -> str | None:

Callers 1

mainFunction · 0.85

Calls 6

CodexAdapterClass · 0.90
CursorAdapterClass · 0.90
OpenCodeAdapterClass · 0.90
GeminiAdapterClass · 0.90
CopilotAdapterClass · 0.90
supported_harnessesFunction · 0.90

Tested by

no test coverage detected