-
-
Notifications
You must be signed in to change notification settings - Fork 4
fix: lazy engine loading, enriched errors, and switchProject tool #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🟡 Change Impact Analysis
Blast Radius: 0 modules, 1 files, 147 unique callers 📝 Changed Symbols (259)
🎯 Affected Downstream (20)
Recommendations
Generated by CKB |
🔐 Security Audit Results
📦 Dependency VulnerabilitiesFound 7 vulnerability(ies) across 2 scanner(s) DetailsTrivy (4 findings)
OSV-Scanner (3 findings)
📜 License IssuesFound 144 non-permissive license(s) Details
Generated by CKB Security Audit | View Details | Security Tab |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (11.2%) is below the target coverage (30.0%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #123 +/- ##
=========================================
- Coverage 45.1% 44.9% -0.2%
=========================================
Files 350 350
Lines 59773 60028 +255
=========================================
+ Hits 26978 27004 +26
- Misses 30970 31188 +218
- Partials 1825 1836 +11
Flags with carried forward coverage won't be shown. Click here to find out more. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
CKB Analysis
Risk factors: Moderate churn: 592 lines changed • Touches 6 hotspot(s)
🎯 Change Impact Analysis · 🟡 MEDIUM · 259 changed → 20 affected
Symbols changed in this PR:
Downstream symbols affected:
Recommendations:
💣 Blast radius · 0 symbols · 1 tests · 0 consumersTests that may break:
🔥 Hotspots · 6 volatile files
📦 Modules · 1 at risk
📊 Complexity · 5 violations
💡 Quick wins · 10 suggestions
📚 Stale docs · 143 broken references
Generated by CKB · Run details |
MCP server was taking 43+ seconds to respond to initialize handshake because it loaded the entire SCIP index synchronously before starting. Changes: - Add NewMCPServerLazy() that accepts an engine loader function - Engine is now loaded on first tool call, not during startup - MCP handshake completes in ~0.6s instead of 43s - Temporarily disable multi-repo mode to use lazy path everywhere Also improves `ckb setup` for Claude Code: - Detect if CKB is already configured correctly (no action needed) - Warn when configured path differs from current binary - Show note when switching between npx and local binary - Automatically update config instead of failing with "already exists" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
9781ed9 to
24c7f34
Compare
…ots support When an MCP client (e.g. Cursor) doesn't support roots/list, tool errors like SYMBOL_NOT_FOUND give no indication that the index might be for a different project. This adds repo path context to those errors so the AI agent can understand the mismatch. Also switches compound tools to GetEngine() to prevent nil panics with lazy loading. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
db8fa49 to
3d702d1
Compare
configureGrokGlobal and configureVSCodeGlobal now check for existing config before calling their respective CLIs, matching the pattern already used by configureClaudeCodeGlobal via claudeMcpAdd. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cursor (and other MCP clients without roots/list support) doesn't pass the workspace directory to MCP servers, so CKB falls back to the wrong project. The new switchProject tool lets AI agents self-correct by switching to the correct repo path at runtime. Changes: - Add switchProject() method and toolSwitchProject handler - Register tool in core preset (available in all presets) - Update enrichNotFoundError() to suggest switchProject instead of restart - Bump DefaultPageSize from 15 to 40 so all core tools appear on page 1 (Cursor doesn't request subsequent pages) - Update tests for new tool count (core: 20, full: 88) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
ckb setupUX for Claude Code, Grok, and VS Code configurationroots/listswitchProjecttool lets AI agents self-correct repo mismatches at runtimeProblem
The MCP server was loading the entire SCIP index synchronously before responding to the initialize handshake. For large codebases (e.g., 48MB index), this took 43+ seconds, causing Claude Code's health check to timeout and report "Failed to connect".
Additionally, when a client like Cursor doesn't support
roots/list, CKB can't auto-switch to the correct project. Tool errors likeSYMBOL_NOT_FOUNDgave no indication that the index might be for a different repo, causing AI agents to hallucinate explanations instead of understanding the mismatch. Even with enriched errors hinting at the mismatch, agents had no way to fix it — they could only tell the user to restart.Changes
switchProjectTool (internal/mcp/server.go,internal/mcp/tool_impls_compound.go,internal/mcp/tools.go)switchProject()method that accepts a filesystem path and switches the active engine.ckb/is initializedcreateEngineForRoot()switchRepo, does not require pre-registration — accepts any pathEnriched Error Hints (
internal/mcp/server.go)enrichNotFoundError()now suggestsswitchProjectinstead of "restart CKB"Pagination Fix (
internal/mcp/cursor.go)DefaultPageSizefrom 15 to 40getStatus,switchProject,expandToolset,analyzeImpact,getHotspotswere all missingLazy Engine Loading (
internal/mcp/server.go)NewMCPServerLazy()that accepts an engine loader functionRepo-Mismatch Detection (
internal/mcp/server.go,internal/mcp/tool_impls_compound.go)enrichNotFoundError()— when a not-found error occurs and the client didn't provide roots, append the indexed repo path to the error messages.engine()tos.GetEngine()to prevent nil panics with lazy loadingMCP Command (
cmd/ckb/mcp.go)Setup Command (
cmd/ckb/setup.go)getGrokMcpConfig()to read existing config; skip when already configuredgetVSCodeGlobalMcpConfig()to read existing config; skip when already configuredTest plan
go build ./cmd/ckb— compilesgo test ./internal/mcp/...— all tests pass (updated for 20 core / 88 full tools)tools/listreturns all 20 core tools on page 1switchProjectandgetStatusvisible in tool listswitchProjectinstead of "restart CKB"switchProjectfixes itckb setupdeduplication works for Claude Code, Grok, VS Code🤖 Generated with Claude Code