From f387428bcaf6ec68e0d4e50845a3113dbc4f19eb Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Mon, 9 Feb 2026 03:34:57 -0800 Subject: [PATCH] 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 --- sprite/lib/common.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sprite/lib/common.sh b/sprite/lib/common.sh index dfd3ca85..c8cdf49c 100644 --- a/sprite/lib/common.sh +++ b/sprite/lib/common.sh @@ -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