diff --git a/scripts/install-cli.ps1 b/scripts/install-cli.ps1 index cb4b0a87..29b630ec 100644 --- a/scripts/install-cli.ps1 +++ b/scripts/install-cli.ps1 @@ -64,7 +64,14 @@ if (-not $is64Bit) { try { $release = Invoke-RestMethod -Uri "https://api.github.com/repos/trycua/cua/releases/latest" -ErrorAction Stop $version = $release.tag_name -replace '^cua-v', '' - $binaryUrl = "https://github.com/trycua/cua/releases/download/$($release.tag_name)/cua-windows-x64.exe" + # Look for the windows binary in the release assets + $windowsAsset = $release.assets | Where-Object { $_.name -eq 'cua-windows-x64.exe' } + + if (-not $windowsAsset) { + throw "Windows binary not found in release assets" + } + + $binaryUrl = $windowsAsset.browser_download_url } catch { Write-Host "Warning: Could not fetch latest release, falling back to Bun installation" -ForegroundColor Yellow if (Install-WithBun) { diff --git a/scripts/install-cli.sh b/scripts/install-cli.sh index 5a7dd2db..5ac09ebf 100644 --- a/scripts/install-cli.sh +++ b/scripts/install-cli.sh @@ -31,7 +31,7 @@ else fi # Get the latest release version -LATEST_RELEASE=$(curl -s https://api.github.com/repos/trycua/cua/releases/latest | grep 'tag_name' | cut -d '"' -f 4) +LATEST_RELEASE=$(curl -s https://api.github.com/repos/trycua/cua/releases/latest) if [ -z "$LATEST_RELEASE" ]; then echo "⚠️ Could not fetch latest release, falling back to Bun installation" install_with_bun @@ -39,8 +39,17 @@ if [ -z "$LATEST_RELEASE" ]; then fi # Extract version number (remove 'cua-v' prefix) -VERSION=${LATEST_RELEASE#cua-v} -BINARY_URL="https://github.com/trycua/cua/releases/download/cua-v${VERSION}/${BINARY_NAME}" +TAG_NAME=$(echo "$LATEST_RELEASE" | grep 'tag_name' | cut -d '"' -f 4) +VERSION=${TAG_NAME#cua-v} + +# Find the binary URL in the release assets +BINARY_URL=$(echo "$LATEST_RELEASE" | grep -o "https://.*/download/[^"]*/${BINARY_NAME}" | head -1) + +if [ -z "$BINARY_URL" ]; then + echo "⚠️ Could not find ${BINARY_NAME} in release assets, falling back to Bun installation" + install_with_bun + exit 0 +fi # Create ~/.cua/bin directory if it doesn't exist INSTALL_DIR="$HOME/.cua/bin"