Coverage for src/lilbee/app/agent_configs/detect.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-08-14 11:46 +0000

1"""Which of the supported agent CLIs are installed on this machine.""" 

2 

3from __future__ import annotations 

4 

5from dataclasses import dataclass 

6 

7from lilbee.app.agent_configs.document import AgentClient 

8from lilbee.core.system import find_executable 

9 

10 

11@dataclass(frozen=True) 

12class ClientDetection: 

13 """Whether one client's CLI is installed, and where it was found.""" 

14 

15 client: AgentClient 

16 cli_detected: bool 

17 cli_path: str | None 

18 

19 

20def detect_agent_client(client: AgentClient) -> ClientDetection: 

21 """Probe for *client*'s executable. Its name on disk is the client name.""" 

22 path = find_executable(client.value) 

23 return ClientDetection(client=client, cli_detected=path is not None, cli_path=path) 

24 

25 

26def detect_agent_clients() -> list[ClientDetection]: 

27 """Probe for every supported client, in declaration order.""" 

28 return [detect_agent_client(client) for client in AgentClient]