From edc4724f9d61785f3683d4dae9f512ef767993af Mon Sep 17 00:00:00 2001 From: geobelsky Date: Mon, 8 Jun 2026 16:20:09 +0000 Subject: [PATCH] fix(install): skip extension-v* releases when picking latest CLI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit install.sh and install.ps1 both hit /releases/latest, which returns the most recently published release across all tracks. We publish two parallel tracks from the same repo: `v*` for CLI binaries and `extension-v*` for the .vsix bundles. Whenever an extension release is the most recent, install.sh/install.ps1 picks that tag, builds a download URL like `axme-code-linux-x64` against it, and 404s because extension releases only ship `.vsix` files. Today's release order (v0.6.0 first, then extension-v0.1.5 ~8 hours later) tripped this exact case — every fresh `curl|bash install.sh` call now returns 404 until we resolve the latest CLI release correctly. Fix: switch both installers from `/releases/latest` to `/releases?per_page=30` and pick the first `tag_name` matching `^v[0-9]`. Releases are listed by published_at DESC, so the first match is the most recent CLI release. `extension-v*` tags are skipped. Verified against the live API: returns `v0.6.0`. Co-Authored-By: Claude Opus 4.7 (1M context) --- install.ps1 | 16 +++++++++++++--- install.sh | 14 +++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/install.ps1 b/install.ps1 index d946bf9..f34c17d 100644 --- a/install.ps1 +++ b/install.ps1 @@ -26,10 +26,20 @@ function Get-Arch { } function Get-LatestTag { - $url = "https://api.github.com/repos/$Repo/releases/latest" + # We publish two parallel release tracks under the same repo: + # v* — CLI binary releases (this script installs these). + # extension-v* — VS Code / Cursor extension .vsix releases. + # /releases/latest returns whichever was published most recently overall and + # can flip to an extension release any time we publish an extension after a + # CLI release — that yields the `extension-v*` tag and a 404 when this + # script tries to download `axme-code-$platform` from it. Fetch the list + # endpoint instead and filter to the first `v[0-9]…` tag. + $url = "https://api.github.com/repos/$Repo/releases?per_page=30" try { - $release = Invoke-RestMethod -Uri $url -Headers @{ 'User-Agent' = 'axme-code-installer' } - return $release.tag_name + $releases = Invoke-RestMethod -Uri $url -Headers @{ 'User-Agent' = 'axme-code-installer' } + $cliRelease = $releases | Where-Object { $_.tag_name -match '^v[0-9]' } | Select-Object -First 1 + if (-not $cliRelease) { throw "No CLI release (tag matching ^v[0-9]) found in the 30 most recent releases." } + return $cliRelease.tag_name } catch { throw "Failed to fetch latest release from $url : $($_.Exception.Message)" } diff --git a/install.sh b/install.sh index 3ae7e18..a46e817 100755 --- a/install.sh +++ b/install.sh @@ -27,11 +27,19 @@ detect_platform() { # Get latest release tag from GitHub API get_latest_version() { - local url="https://api.github.com/repos/${REPO}/releases/latest" + # We publish two parallel release tracks under the same repo: + # - `v*` — CLI binary releases (this script installs these). + # - `extension-v*` — VS Code / Cursor extension .vsix releases. + # `/releases/latest` returns the most recently published release overall and + # can flip to an extension release any time we publish an extension after a + # CLI release. That returns the `extension-v*` tag, and the binary download + # URL `axme-code-${platform}` 404s because the extension release only ships + # `.vsix` files. Fetch the recent list and filter to the first `v[0-9]…` tag. + local url="https://api.github.com/repos/${REPO}/releases?per_page=30" if command -v curl &>/dev/null; then - curl -fsSL "$url" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//' + curl -fsSL "$url" | grep '"tag_name"' | sed 's/.*"tag_name": *"//;s/".*//' | grep -E '^v[0-9]' | head -1 elif command -v wget &>/dev/null; then - wget -qO- "$url" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//' + wget -qO- "$url" | grep '"tag_name"' | sed 's/.*"tag_name": *"//;s/".*//' | grep -E '^v[0-9]' | head -1 else echo "Neither curl nor wget found" >&2; exit 1 fi