From a8c416fdc131a58b801fea8778848f6bc42c9783 Mon Sep 17 00:00:00 2001 From: bchanot Date: Thu, 9 Apr 2026 14:31:24 +0200 Subject: [PATCH] changed context7 to cli --- README.md | 12 +++++++----- agents/plugin-advisor.md | 12 ++++++++---- doctor.sh | 4 ++-- install-plugins.sh | 34 +++++++++++++++++++++------------- lib/detect-plugins.sh | 13 ++----------- plugins.lock.json | 5 +++++ 6 files changed, 45 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 731fded..f2c222d 100644 --- a/README.md +++ b/README.md @@ -80,8 +80,10 @@ bash link.sh # 3. Install prerequisites + all plugins (detects OS, reads pinned versions from plugins.lock.json) bash install-plugins.sh -# 4. Add Context7 API key (free at upstash.com) — manual step -claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_KEY +# 4. Context7 CLI (optional — for fast-evolving libs like Next.js, React, Prisma) +npm install -g ctx7 +ctx7 setup --claude # configures MCP + rules for Claude Code (OAuth login) +# Or use standalone: ctx7 docs /vercel/next.js "middleware" # 5. Verify setup bash doctor.sh @@ -224,7 +226,7 @@ gsd # then inside the session: | Command | Plugin | Description | |---|---|---| | `/pr-review-toolkit:review-pr` | pr-review-toolkit | Multi-agent PR review (6 specialized agents) | -| `/context7:docs ` | context7 | Manual doc lookup for a specific library | +| `/context7:docs ` | context7 | Manual doc lookup for a specific library (via ctx7 CLI) | --- @@ -375,7 +377,7 @@ Warns if ruflo is active with no multi-agent signal, or if GSD v2 CLI is not ins | gsd v2 ↔ ruflo | ⚠️ Overlap | Sequential (GSD) vs parallel swarm (ruflo). Pick based on need. | | superpowers ↔ gsd v2 | ✅ Complementary | Single-session engine + multi-session CLI = no conflict | | superpowers ↔ gstack | ✅ Complementary | Used together by orchestrators | -| context7 ↔ any | ✅ Independent | Doc lookup MCP — always safe to combine | +| context7 ↔ any | ✅ Independent | Doc lookup CLI (ctx7) — always safe to combine | ### Recommended sets by project type @@ -420,7 +422,7 @@ Run `/plugin-check` anytime to get a recommendation for the current project type | **pr-review-toolkit** | 🔄 TOGGLE | ~300 tokens | PR review sessions | claude-code-plugins | | **frontend-design** | 🔄 TOGGLE | ~200 tokens | Any project with a UI | claude-code-plugins | | **ui-ux-pro-max** | 🔄 TOGGLE | ~400 tokens | Design system, color/typography choices | ui-ux-pro-max-skill | -| **Context7 MCP** | 🔄 TOGGLE | ~200 tokens | Fast-evolving libs (Next.js, React, Prisma…) | MCP manual | +| **Context7 CLI** | 🔄 TOGGLE | ~200 tokens | Fast-evolving libs (Next.js, React, Prisma…) | npm (ctx7) + optional ctx7 setup --claude | **Rule:** toggle plugins are OFF by default. `/plugin-check` signals when to enable them. If you use `/init-project` or `/ship-feature`, plugin-check runs automatically as STEP 0 diff --git a/agents/plugin-advisor.md b/agents/plugin-advisor.md index a35c112..241eae4 100644 --- a/agents/plugin-advisor.md +++ b/agents/plugin-advisor.md @@ -22,7 +22,10 @@ claude plugin list 2>/dev/null || echo "plugin-list-unavailable" ls $HOME/.claude/skills/gstack/skills/ 2>/dev/null | wc -l || echo "0" # MCP servers -claude mcp list 2>/dev/null | grep -E "context7|ruflo" || echo "no-mcp" +claude mcp list 2>/dev/null | grep -E "ruflo" || echo "no-mcp" + +# Context7 CLI +command -v ctx7 &>/dev/null && ctx7 --version 2>/dev/null | head -1 || echo "ctx7-not-installed" # Standalone CLIs command -v gsd &>/dev/null && gsd --version 2>/dev/null | head -1 || echo "gsd-not-installed" @@ -130,7 +133,7 @@ ACTION REQUIRED? YES / NO | superpowers ↔ gsd v2 | ✅ Complementary | Superpowers = single-session execution. GSD v2 = multi-session CLI orchestration. No conflict. | | superpowers ↔ gstack | ✅ Complementary | Used together in /init-project and /ship-feature. Superpowers = engine, GStack = full-product skills. | | superpowers ↔ ruflo | ⚠️ Overlap | Both can orchestrate agent sub-tasks. Together only for advanced hybrid setups. | -| context7 ↔ any | ✅ Independent | Doc lookup MCP, no workflow overlap. Always safe to combine. | +| context7 ↔ any | ✅ Independent | Doc lookup CLI (ctx7), no workflow overlap. Always safe to combine. | | plugin-dev ↔ superpowers | ⚠️ Minor overlap | Superpowers can create skills too. Keep plugin-dev only when actively building new plugins/skills. | | frontend-design ↔ gstack | ✅ Complementary | GStack = deploy/QA layer; frontend-design = UI quality layer. Different concerns. | | pr-review-toolkit ↔ superpowers | ✅ Complementary | superpowers:requesting-code-review and /pr-review-toolkit:review-pr cover different review styles. | @@ -243,8 +246,9 @@ RULE: IF `complex-arch` signal (multiple services, event bus, distributed system - Total passive cost > 5500t (~50% of Pro session budget) - **Next.js/React 18+/Prisma/Supabase detected + context7 not configured** → Risk: Claude may generate code using outdated APIs (App Router changes frequently) - → Fix: `claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key KEY` - → Free key: https://upstash.com + → Fix: `npm install -g ctx7 && ctx7 setup --claude` + → Or standalone: `ctx7 docs /vercel/next.js "middleware"` + → Free higher rate limits: `ctx7 login` (OAuth) or API key from context7.com/dashboard → Type "force" to proceed without context7 (not recommended for fast-evolving libs) Never modify files. If action required → stop and wait. If not → say "proceed". diff --git a/doctor.sh b/doctor.sh index 3d98f9b..ae31622 100644 --- a/doctor.sh +++ b/doctor.sh @@ -163,9 +163,9 @@ else fi if detect_context7; then - pass "Context7 MCP configured" + pass "Context7 CLI (ctx7) installed" else - info "Context7 MCP not configured (optional — needed for fast-evolving libs)" + info "Context7 CLI not installed (optional — needed for fast-evolving libs: npm install -g ctx7)" fi if detect_gsd; then diff --git a/install-plugins.sh b/install-plugins.sh index 9d9226b..cec250e 100644 --- a/install-plugins.sh +++ b/install-plugins.sh @@ -348,21 +348,29 @@ install_plugin "ui-ux-pro-max" "ui-ux-pro-max-skill" echo "" # ============================================================ -# STEP 6 — CONTEXT7 MCP (manual — requires API key) +# STEP 6 — CONTEXT7 CLI (ctx7) # ============================================================ -echo "── Step 7: Context7 MCP ─────────────────────────────────────" +echo "── Step 7: Context7 CLI ─────────────────────────────────────" echo "" -if claude mcp list 2>/dev/null | grep -q "context7"; then - ok "Context7 MCP already configured" +if command -v ctx7 &>/dev/null; then + ok "ctx7 already installed ($(ctx7 --version 2>/dev/null | head -1 || echo 'installed'))" else - warn "Context7 requires a free API key — cannot auto-install" - echo "" - echo " Steps:" - echo " 1. Get a free key at https://upstash.com" - echo " 2. Run:" - echo " claude mcp add --scope user context7 -- \\" - echo " npx -y @upstash/context7-mcp --api-key YOUR_KEY" - echo "" + CTX7_VER=$(pinned_version "ctx7") + if [ "$CTX7_VER" != "latest" ]; then + info "Installing ctx7@${CTX7_VER} (pinned in plugins.lock.json)..." + npm install -g "ctx7@${CTX7_VER}" + else + info "Installing ctx7@latest (consider pinning in plugins.lock.json)..." + npm install -g ctx7 + fi + command -v ctx7 &>/dev/null && ok "ctx7 installed ($(ctx7 --version 2>/dev/null | head -1))" \ + || err "ctx7 install failed — run manually: npm install -g ctx7" +fi +# Suggest setup for Claude Code integration (optional — ctx7 also works standalone) +if command -v ctx7 &>/dev/null; then + info "Run 'ctx7 setup --claude' to configure Context7 for Claude Code" + info "Or use ctx7 standalone: ctx7 docs /vercel/next.js \"middleware\"" + info "Free higher rate limits: ctx7 login (OAuth) or --api-key from context7.com/dashboard" fi # ============================================================ @@ -385,7 +393,7 @@ echo " 🔄 plugin-dev — create plugins/skills (~100 tokens) [clau echo " 🔄 pr-review-toolkit — /pr-review-toolkit:review-pr (~300 tokens) [claude-code-plugins]" echo " 🔄 frontend-design — UI design skill (~200 tokens) [claude-code-plugins]" echo " 🔄 ui-ux-pro-max — user scope (~400 tokens)" -echo " 🔄 context7 MCP — see Step 7 above (~200 tokens)" +echo " 🔄 context7 CLI — ctx7 (npm global, standalone or MCP setup)" echo " 🔄 ruflo MCP — see Step 5 above (~500-1500 tokens, enterprise only)" echo "" echo " All plugins installed at: user scope (~/.claude/plugins/)" diff --git a/lib/detect-plugins.sh b/lib/detect-plugins.sh index 2a7d515..5befc4c 100644 --- a/lib/detect-plugins.sh +++ b/lib/detect-plugins.sh @@ -59,17 +59,8 @@ detect_uiux_pro_max() { } detect_context7() { - # Fast check: read ~/.claude.json (MCP config) without spawning the claude CLI - local cfg="$HOME/.claude.json" - if [ -f "$cfg" ]; then - grep -q "context7" "$cfg" 2>/dev/null && return 0 - fi - # Fallback: ~/.mcp.json (project-scoped MCP config at user level) - local mcp="$HOME/.mcp.json" - if [ -f "$mcp" ]; then - grep -q "context7" "$mcp" 2>/dev/null && return 0 - fi - return 1 + # Context7 CLI (ctx7) — installed globally via npm + command -v ctx7 &>/dev/null } detect_ruflo() { diff --git a/plugins.lock.json b/plugins.lock.json index 4f7f24c..14db956 100644 --- a/plugins.lock.json +++ b/plugins.lock.json @@ -19,5 +19,10 @@ "source": "npm:ruflo", "version": "3.5.58", "note": "Enterprise multi-agent MCP server (formerly claude-flow). Requires manual MCP config after install. Check latest at https://www.npmjs.com/package/ruflo before updating." + }, + "ctx7": { + "source": "npm:ctx7", + "version": "latest", + "note": "Context7 CLI \u2014 doc lookup for fast-evolving libs. Install: npm install -g ctx7. Setup for Claude Code: ctx7 setup --claude. Standalone: ctx7 docs /vercel/next.js \"middleware\"." } }