feat: add extractCallGraph to PluginRegistry, derive DEFAULT_PLUGIN_CONFIG from configs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lum1104
2026-04-15 18:20:31 +08:00
Unverified
parent ab011ff856
commit 9376375c8c
2 changed files with 12 additions and 2 deletions
@@ -1,3 +1,5 @@
import { builtinLanguageConfigs } from "../languages/configs/index.js";
export interface PluginEntry {
name: string;
enabled: boolean;
@@ -14,7 +16,9 @@ export const DEFAULT_PLUGIN_CONFIG: PluginConfig = {
{
name: "tree-sitter",
enabled: true,
languages: ["typescript", "javascript"],
languages: builtinLanguageConfigs
.filter((c) => c.treeSitter)
.map((c) => c.id),
},
],
};
@@ -1,4 +1,4 @@
import type { AnalyzerPlugin, StructuralAnalysis, ImportResolution } from "../types.js";
import type { AnalyzerPlugin, StructuralAnalysis, ImportResolution, CallGraphEntry } from "../types.js";
import { LanguageRegistry } from "../languages/language-registry.js";
/**
@@ -65,6 +65,12 @@ export class PluginRegistry {
return plugin.resolveImports(filePath, content);
}
extractCallGraph(filePath: string, content: string): CallGraphEntry[] | null {
const plugin = this.getPluginForFile(filePath);
if (!plugin?.extractCallGraph) return null;
return plugin.extractCallGraph(filePath, content);
}
getPlugins(): AnalyzerPlugin[] {
return [...this.plugins];
}