diff --git a/bin/gstack-update-check b/bin/gstack-update-check index d44c7e0f..0341e202 100755 --- a/bin/gstack-update-check +++ b/bin/gstack-update-check @@ -140,6 +140,20 @@ fi # ─── Step 4: Slow path — fetch remote version ──────────────── mkdir -p "$STATE_DIR" +# Fire Supabase install ping in background (parallel, non-blocking) +# This logs an update check event for community health metrics. +# If the endpoint isn't configured or Supabase is down, this is a no-op. +_SUPA_ENDPOINT="${GSTACK_TELEMETRY_ENDPOINT:-}" +if [ -n "$_SUPA_ENDPOINT" ]; then + _OS="$(uname -s | tr '[:upper:]' '[:lower:]')" + curl -sf --max-time 5 \ + -X POST "${_SUPA_ENDPOINT%/telemetry-ingest}/update-check" \ + -H "Content-Type: application/json" \ + -d "{\"version\":\"$LOCAL\",\"os\":\"$_OS\"}" \ + >/dev/null 2>&1 & +fi + +# GitHub raw fetch (primary, always reliable) REMOTE="" REMOTE="$(curl -sf --max-time 5 "$REMOTE_URL" 2>/dev/null || true)" REMOTE="$(echo "$REMOTE" | tr -d '[:space:]')" @@ -161,4 +175,12 @@ echo "UPGRADE_AVAILABLE $LOCAL $REMOTE" > "$CACHE_FILE" if check_snooze "$REMOTE"; then exit 0 # snoozed — stay quiet fi + +# Log upgrade_prompted event (only on slow-path fetch, not cached replays) +TEL_CMD="$GSTACK_DIR/bin/gstack-telemetry-log" +if [ -x "$TEL_CMD" ]; then + "$TEL_CMD" --event-type upgrade_prompted --skill "" --duration 0 \ + --outcome success --session-id "update-$$-$(date +%s)" 2>/dev/null & +fi + echo "UPGRADE_AVAILABLE $LOCAL $REMOTE"