Skip to content

Code Intelligence backend: cycles, dead code, duplication, search (v0.2.1)#13

Merged
s1rry merged 1 commit into
mainfrom
feature/code-intelligence-backend
Jul 5, 2026
Merged

Code Intelligence backend: cycles, dead code, duplication, search (v0.2.1)#13
s1rry merged 1 commit into
mainfrom
feature/code-intelligence-backend

Conversation

@s1rry

@s1rry s1rry commented Jul 5, 2026

Copy link
Copy Markdown
Owner

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 dependenciesfind_cycles (Tarjan SCC over the dependency graph; components ≥ 2 plus self-loops).

  • Find dead codefind_dead_code (functions with no incoming call-graph edges that are not exported or main; heuristic — dynamic dispatch / trait methods can be false positives, documented).

  • Find duplicated codefind_duplication (identical 6-line normalized blocks across files).

  • Where is authentication / database initializedsearch_code (ranks symbols and paths by query word overlap, with prefix matching so "authentication" finds authenticate/auth.rs).

  • Explain this class → served by the existing AI Chat (repository-aware).

  • Use cases: AnalyzeCodeIntelligence (report) and SearchCode (query), both parse the repo and reuse architecture::build for the graphs.

  • Commands via DI: analyze_code_intelligence, search_code; typed lib/ipc/intel.ts.

Verification

  • cargo fmt --check, clippy -D warnings, full cargo test --workspace: clean.
    • Detector unit tests (2-node cycle vs acyclic, dead-code with exported/main exclusions, duplicated block, symbol search ranking) and a AnalyzeCodeIntelligence + SearchCode use-case test over mocks.
  • cargo build -p devpilot-desktop and pnpm build: clean.

Next: 9b — Insights UI (cycles, dead code, duplication panels + a code search box).

🤖 Generated with Claude Code

….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>
@s1rry s1rry merged commit 19a2243 into main Jul 5, 2026
4 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