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

Function extraCliCandidates

packages/cli/src/lib/opencode-detect.ts:66–93  ·  view source on GitHub ↗

Extra absolute CLI locations beyond stock-bin + PATH, per OS.

(d: DetectDeps)

Source from the content-addressed store, hash-verified

64
65/** Extra absolute CLI locations beyond stock-bin + PATH, per OS. */
66function extraCliCandidates(d: DetectDeps): string[] {
67 if (d.platform === "win32") {
68 const appdata = d.env.APPDATA ?? "";
69 const localappdata = d.env.LOCALAPPDATA ?? "";
70 const userprofile = d.env.USERPROFILE ?? d.home;
71 const out: string[] = [];
72 if (appdata) {
73 out.push(join(appdata, "npm", "opencode.cmd"));
74 out.push(join(appdata, "npm", "opencode.exe"));
75 }
76 if (localappdata) {
77 out.push(join(localappdata, "Microsoft", "WinGet", "Links", "opencode.exe"));
78 out.push(join(localappdata, "opencode", "bin", "opencode.exe"));
79 }
80 if (userprofile) {
81 out.push(join(userprofile, "scoop", "shims", "opencode.exe"));
82 }
83 return out;
84 }
85 return [
86 "/usr/local/bin/opencode",
87 "/opt/homebrew/bin/opencode",
88 join(d.home, ".local", "bin", "opencode"),
89 join(d.home, ".local", "share", "mise", "shims", "opencode"),
90 join(d.home, ".asdf", "shims", "opencode"),
91 join(d.home, ".volta", "bin", "opencode"),
92 ];
93}
94
95/** Resolve a runnable `opencode` CLI binary, or null. */
96function resolveCliBinary(d: DetectDeps): string | null {

Callers 1

resolveCliBinaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected