Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

fix(installer): resolve latest release without api.github.com (#1852)

xerj-orgd23bb7e5ae58
diff --git a/landing/get b/landing/get
index 40417d025..4d5dc3974 100644
--- a/landing/get
+++ b/landing/get
@@ -88,9 +88,19 @@ target="${cpu}-${plat}"
# --- resolve version --------------------------------------------------------
if [ "${XERJ_VERSION:-}" = "" ]; then
info "resolving latest release of ${REPO}…"
- # Follow the /releases/latest redirect to read the tag without jq.
- tag=$(DLS "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null \
- | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p' | head -n1)
+ # Prefer github.com /releases/latest redirect (no api.github.com rate limit).
+ # curl -w '%{url_effective}' follows redirects and prints the final .../tag/vX.Y.Z URL.
+ tag=""
+ if command -v curl >/dev/null 2>&1; then
+ tag=$(curl -fsSLI -o /dev/null -w '%{url_effective}' \
+ "https://github.com/${REPO}/releases/latest" 2>/dev/null \
+ | sed -n 's|.*/tag/\([^/]*\)$|\1|p' | head -n1)
+ fi
+ # Fall back to the REST endpoint when the redirect path yields nothing.
+ if [ -z "$tag" ]; then
+ tag=$(DLS "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null \
+ | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p' | head -n1)
+ fi
[ -n "$tag" ] || die "could not resolve latest release — set XERJ_VERSION=vX.Y.Z (see https://github.com/${REPO}/releases)"
else
tag="$XERJ_VERSION"
diff --git a/landing/get.ps1 b/landing/get.ps1
index 0919941cc..7890d19e5 100644
--- a/landing/get.ps1
+++ b/landing/get.ps1
@@ -59,11 +59,24 @@
if ($tag -notmatch '^v') { $tag = "v$tag" } # release tags are v-prefixed
} else {
Write-Step "resolving latest release of $Repo..."
+ # Prefer github.com /releases/latest redirect (no api.github.com rate limit).
try {
- $rel = Invoke-RestMethod -UseBasicParsing -Uri "https://api.github.com/repos/$Repo/releases/latest"
- $tag = $rel.tag_name
+ $resp = Invoke-WebRequest -UseBasicParsing -MaximumRedirection 0 -Uri "https://github.com/$Repo/releases/latest" -ErrorAction SilentlyContinue
} catch {
- Fail "could not resolve the latest release ($($_.Exception.Message)) - set `$env:XERJ_VERSION='vX.Y.Z' (see https://github.com/$Repo/releases)"
+ # 302 is expected; PowerShell surfaces it as an error when MaxRedirection=0.
+ $resp = $_.Exception.Response
+ }
+ if ($resp -and $resp.Headers -and $resp.Headers.Location) {
+ $loc = [string]$resp.Headers.Location
+ if ($loc -match '/tag/([^/\s]+)$') { $tag = $Matches[1] }
+ }
+ if (-not $tag) {
+ try {
+ $rel = Invoke-RestMethod -UseBasicParsing -Uri "https://api.github.com/repos/$Repo/releases/latest"
+ $tag = $rel.tag_name
+ } catch {
+ Fail "could not resolve the latest release ($($_.Exception.Message)) - set `$env:XERJ_VERSION='vX.Y.Z' (see https://github.com/$Repo/releases)"
+ }
}
if (-not $tag) { Fail "could not resolve the latest release - set `$env:XERJ_VERSION='vX.Y.Z'" }
}