feat: add call graph extraction and query support#11
Open
Conversation
Implement full-stack call graph feature: Rust-based extraction of function calls, method calls, constructors, and imports across 5 languages (TS/JS, Python, Go, Rust), with SQLite storage, NAPI bindings, indexer integration, OpenCode tool, and MCP server support. Rust layer: - Add call_extractor.rs with tree-sitter queries for 5 languages - Add Language::from_string() to types.rs - DB schema v2: symbols, call_edges, branch_symbols tables - Full CRUD + GC for symbols and call edges - 47 Rust tests pass, zero warnings TypeScript layer: - NAPI bindings for extractCalls + 16 Database methods - Indexer integration: extract calls during indexing, branch awareness - call_graph tool (callers/callees queries) - MCP server call_graph tool + health check updates - 352 tests pass, zero type errors
get_callees was returning edges from all branches while get_callers was branch-filtered. This asymmetry could return stale edges from other branches. Add branch parameter and INNER JOIN branch_symbols to get_callees, matching the get_callers pattern. Updated all callers through the full chain: Rust db → NAPI lib → TS wrapper → Indexer → tests.
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.
Summary
symbols,call_edges, andbranch_symbolstables with full CRUD, GC, and batch operationscall_graphOpenCode tool → MCP server toolWhat's New
Rust Layer (
native/)call_extractor.rs(~411 lines): Tree-sitter query-based call extraction for 5 languagestypescript-calls.scm,python-calls.scm,go-calls.scm,rust-calls.scmLanguage::from_string()added totypes.rssymbols,call_edges,branch_symbolstablesstreaming-iteratordependency addedTypeScript Layer (
src/)extractCallsfunction +CallSiteData,SymbolData,CallEdgeDatatypessrc/native/index.tsgetCallers()/getCallees()public APIcall_graphtool insrc/tools/index.tswith callers/callees direction supportcall_graphtool registration + health check GC fieldsformatHealthCheckupdated for new GC countersTests
tests/call-graph.test.ts: 15 comprehensive tests (extraction, storage, resolution, branch awareness, integration)tests/mcp-server.test.ts(9 tools) andtests/tools-utils.test.ts(new GC fields)Verification
cargo check— zero warningscargo test— 47 tests passnpm run build— TypeScript + Rust build successnpm run typecheck— zero type errorsnpm run test:run— 352 tests pass, 0 failuresnpm run lint— clean