@shipers-dev/multi 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/detect.ts DELETED
@@ -1,70 +0,0 @@
1
- export type AgentType = 'claude-code' | 'codex' | 'gemini-cli' | 'openclaw' | 'opencode' | 'pi' | 'custom';
2
-
3
- export interface DetectedAgent {
4
- type: AgentType;
5
- path: string;
6
- version?: string;
7
- }
8
-
9
- const AGENT_BINARIES: Record<AgentType, string[]> = {
10
- 'claude-code': ['claude', 'claude-code', 'claude_code'],
11
- 'codex': ['codex', 'openai-codex'],
12
- 'gemini-cli': ['gemini', 'gemini-cli', 'google-gemini'],
13
- 'openclaw': ['openclaw'],
14
- 'opencode': ['opencode'],
15
- 'pi': ['pi'],
16
- 'custom': [],
17
- };
18
-
19
- export async function detectAgents(): Promise<DetectedAgent[]> {
20
- const detected: DetectedAgent[] = [];
21
-
22
- // Check PATH for known agent binaries
23
- const path = Bun.env.PATH?.split(':') || [];
24
-
25
- for (const [type, binaries] of Object.entries(AGENT_BINARIES)) {
26
- if (type === 'custom') continue;
27
-
28
- for (const binary of binaries) {
29
- const found = await which(binary);
30
- if (found) {
31
- const version = await getVersion(found);
32
- detected.push({ type: type as AgentType, path: found, version });
33
- break;
34
- }
35
- }
36
- }
37
-
38
- return detected;
39
- }
40
-
41
- async function which(cmd: string): Promise<string | null> {
42
- for (const dir of Bun.env.PATH?.split(':') || []) {
43
- const fullPath = `${dir}/${cmd}`;
44
- try {
45
- const stat = await fileExists(fullPath);
46
- if (stat) return fullPath;
47
- } catch {
48
- // Continue
49
- }
50
- }
51
- return null;
52
- }
53
-
54
- async function fileExists(path: string): Promise<boolean> {
55
- try {
56
- return await Bun.file(path).exists();
57
- } catch {
58
- return false;
59
- }
60
- }
61
-
62
- async function getVersion(path: string): Promise<string | undefined> {
63
- try {
64
- const proc = Bun.spawn([path, '--version'], { stdout: 'pipe' });
65
- const output = await new Response(proc.stdout).text();
66
- return output.trim() || undefined;
67
- } catch {
68
- return undefined;
69
- }
70
- }