(deps?: Partial<DetectDeps>)
| 158 | * to test against a virtual filesystem. |
| 159 | */ |
| 160 | export function detectOpenCode(deps?: Partial<DetectDeps>): OpenCodeDetection { |
| 161 | const d = { ...defaultDeps(), ...deps }; |
| 162 | |
| 163 | const binary = resolveCliBinary(d); |
| 164 | if (binary) return { kind: "cli", binary }; |
| 165 | |
| 166 | for (const appId of OPENCODE_DESKTOP_APP_IDS) { |
| 167 | const marker = join(desktopUserDataDir(d, appId), OPENCODE_DESKTOP_SETTINGS_FILE); |
| 168 | if (d.exists(marker)) return { kind: "desktop", marker }; |
| 169 | } |
| 170 | for (const appPath of desktopAppPaths(d)) { |
| 171 | if (d.exists(appPath)) return { kind: "desktop", marker: appPath }; |
| 172 | } |
| 173 | return { kind: "none" }; |
| 174 | } |
no test coverage detected