fix: Check sprite version before reinstalling (#69)

- Modified ensure_sprite_installed() to check if sprite is already installed
- When sprite is found, log version and skip installation
- Prevents unnecessary reinstalls when sprite CLI is already present

Fixes #63

Agent: community-coordinator

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-02-09 03:34:57 -08:00 committed by GitHub
parent 6f5d406861
commit f387428bca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,11 +15,18 @@ SPRITE_CONNECTIVITY_POLL_DELAY=${SPRITE_CONNECTIVITY_POLL_DELAY:-5} # Delay bet
# Check if sprite CLI is installed, install if not
ensure_sprite_installed() {
if ! command -v sprite &> /dev/null; then
log_warn "Installing sprite CLI..."
curl -fsSL https://sprites.dev/install.sh | bash
export PATH="${HOME}/.local/bin:${PATH}"
if command -v sprite &> /dev/null; then
# sprite is already installed, check version
local installed_version
installed_version=$(sprite version 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?' || echo "unknown")
log_info "sprite ${installed_version} already installed, skipping installation"
return 0
fi
# sprite not found, install it
log_warn "Installing sprite CLI..."
curl -fsSL https://sprites.dev/install.sh | bash
export PATH="${HOME}/.local/bin:${PATH}"
}
# Check if already authenticated with sprite