mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 11:05:31 +08:00
fix(cli): resolve latest CLI release when GitHub latest points to non-CLI tag (#12148)
* fix(cli): resolve latest CLI release when install script hits non-CLI tag The GitHub releases/latest endpoint can point to non-CLI releases (e.g., jetbrains/v7.0.4), whose tag prefix doesn't match the existing version regex. Query the paginated releases endpoint, pick the first tag starting with 'v', and use that version for both display and the download URL instead of trusting releases/latest. Closes #12125 * fix(cli): select stable installer release --------- Co-authored-by: marius-kilocode <marius@kilocode.ai>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@kilocode/cli": patch
|
||||
---
|
||||
|
||||
Install the latest stable CLI release when newer non-CLI or prerelease releases exist.
|
||||
@@ -183,13 +183,17 @@ else
|
||||
fi
|
||||
|
||||
if [ -z "$requested_version" ]; then
|
||||
url="https://github.com/Kilo-Org/kilocode/releases/latest/download/$filename"
|
||||
specific_version=$(curl -s https://api.github.com/repos/Kilo-Org/kilocode/releases/latest | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p')
|
||||
|
||||
if [[ $? -ne 0 || -z "$specific_version" ]]; then
|
||||
# The npm latest tag tracks stable CLI releases independently of other GitHub release types.
|
||||
if ! specific_version=$(curl -fsSL "https://registry.npmjs.org/-/package/%40kilocode%2Fcli/dist-tags" |
|
||||
sed -n 's/.*"latest"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p'); then
|
||||
echo -e "${RED}Failed to fetch version information${NC}"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! "$specific_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo -e "${RED}Failed to fetch version information${NC}"
|
||||
exit 1
|
||||
fi
|
||||
url="https://github.com/Kilo-Org/kilocode/releases/download/v${specific_version}/$filename"
|
||||
else
|
||||
# Strip leading 'v' if present
|
||||
requested_version="${requested_version#v}"
|
||||
|
||||
Reference in New Issue
Block a user