From c8859964fb758e41abde6db53ffbae235465a859 Mon Sep 17 00:00:00 2001 From: A Ibrahim Date: Sun, 12 Apr 2026 20:32:58 +0200 Subject: [PATCH 1/3] fix: update command resolution --- src/utils/update-check.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/utils/update-check.ts b/src/utils/update-check.ts index 7911e53..9f416ab 100644 --- a/src/utils/update-check.ts +++ b/src/utils/update-check.ts @@ -1,5 +1,4 @@ -import { execSync } from 'child_process'; -import { mkdirSync, readFileSync, writeFileSync } from 'fs'; +import { mkdirSync, readFileSync, realpathSync, writeFileSync } from 'fs'; import https from 'https'; import { homedir } from 'os'; import { join } from 'path'; @@ -96,8 +95,8 @@ export function isNewerVersion(current: string, latest: string): boolean { function isHomebrewInstall(): boolean { if (process.platform === 'win32') return false; try { - execSync('brew list tigris', { stdio: 'ignore' }); - return true; + const resolved = realpathSync(process.execPath); + return resolved.includes('/Cellar/') || resolved.includes('/Caskroom/'); } catch { return false; } @@ -107,15 +106,16 @@ function isHomebrewInstall(): boolean { * Returns the platform-appropriate shell command for updating the CLI. */ export function getUpdateCommand(): string { + if (isHomebrewInstall()) { + return 'brew upgrade tigris'; + } + const isBinary = (globalThis as { __TIGRIS_BINARY?: boolean }).__TIGRIS_BINARY === true; - const isWindows = process.platform === 'win32'; if (!isBinary) { return 'npm install -g @tigrisdata/cli'; - } else if (isHomebrewInstall()) { - return 'brew upgrade tigris'; - } else if (isWindows) { + } else if (process.platform === 'win32') { return 'irm https://github.com/tigrisdata/cli/releases/latest/download/install.ps1 | iex'; } else { return 'curl -fsSL https://github.com/tigrisdata/cli/releases/latest/download/install.sh | sh'; From c16663e3f8518714d76cc0c7bc0abe1c15327ef7 Mon Sep 17 00:00:00 2001 From: A Ibrahim Date: Sun, 12 Apr 2026 20:44:43 +0200 Subject: [PATCH 2/3] fix: update brew for stable releases only --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 280d772..5463857 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -150,7 +150,7 @@ jobs: update-homebrew: needs: [release, build-binaries] - if: needs.release.outputs.new_release_published == 'true' + if: needs.release.outputs.new_release_published == 'true' && github.ref == 'refs/heads/release' runs-on: ubuntu-latest steps: From 8e6fcc567a2f2fc3cb564391b7177c618e69d601 Mon Sep 17 00:00:00 2001 From: A Ibrahim Date: Mon, 13 Apr 2026 10:01:49 +0200 Subject: [PATCH 3/3] fix: check isBinary before isHomebrewInstall to avoid false positives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When installed via npm, process.execPath points to Node — not our binary. If Node itself was installed via Homebrew, the Cellar path check would falsely return "brew upgrade" instead of "npm install -g". Co-Authored-By: Claude Opus 4.6 (1M context) --- src/utils/update-check.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/utils/update-check.ts b/src/utils/update-check.ts index 9f416ab..756e2fe 100644 --- a/src/utils/update-check.ts +++ b/src/utils/update-check.ts @@ -106,18 +106,25 @@ function isHomebrewInstall(): boolean { * Returns the platform-appropriate shell command for updating the CLI. */ export function getUpdateCommand(): string { - if (isHomebrewInstall()) { - return 'brew upgrade tigris'; - } - const isBinary = (globalThis as { __TIGRIS_BINARY?: boolean }).__TIGRIS_BINARY === true; + // npm install — process.execPath is Node, not our binary. + // Must come before isHomebrewInstall() to avoid false positives + // when Node itself was installed via Homebrew. if (!isBinary) { return 'npm install -g @tigrisdata/cli'; - } else if (process.platform === 'win32') { + } + // Standalone binary installed via Homebrew (execPath resolves to /Cellar/ or /Caskroom/) + else if (isHomebrewInstall()) { + return 'brew upgrade tigris'; + } + // Standalone binary on Windows + else if (process.platform === 'win32') { return 'irm https://github.com/tigrisdata/cli/releases/latest/download/install.ps1 | iex'; - } else { + } + // Standalone binary on macOS/Linux (installed via curl) + else { return 'curl -fsSL https://github.com/tigrisdata/cli/releases/latest/download/install.sh | sh'; } }