feat(skills): add cross-platform install fallback for non-brew environments (#17687)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3ed4850838
Co-authored-by: mcrolly <60803337+mcrolly@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight
This commit is contained in:
McRolly NWANGWU
2026-02-15 21:25:26 -06:00
committed by GitHub
parent 9df21da129
commit d19b746928
8 changed files with 384 additions and 17 deletions

View File

@@ -74,7 +74,9 @@ function selectPreferredInstallSpec(
const goSpec = findKind("go");
const uvSpec = findKind("uv");
if (prefs.preferBrew && hasBinary("brew") && brewSpec) {
const brewAvailable = hasBinary("brew");
if (prefs.preferBrew && brewAvailable && brewSpec) {
return brewSpec;
}
if (uvSpec) {
@@ -83,12 +85,25 @@ function selectPreferredInstallSpec(
if (nodeSpec) {
return nodeSpec;
}
if (brewSpec) {
// Only prefer brew when it is actually installed; otherwise skip to
// alternatives so Linux/Docker environments without brew get a working
// install option instead of a guaranteed failure.
if (brewSpec && brewAvailable) {
return brewSpec;
}
if (goSpec) {
return goSpec;
}
// Prefer download over an unavailable brew spec.
const downloadSpec = findKind("download");
if (downloadSpec) {
return downloadSpec;
}
// Last resort: return brew spec even without brew so the caller can
// surface a descriptive error rather than "no installer found".
if (brewSpec) {
return brewSpec;
}
return indexed[0];
}