Files
orca/src/shared/system-cli-install-dirs.ts
T
Brynn Bendixenandbrynnclaw 963e8cc431 fix(preflight): detect Grok installed in ~/.grok/bin (#25324)
Grok's installer defaults to ~/.grok/bin and only symlinks into
~/.local/bin when that dir is already on PATH. A GUI-launched Orca never
looked in ~/.grok/bin, so the Agents page reported Grok as not installed.

Append ~/.grok/bin after ~/.vite-plus/bin in the three lists that must
stay in step: the packaged PATH seed, the system install-dir lookup
fallback, and the POSIX/WSL guest fallback prelude.

Fixes #17590

Co-authored-by: brynnclaw <261708852+brynnclaw@users.noreply.github.com>
2026-10-26 01:55:02 -07:00

35 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { join } from 'node:path'
/** Lookup-only fallback: prepending system dirs to inherited PATH would reorder the user’s binaries (#18234).
* Keep system-block order aligned with patchPackagedProcessPath/POSIX_VERSION_MANAGER_BIN_DIRS; cross-block precedence differs
* for ~/.local/bin, which precedes this fallback but follows seeded system dirs. Do not hoist system paths above version managers.
* Omit sbin/~/bin and off-darwin /opt/homebrew; Linuxbrew has its own prefix. Include installer-owned .opencode/.vite-plus (#829) and .grok (#17590) bins.
* Exception: a newly discovered CLI with sibling node may prepend that dir only to its child PATH for runtime pairing (#10932). */
export function getSystemCliInstallDirectories(
platform: NodeJS.Platform,
homePath: string
): string[] {
// Both lookup and seeded system blocks cover POSIX only; Windows installer paths remain outside this fallback.
if (platform === 'win32') {
return []
}
const directories: string[] = []
if (platform === 'darwin') {
// Apple Silicon Homebrew; Intel Homebrew shares /usr/local with npm's prefix.
directories.push('/opt/homebrew/bin')
}
directories.push('/usr/local/bin')
if (platform === 'linux') {
// Avoid phantom snap/Linuxbrew probes off Linux, matching seeded PATH.
directories.push('/snap/bin', '/home/linuxbrew/.linuxbrew/bin')
}
directories.push(
'/nix/var/nix/profiles/default/bin',
join(homePath, '.nix-profile', 'bin'),
join(homePath, '.opencode', 'bin'),
join(homePath, '.vite-plus', 'bin'),
join(homePath, '.grok', 'bin')
)
return directories
}