mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
chore: remove unused codegraph exports (#5400)
Integrated into release/v3.8.42
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
34
tests/unit/copilot-codegraph-knowledge.test.ts
Normal file
34
tests/unit/copilot-codegraph-knowledge.test.ts
Normal 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",
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user