MCPcopy Create free account
hub / github.com/cortexkit/magic-context / detectOpenCode

Function detectOpenCode

packages/cli/src/lib/opencode-detect.ts:160–174  ·  view source on GitHub ↗
(deps?: Partial<DetectDeps>)

Source from the content-addressed store, hash-verified

158 * to test against a virtual filesystem.
159 */
160export 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}

Callers 5

runDoctorFunction · 0.90
runSetupFunction · 0.90
collectDiagnosticsFunction · 0.90
isInstalledMethod · 0.90

Calls 4

defaultDepsFunction · 0.85
resolveCliBinaryFunction · 0.85
desktopUserDataDirFunction · 0.85
desktopAppPathsFunction · 0.85

Tested by

no test coverage detected