chore: remove unused codegraph exports (#5400)

Integrated into release/v3.8.42
This commit is contained in:
Jan Leon
2026-06-30 00:14:18 +02:00
committed by GitHub
parent 537b565da2
commit 7bd0bc8bca
2 changed files with 34 additions and 45 deletions

View File

@@ -31,27 +31,6 @@ export interface CodeGraphNode {
visibility?: string;
}
export interface CodeGraphEdge {
id: number;
source: string;
target: string;
kind: string;
line?: number;
metadata?: Record<string, unknown>;
}
export interface CodeGraphFile {
path: string;
language: string;
nodeCount: number;
modifiedAt: number;
}
export interface CodeGraphSearchResult {
nodes: CodeGraphNode[];
total: number;
}
// ---------------------------------------------------------------------------
// Database access (lazy loaded)
// ---------------------------------------------------------------------------
@@ -231,30 +210,6 @@ export function listFiles(language?: string, limit = 50): CodeGraphQueryResult {
return queryDb(`SELECT * FROM files ORDER BY path LIMIT ?`, [limit]);
}
/**
* Get impact analysis: find symbols that depend on a given symbol (transitively).
*/
export function getImpactAnalysis(symbolName: string, depth = 1): CodeGraphQueryResult {
if (depth <= 0)
return { success: false, data: null, error: "Depth must be >= 1", engine: "none" };
// Direct callers (depth 1)
const directCallers = findCallers(symbolName);
if (depth === 1) return directCallers;
// For depth > 1, we'd need recursive CTE or multiple queries.
// For now, just return direct callers with a note.
const result = directCallers;
return {
...result,
data: (result.data as Record<string, unknown>[])?.map((r) => ({
...r,
_depth: 1,
_note: `Depth > 1 requires multiple queries. Use searchSymbols() + findCallers() iteratively for deeper analysis.`,
})),
};
}
/**
* Check if CodeGraph DB is available.
*/

View File

@@ -0,0 +1,34 @@
import test from "node:test";
import assert from "node:assert/strict";
import {
findCallers,
getCodeGraphStats,
isCodeGraphAvailable,
searchSymbols,
} from "../../src/lib/copilot/codegraphKnowledge.ts";
test("CodeGraph knowledge helpers fail closed when the index is unavailable", () => {
assert.equal(isCodeGraphAvailable(), false);
assert.deepEqual(searchSymbols("handleChatCore"), {
success: false,
data: null,
error: "CodeGraph DB not found",
engine: "none",
});
assert.deepEqual(findCallers("handleChatCore"), {
success: false,
data: null,
error: "CodeGraph DB not found",
engine: "none",
});
assert.deepEqual(getCodeGraphStats(), {
success: false,
data: null,
error: "CodeGraph DB not found",
engine: "none",
});
});