Skip to content

Conversation

@SimplyLiz
Copy link
Owner

Summary

Release CKB v8.1.0 with refactoring intelligence features.

New Tools

  • findCycles — Dependency cycle detection using Tarjan's SCC algorithm (module/directory/file granularity)
  • suggestRefactorings — Proactive refactoring suggestions (complexity, coupling, dead code, extract candidates)
  • prepareChange (move) — Move/relocate analysis with import tracking and conflict detection
  • prepareChange (extract) — Tree-sitter flow analysis for extract variable/function with parameter and return detection
  • planRefactor — Unified refactoring planner combining risk, impact, test gaps, and ordered steps

Improvements

  • Lazy engine loading and enriched error messages
  • switchProject tool for multi-repo workflows
  • Coverage configuration via .ckb/config.json
  • Orphaned index detection in ckb doctor
  • Test mapping via ckb affected-tests

Bug Fixes

  • Go 1.24.12 security update
  • Doctor command error messages
  • Patch coverage check disabled on main/develop

Stats

  • 37 files changed, +5,806 lines
  • 102 new tests (51 unit + 23 integration + 28 extract flow)
  • All CI checks passing

Test plan

  • Full test suite passes with -race (57 packages, 0 failures)
  • go vet ./... clean
  • golangci-lint clean
  • Manual MCP testing of all new tools
  • Existing tools verified — no regressions

🤖 Generated with Claude Code

SimplyLiz and others added 15 commits January 27, 2026 13:42
Patch coverage should only run on PRs, not on direct pushes to
main or develop. This was causing false failures on release merges.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- SCIP "not found" message now shows which indexer to use (e.g., "uses scip-go")
- Add 'ckb index' as primary suggested fix for missing SCIP index
- Filter LSP checks to only show servers relevant to detected project languages
- Map JavaScript projects to typescript LSP server (they share typescript-language-server)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Addresses GO-2026-4339 (net/url) and GO-2026-4340 (crypto/tls)
standard library vulnerabilities.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fix: improve doctor command error messages
* fix: lazy engine loading for fast MCP startup

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>

* fix: enrich not-found errors with repo context for clients without roots 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>

* fix: prevent redundant entries in Grok and VS Code global setup

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>

* feat: add switchProject tool for dynamic repo switching

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>

* fix: resolve govet shadow warnings in switchProject

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Five features based on Cursor agent feedback from live refactoring trial:

1. Function-level complexity in auditRisk — wire tree-sitter complexity
   analyzer into audit, returning per-function cyclomatic+cognitive scores
   sorted by complexity (top 10 per file). Falls back to heuristic.

2. Graceful degradation messaging — new DegradationWarning type with
   capability percentages and fix commands. Wired into explore, understand,
   prepareChange, auditRisk, and findDeadCode MCP handlers.

3. Test gap analysis — new testgap package + analyzeTestGaps MCP tool.
   Cross-references complexity analysis with SCIP references or heuristic
   name matching to identify untested functions, sorted by risk.

4. Richer prepareChange for rename/extract — RenameDetail (call sites,
   type refs, imports with context snippets) and ExtractDetail (boundary
   analysis) added as parallel goroutines in PrepareChange.

5. Unified planRefactor compound tool — aggregates prepareChange + auditRisk
   + analyzeTestGaps in parallel, generates ordered refactoring steps by
   change type (rename/extract/delete/modify).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Four new features extending the refactoring toolset:

1. Dependency cycle detection (findCycles) - Tarjan's SCC algorithm to
   detect circular dependencies at module/directory/file granularity,
   with break-cost analysis suggesting which edge to remove.

2. Move/relocate change type - adds "move" to prepareChange and
   planRefactor, scanning for affected imports (SCIP-precise or
   heuristic fallback) and target path conflicts.

3. Extract variable flow analysis - tree-sitter-based parameter/return
   detection for extract refactorings, with CGO/non-CGO build tags
   for graceful degradation.

4. Suggested refactoring detection (suggestRefactorings) - proactive
   detection combining complexity, coupling, dead code, and audit
   analyzers in parallel to surface prioritized opportunities.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- cycles/detector_test.go: Tarjan SCC algorithm, break cost, severity
- query/cycles_test.go: graph extraction, cycle summary
- query/prepare_move_test.go: target conflicts, heuristic import scanning
- query/prepare_extract_test.go: signature generation, language inference
- suggest/analyzer_test.go: severity helpers, dedup, file listing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add CHANGELOG entries for cycle detection, move/relocate, extract flow
analysis, and suggested refactoring detection. Add 23 MCP integration
tests for all batch 2 features.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cover the previously untested extract/analyzer.go with CGO-tagged tests:
- Full Analyze() pipeline for Go, JavaScript, and Python source
- classifyVariables() logic: parameter/return/local classification,
  modified tracking, empty input, unused-in-region exclusion
- AST walking: findContainingFunction, collectDeclarations,
  collectReferences, keyword filtering
- Helper functions: isKeyword, langToExtension, node type helpers

Documents known limitation: Go assignment_statement wraps LHS in
expression_list, so `x = expr` doesn't trigger isModified detection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- extract/analyzer.go: return parse error instead of nil (nilerr),
  remove unused strings import and lines variable
- suggest/analyzer.go: propagate filepath.Walk errors instead of
  swallowing them (nilerr)
- prepare_move_test.go: use context.TODO() instead of nil context
  (staticcheck SA1012)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The extract flow analyzer always operated on the entire file because
startLine/endLine were never passed from MCP through to the analyzer.
This made parameter/return detection useless since all variables are
both defined and used within the same (whole-file) range.

Adds startLine/endLine to prepareChange MCP tool definition, parses
them in the handler, and threads them through PrepareChangeOptions
and PlanRefactorOptions to getPrepareExtractDetail.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

NFR Tests ✅ 39 unchanged

Comparing PR against main branch (dynamic baseline).

Regressions: 0 ✅

Thresholds: WARN ≥ +5% • FAIL ≥ +10%

All scenarios
Scenario Change Actual (B) Base (B) Time
analyzeChange / large +0.0% 193,169 193,169 898µs
analyzeChange / medium +0.0% 38,575 38,575 169µs
analyzeChange / small +0.0% 4,046 4,046 51µs
analyzeChange / xlarge +0.0% 387,417 387,417 1.589172ms
analyzeImpact / large +0.0% 17,966 17,966 114µs
analyzeImpact / small +0.0% 1,924 1,924 19µs
batchGet / large +0.0% 11,789 11,789 72µs
batchGet / small +0.0% 4,733 4,733 58µs
batchSearch / large +0.0% 90,816 90,816 254µs
batchSearch / medium +0.0% 18,036 18,036 81µs
batchSearch / small +0.0% 3,379 3,379 30µs
explore / large +0.0% 94,262 94,262 644µs
explore / small +0.0% 4,253 4,253 65µs
findReferences / large +0.0% 445,943 445,943 1.873863ms
findReferences / medium +0.0% 44,123 44,123 276µs
findReferences / small +0.0% 4,395 4,395 55µs
getAffectedTests / large +0.0% 7,521 7,521 75µs
getAffectedTests / medium +0.0% 3,110 3,110 37µs
getAffectedTests / small +0.0% 903 903 18µs
getAffectedTests / xlarge +0.0% 14,870 14,870 151µs
getArchitecture / large +0.0% 6,690 6,690 65µs
getArchitecture / small +0.0% 960 960 20µs
getCallGraph / deep +0.0% 15,238 15,238 116µs
getCallGraph / shallow +0.0% 887 887 15µs
getHotspots / large +0.0% 16,748 16,748 216µs
getHotspots / small +0.0% 886 886 16µs
listEntrypoints / large +0.0% 23,798 23,798 164µs
listEntrypoints / small +0.0% 4,795 4,795 309µs
prepareChange / large +0.0% 16,194 16,194 128µs
prepareChange / small +0.0% 2,483 2,483 36µs
searchSymbols / large +0.0% 90,246 90,246 735µs
searchSymbols / medium +0.0% 17,766 17,766 153µs
searchSymbols / small +0.0% 3,588 3,588 70µs
summarizeDiff / large +0.0% 19,939 19,939 176µs
summarizeDiff / small +0.0% 2,133 2,133 30µs
traceUsage / large +0.0% 7,728 7,728 72µs
traceUsage / small +0.0% 725 725 12µs
understand / large +0.0% 460,608 460,608 2.920255ms
understand / small +0.0% 5,555 5,555 53µs

* = new scenario, compared against static baseline

@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

❌ Patch coverage is 53.27491% with 1013 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/ckb/setup.go 0.0% 161 Missing ⚠️
internal/suggest/analyzer.go 53.6% 142 Missing and 12 partials ⚠️
internal/testgap/analyzer.go 12.3% 140 Missing and 2 partials ⚠️
internal/query/compound_refactor.go 37.1% 105 Missing and 15 partials ⚠️
internal/query/prepare_rename.go 0.0% 70 Missing ⚠️
internal/mcp/server.go 8.1% 64 Missing and 4 partials ⚠️
internal/mcp/tool_impls_compound.go 46.3% 41 Missing and 10 partials ⚠️
internal/query/prepare_move.go 63.1% 32 Missing and 6 partials ⚠️
internal/audit/analyzer.go 21.0% 30 Missing ⚠️
internal/query/compound.go 25.0% 24 Missing and 3 partials ⚠️
... and 13 more
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #129     +/-   ##
=======================================
+ Coverage   45.1%   45.5%   +0.4%     
=======================================
  Files        350     365     +15     
  Lines      59747   61829   +2082     
=======================================
+ Hits       26961   28169   +1208     
- Misses     30960   31758    +798     
- Partials    1826    1902     +76     
Flag Coverage Δ
unit 45.5% <53.2%> (+0.4%) ⬆️

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

🔐 Security Audit Results

⚠️ Security gate passed with warnings - 7 issue(s) found (review recommended)

Category Findings
🔑 Secrets ✅ 0
🛡️ SAST ✅ 0
📦 Dependencies ⚠️ 7
📜 Licenses ⚠️ 25 non-permissive

📦 Dependency Vulnerabilities

Found 7 vulnerability(ies) across 2 scanner(s)

Details

Trivy (4 findings)

  • CVE-2026-22036 (MEDIUM): undici - undici: Undici: Denial of Service via excessive de...
  • CVE-2025-54410 (LOW): github.com/docker/docker - github.com/moby/moby: Moby's Firewalld reload remo...
  • GHSA-vrw8-fxc6-2r93 (MEDIUM): github.com/go-chi/chi/v5 - chi Allows Host Header Injection which Leads to Op...
  • CVE-2025-47908 (MEDIUM): github.com/rs/cors - github.com/rs/cors: Denial of service via maliciou...

OSV-Scanner (3 findings)

  • github.com/docker/docker: 2 vulnerabilities
  • github.com/go-chi/chi/v5: 1 vulnerabilities
  • github.com/rs/cors: 2 vulnerabilities

📜 License Issues

Found 25 non-permissive license(s)

Details
  • @actions/core: MIT (notice)
  • @actions/exec: MIT (notice)
  • @actions/github: MIT (notice)
  • @actions/http-client: MIT (notice)
  • @actions/io: MIT (notice)
  • @fastify/busboy: MIT (notice)
  • @octokit/auth-token: MIT (notice)
  • @octokit/core: MIT (notice)
  • @octokit/endpoint: MIT (notice)
  • @octokit/graphql: MIT (notice)
  • ... and 15 more

Generated by CKB Security Audit | View Details | Security Tab

@github-actions
Copy link

🟡 Change Impact Analysis

Metric Value
Risk Level MEDIUM 🟡
Files Changed 46
Symbols Changed 884
Directly Affected 1
Transitively Affected 404

Blast Radius: 0 modules, 1 files, 405 unique callers

📝 Changed Symbols (884)
Symbol File Type Confidence
AnalyzeOptions internal/query/testgap.go added 100%
AnalyzeOptions internal/query/suggest.go added 100%
AnalyzeOptions internal/extract/analyzer.go added 100%
AnalyzeOptions#EndLine internal/extract/analyzer.go added 100%
AnalyzeOptions#Language internal/extract/analyzer.go added 100%
AnalyzeOptions#Limit internal/query/testgap.go added 100%
AnalyzeOptions#Limit internal/query/suggest.go added 100%
AnalyzeOptions#MinLines internal/query/testgap.go added 100%
AnalyzeOptions#MinSeverity internal/query/suggest.go added 100%
AnalyzeOptions#Scope internal/query/suggest.go added 100%
AnalyzeOptions#Source internal/extract/analyzer.go added 100%
AnalyzeOptions#StartLine internal/extract/analyzer.go added 100%
AnalyzeOptions#Target internal/query/testgap.go added 100%
AnalyzeOptions#Types internal/query/suggest.go added 100%
AnalyzeTestGapsOptions internal/mcp/tool_impls_testgap.go added 100%
+869 more
🎯 Affected Downstream (20)
Symbol Module Distance Kind
unknown `` 1 type-dependency
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_EmptySource(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_Go_AllLocals(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_Go_BasicFlow(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_Go_ParameterAndReturnDetection(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_JavaScript_BasicFlow(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_NoContainingFunction(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_Python_BasicFlow(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#RegisterTools(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#toolAnalyzeTestGaps(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#toolPlanRefactor(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#toolSuggestRefactorings(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/query/Engine#AnalyzeTestGaps(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/query/Engine#PlanRefactor(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/query/Engine#PrepareChange(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/query/Engine#SuggestRefactorings(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/query/TestGetPrepareExtractDetail_EmptyPath(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/query/TestGetPrepareExtractDetail_NilTarget(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/query/TestGetPrepareExtractDetail_NonexistentFile(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/query/TestGetPrepareExtractDetail_WithFile(). `` 2 transitive-caller

Recommendations

  • ⚠️ test: Significant transitive impact (404 symbols). Run comprehensive test suite.
    • Action: Run full test suite before merging

⚠️ Index is 0 commit(s) behind HEAD. Results may be incomplete.


Generated by CKB

@github-actions
Copy link

CKB Analysis

Risk Files +6425 -144 Modules

🎯 884 changed → 404 affected · 🔥 18 hotspots · 📊 11 complex · 💣 10 blast · 📚 143 stale

Risk factors: Large PR with 46 files • High churn: 6569 lines changed • Touches 18 hotspot(s)

Metric Value
Impact Analysis 884 symbols → 404 affected 🟡
Doc Coverage 9.090909090909092% ⚠️
Complexity 11 violations ⚠️
Coupling 0 gaps
Blast Radius 0 modules, 1 files
Index indexed (7s) 💾
🎯 Change Impact Analysis · 🟡 MEDIUM · 884 changed → 20 affected
Metric Value
Symbols Changed 884
Directly Affected 1
Transitively Affected 404
Modules in Blast Radius 0
Files in Blast Radius 1

Symbols changed in this PR:

Downstream symbols affected:
Direct callers (1):

  • unknown
    Transitive callers (19):
  • scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_EmptySource(). (depth 2)
  • scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_Go_AllLocals(). (depth 2)
  • scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_Go_BasicFlow(). (depth 2)
  • scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_Go_ParameterAndReturnDetection(). (depth 2)
  • scip-go gomod github.com/SimplyLiz/CodeMCP 86a04a35253c github.com/SimplyLiz/CodeMCP/internal/extract/TestAnalyze_JavaScript_BasicFlow(). (depth 2)
  • … and 14 more transitive callers

Recommendations:

  • ⚠️ Significant transitive impact (404 symbols). Run comprehensive test suite.
    • Action: Run full test suite before merging

⚠️ Index is undefined commit(s) behind HEAD. Results may be incomplete. Run ckb index to refresh.

💣 Blast radius · 0 symbols · 10 tests · 0 consumers

Tests that may break:

  • internal/audit/audit_test.go
  • internal/cycles/detector_test.go
  • internal/extract/analyzer_test.go
  • internal/mcp/presets_test.go
  • internal/mcp/token_budget_test.go
  • … and 5 more
🔥 Hotspots · 18 volatile files
File Churn Score
CHANGELOG.md 10.17
cmd/ckb/mcp.go 7.62
cmd/ckb/setup.go 9.67
go.mod 7.05
internal/audit/analyzer.go 6.44
internal/cycles/detector.go 5.57
internal/extract/analyzer.go 7.89
internal/mcp/presets.go 6.50
📦 Modules · 2 at risk
Module Files
🔴 internal/mcp 13
🔴 internal/query 13
📊 Complexity · 11 violations
File Cyclomatic Cognitive
cmd/ckb/mcp.go ⚠️ 28 ⚠️ 65
cmd/ckb/setup.go ⚠️ 27 ⚠️ 52
internal/audit/analyzer.go ⚠️ 19 ⚠️ 49
internal/cycles/detector.go ⚠️ 19 ⚠️ 45
internal/cycles/detector_test.go 14 ⚠️ 22
internal/extract/analyzer.go ⚠️ 21 ⚠️ 45
internal/mcp/presets_test.go ⚠️ 21 ⚠️ 35
internal/mcp/server.go 12 ⚠️ 22
💡 Quick wins · 10 suggestions
📚 Stale docs · 143 broken references

Generated by CKB · Run details

@SimplyLiz SimplyLiz merged commit a75ae1b into main Feb 1, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant