Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions bin/install-latest-linux.sh

This file was deleted.

15 changes: 12 additions & 3 deletions bin/install-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ case "${ARCH}" in
aarch64) ARCH="arm64" ;;
esac

# Get the appropriate download URL for this platform
DOWNLOAD_URL="$(curl -s https://api.github.com/repos/brevdev/brev-cli/releases/latest | grep "browser_download_url.*${OS}.*${ARCH}" | cut -d '"' -f 4)"
# Fetch release metadata from GitHub API
API_RESPONSE="$(curl -sf ${GITHUB_TOKEN:+-H "Authorization: token ${GITHUB_TOKEN}"} https://api.github.com/repos/brevdev/brev-cli/releases/latest)" || {
echo "Error: Failed to fetch release info from GitHub API." >&2
echo "This is often caused by rate limiting when many requests come from the same IP." >&2
echo "If you are using a VPN, try turning it off and running this script again." >&2
echo "You can also set GITHUB_TOKEN to avoid rate limits." >&2
echo "For more details, see: https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting" >&2
exit 1
}

# Verify we found a suitable release
# Extract the download URL for this platform
DOWNLOAD_URL="$(echo "${API_RESPONSE}" | grep "browser_download_url.*${OS}.*${ARCH}" | cut -d '"' -f 4 || true)"
if [ -z "${DOWNLOAD_URL}" ]; then
echo "Error: Could not find release for ${OS} ${ARCH}" >&2
echo "GitHub API response (truncated): ${API_RESPONSE:0:200}" >&2
exit 1
fi

Expand Down
21 changes: 15 additions & 6 deletions scripts/install-agent-skill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,21 @@ done
rm -rf "$TMPDIR"

# Resolve commit SHA and write .version file
COMMIT_SHA=$(curl -fsSL "https://api.github.com/repos/$REPO/commits/$BRANCH" 2>/dev/null | grep '"sha"' | head -1 | sed 's/.*"sha": *"\([^"]*\)".*/\1/')
if [[ -n "$COMMIT_SHA" ]]; then
for dir in "${INSTALL_DIRS[@]}"; do
printf 'branch=%s\ncommit=%s\n' "$BRANCH" "$COMMIT_SHA" > "$dir/.version"
done
echo -e " ${GREEN}✓${NC} .version (${COMMIT_SHA:0:12})"
VERSION_RESPONSE=$(curl -fsSL "https://api.github.com/repos/$REPO/commits/$BRANCH" 2>&1) || true
if echo "$VERSION_RESPONSE" | grep -q "API rate limit exceeded"; then
echo -e " ${YELLOW}⚠${NC} .version (skipped — GitHub API rate limit exceeded)"
echo -e " ${YELLOW}If you are using a VPN, try turning it off and running this script again.${NC}"
echo -e " ${YELLOW}See: https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting${NC}"
else
COMMIT_SHA=$(echo "$VERSION_RESPONSE" | grep '"sha"' | head -1 | sed 's/.*"sha": *"\([^"]*\)".*/\1/' || true)
if [[ -n "$COMMIT_SHA" ]]; then
for dir in "${INSTALL_DIRS[@]}"; do
printf 'branch=%s\ncommit=%s\n' "$BRANCH" "$COMMIT_SHA" > "$dir/.version"
done
echo -e " ${GREEN}✓${NC} .version (${COMMIT_SHA:0:12})"
else
echo -e " ${YELLOW}⚠${NC} .version (could not resolve commit SHA)"
fi
fi

echo ""
Expand Down
Loading