forked from bchanot/claude
fix(install-plugins): auth-aware ctx7 guidance + drop obsolete MCP nudge
Step 6 printed its ctx7 hints unconditionally — telling already-authed users to log in, and pointing at `ctx7 setup --claude` (MCP-adjacent). Anonymous mode is fully functional (docs + library work without auth); auth only buys rate limits, so setup was never required for ctx7 to work. - Detect auth via an offline oracle: credentials.json presence (XDG-aware), no subprocess / network / browser — mirrors the idempotent-claude fix. - Authenticated -> "ctx7 authenticated"; anonymous -> non-blocking guidance (works anonymously; `ctx7 login`, `--no-browser` for headless). The installer guides, never launches login/setup. - Drop `ctx7 setup --claude`: leftover reopening MCP path, aligns w/ TODO:48 CLI-only decision. Verified: bash -n, shellcheck (no new findings), + simulated both auth states (credentials.json present/absent) — correct branch each, credentials restored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VeBXkDr74N9whdiJyjzyVN
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c816b11bc4
commit
9ee2e9407e
+12
-4
@@ -573,11 +573,19 @@ else
|
||||
err "ctx7 install failed — run manually: npm install -g ctx7"
|
||||
fi
|
||||
fi
|
||||
# Suggest setup for Claude Code integration (optional — ctx7 also works standalone)
|
||||
# ctx7 auth — detect + guide only (an installer must never open a browser / log you in)
|
||||
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"
|
||||
# Deterministic offline oracle: ctx7's OAuth token lives here (XDG-aware).
|
||||
# Present => authenticated; absent => anonymous. No subprocess, no network, no browser.
|
||||
ctx7_creds="${XDG_CONFIG_HOME:-$HOME/.config}/context7/credentials.json"
|
||||
if [ -f "$ctx7_creds" ]; then
|
||||
ok "ctx7 authenticated (full rate limits)"
|
||||
else
|
||||
info "ctx7 works anonymously — docs + library already usable, no auth required."
|
||||
info "For higher rate limits, authenticate: ctx7 login (opens a browser)"
|
||||
info " headless: ctx7 login --no-browser (prints a URL to open yourself)"
|
||||
fi
|
||||
info "Standalone usage: ctx7 docs /vercel/next.js \"middleware\""
|
||||
fi
|
||||
|
||||
# ============================================================
|
||||
|
||||
Reference in New Issue
Block a user