Explorar o código

update-all.sh: add Claude CLI update, ctx7, graphifyy, marketplace plugins

- Step 0: update Claude Code CLI via npm before anything else
- Source lib/detect-plugins.sh to fix detect_ruflo crash
- Show cargo compilation logs instead of redirecting to /dev/null
- Add missing update steps for ctx7, graphifyy, marketplace plugins
- Aligns update-all.sh with everything install-plugins.sh installs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bastien hai 1 mes
pai
achega
4d5624387d
Modificáronse 1 ficheiros con 92 adicións e 5 borrados
  1. 92 5
      update-all.sh

+ 92 - 5
update-all.sh

@@ -14,10 +14,35 @@ info() { echo -e "${BLUE}→${NC} $1"; }
 REPO="$(cd "$(dirname "$0")" && pwd)"
 VERSION=$(cat "$REPO/version.txt" 2>/dev/null || echo "unknown")
 
+# Load shared detection library
+# shellcheck source=lib/detect-plugins.sh
+source "$REPO/lib/detect-plugins.sh"
+
 echo ""
 echo "═══ claude-config update (v${VERSION}) ═══"
 echo ""
 
+# ── 0. Update Claude Code CLI ──
+echo "── Updating Claude Code CLI..."
+if command -v claude &>/dev/null; then
+  CURRENT_VER=$(claude --version 2>/dev/null | head -1 || echo "unknown")
+  info "Current: $CURRENT_VER"
+  if npm install -g @anthropic-ai/claude-code@latest 2>/dev/null; then
+    NEW_VER=$(claude --version 2>/dev/null | head -1 || echo "unknown")
+    if [ "$CURRENT_VER" = "$NEW_VER" ]; then
+      ok "Claude Code already up to date ($NEW_VER)"
+    else
+      ok "Claude Code updated: $CURRENT_VER → $NEW_VER"
+    fi
+  else
+    warn "Claude Code update failed — try manually: npm install -g @anthropic-ai/claude-code@latest"
+  fi
+else
+  warn "Claude Code not found — install first with: make install"
+fi
+
+echo ""
+
 # ── 1. Pull latest config ──
 echo "── Pulling latest config..."
 cd "$REPO"
@@ -71,12 +96,14 @@ print(d.get('rtk',{}).get('version',''))
 
   if [ -n "$RTK_VERSION" ] && [ "$RTK_VERSION" != "latest" ]; then
     info "Pinned version: $RTK_VERSION"
-    cargo install --git https://github.com/rtk-ai/rtk --tag "$RTK_VERSION" --force 2>/dev/null \
+    info "Compiling from source — this may take a few minutes..."
+    cargo install --git https://github.com/rtk-ai/rtk --tag "$RTK_VERSION" --force \
       && ok "RTK updated to $RTK_VERSION" \
       || warn "RTK update failed"
   else
     info "No pinned version — installing latest"
-    cargo install --git https://github.com/rtk-ai/rtk --force 2>/dev/null \
+    info "Compiling from source — this may take a few minutes..."
+    cargo install --git https://github.com/rtk-ai/rtk --force \
       && ok "RTK updated (latest)" \
       || warn "RTK update failed"
   fi
@@ -116,7 +143,7 @@ fi
 # ── 5. Update Ruflo CLI (if installed) ──
 echo ""
 echo "── Updating Ruflo CLI..."
-if command -v ruflo &>/dev/null || detect_ruflo; then
+if command -v ruflo &>/dev/null || (type detect_ruflo &>/dev/null && detect_ruflo); then
   RUFLO_VER=""
   if [ -f "$REPO/plugins.lock.json" ] && command -v python3 &>/dev/null; then
     RUFLO_VER=$(python3 -c "
@@ -141,11 +168,71 @@ else
   info "Ruflo not installed — skipping"
 fi
 
-# ── 6. Refresh symlinks ──
+# ── 6. Update Context7 CLI ──
+echo ""
+echo "── Updating Context7 CLI..."
+if command -v ctx7 &>/dev/null; then
+  CTX7_VER=""
+  if [ -f "$REPO/plugins.lock.json" ] && command -v python3 &>/dev/null; then
+    CTX7_VER=$(python3 -c "
+import json
+with open('$REPO/plugins.lock.json') as f:
+    d = json.load(f)
+print(d.get('ctx7',{}).get('version',''))
+" 2>/dev/null || true)
+  fi
+
+  if [ -n "$CTX7_VER" ] && [ "$CTX7_VER" != "latest" ]; then
+    info "Pinned version: $CTX7_VER"
+    npm install -g "ctx7@${CTX7_VER}" 2>/dev/null \
+      && ok "ctx7 updated to $CTX7_VER" \
+      || warn "ctx7 update failed"
+  else
+    npm install -g ctx7@latest 2>/dev/null \
+      && ok "ctx7 updated (latest)" \
+      || warn "ctx7 update failed"
+  fi
+else
+  info "ctx7 not installed — skipping"
+fi
+
+# ── 7. Update Graphifyy ──
+echo ""
+echo "── Updating Graphifyy..."
+if command -v graphify &>/dev/null; then
+  pipx upgrade graphifyy 2>/dev/null \
+    && ok "graphifyy updated" \
+    || warn "graphifyy update failed — try: pipx upgrade graphifyy"
+else
+  info "graphifyy not installed — skipping"
+fi
+
+# ── 8. Update marketplace plugins ──
+echo ""
+echo "── Updating marketplace plugins..."
+if command -v claude &>/dev/null; then
+  _plugins=$(claude plugin list 2>/dev/null \
+    | grep -oP '(?<=❯ )\S+' || true)
+  if [ -n "$_plugins" ]; then
+    while IFS= read -r _p; do
+      _name="${_p%%@*}"
+      info "Updating $_name..."
+      claude plugin update "$_name" 2>/dev/null \
+        && ok "$_name updated" \
+        || warn "$_name update failed"
+    done <<< "$_plugins"
+  else
+    info "No marketplace plugins installed — skipping"
+  fi
+else
+  warn "Claude Code not found — skipping plugin update"
+fi
+
+# ── 9. Refresh symlinks ──
 echo ""
 echo "── Refreshing symlinks..."
 bash "$REPO/link.sh"
 
-# ── 7. Run doctor ──
+# ── 10. Run doctor ──
 echo ""
 bash "$REPO/doctor.sh"