Add evaluation framework and fix call graph extraction

- Add evaluation test suite with TypeScript and Python fixtures
- Fix MCP server to defer CodeGraph init until rootUri received
- Fix call edge extraction by calling resolveReferences() after indexAll/sync
- Fix glob matching for root-level files (e.g., **/*.py now matches auth.py)
- Fix duplicate node extraction for methods inside classes
- Update context tests to use buildContext for semantic search + graph traversal
- Export unused formatter functions to fix build

Evaluation results:
- TypeScript: 96% precision, 79% recall, 85% F1
- Python: 99% precision, 80% recall, 85% F1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-01-18 18:48:22 -06:00
co-authored by Claude Opus 4.5
parent e306114607
commit 6b672f9152
30 changed files with 2600 additions and 129 deletions
+4 -15
View File
@@ -679,25 +679,14 @@ hooksCommand
program
.command('serve')
.description('Start CodeGraph as an MCP server for AI assistants')
.option('-p, --path <path>', 'Project path')
.option('-p, --path <path>', 'Project path (optional for MCP mode, uses rootUri from client)')
.option('--mcp', 'Run as MCP server (stdio transport)')
.action(async (options: { path?: string; mcp?: boolean }) => {
const projectPath = resolveProjectPath(options.path);
const projectPath = options.path ? resolveProjectPath(options.path) : undefined;
try {
if (!CodeGraph.isInitialized(projectPath)) {
// In MCP mode, we can't use colored output easily
if (options.mcp) {
console.error(`CodeGraph not initialized in ${projectPath}. Run 'codegraph init' first.`);
} else {
error(`CodeGraph not initialized in ${projectPath}`);
info('Run "codegraph init" first');
}
process.exit(1);
}
if (options.mcp) {
// Start MCP server
// Start MCP server - it handles initialization lazily based on rootUri from client
const { MCPServer } = await import('../mcp/index');
const server = new MCPServer(projectPath);
await server.start();
@@ -712,7 +701,7 @@ program
"mcpServers": {
"codegraph": {
"command": "codegraph",
"args": ["serve", "--mcp", "--path", "${projectPath}"]
"args": ["serve", "--mcp"]
}
}
}