Extra absolute CLI locations beyond stock-bin + PATH, per OS.
(d: DetectDeps)
| 64 | |
| 65 | /** Extra absolute CLI locations beyond stock-bin + PATH, per OS. */ |
| 66 | function 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. */ |
| 96 | function resolveCliBinary(d: DetectDeps): string | null { |