mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
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:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user