Code Intelligence backend: cycles, dead code, duplication, search (v0.2.1)#13
Merged
Conversation
….2.1) Sub-step 9a — backend only, no UI, no AI. Deterministic detectors in devpilot-core::intel: cyclic dependencies (Tarjan SCC over the dependency graph), dead code (functions with no detected callers that are not exported or main — heuristic), duplication (identical normalized line blocks), and code search (rank symbols/paths by query overlap; answers "where is X"). AnalyzeCodeIntelligence and SearchCode use cases parse the repo and build the architecture graphs. Tauri commands via DI: analyze_code_intelligence, search_code; typed lib/ipc/intel. "Explain this class" is served by AI Chat. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Sub-step 9a of Code Intelligence — backend only, no UI, no AI. Deterministic detectors over the AST and architecture graphs.
Maps the requested questions:
Find cyclic dependencies →
find_cycles(Tarjan SCC over the dependency graph; components ≥ 2 plus self-loops).Find dead code →
find_dead_code(functions with no incoming call-graph edges that are not exported ormain; heuristic — dynamic dispatch / trait methods can be false positives, documented).Find duplicated code →
find_duplication(identical 6-line normalized blocks across files).Where is authentication / database initialized →
search_code(ranks symbols and paths by query word overlap, with prefix matching so "authentication" findsauthenticate/auth.rs).Explain this class → served by the existing AI Chat (repository-aware).
Use cases:
AnalyzeCodeIntelligence(report) andSearchCode(query), both parse the repo and reusearchitecture::buildfor the graphs.Commands via DI:
analyze_code_intelligence,search_code; typedlib/ipc/intel.ts.Verification
cargo fmt --check,clippy -D warnings, fullcargo test --workspace: clean.AnalyzeCodeIntelligence+SearchCodeuse-case test over mocks.cargo build -p devpilot-desktopandpnpm build: clean.Next: 9b — Insights UI (cycles, dead code, duplication panels + a code search box).
🤖 Generated with Claude Code