From 9376375c8c9fdeca0a9af0f60cf0551d59946a1b Mon Sep 17 00:00:00 2001 From: Lum1104 Date: Wed, 15 Apr 2026 18:20:31 +0800 Subject: [PATCH] feat: add extractCallGraph to PluginRegistry, derive DEFAULT_PLUGIN_CONFIG from configs Co-Authored-By: Claude Opus 4.6 (1M context) --- .../packages/core/src/plugins/discovery.ts | 6 +++++- .../packages/core/src/plugins/registry.ts | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/understand-anything-plugin/packages/core/src/plugins/discovery.ts b/understand-anything-plugin/packages/core/src/plugins/discovery.ts index 11d9a1a..ead32eb 100644 --- a/understand-anything-plugin/packages/core/src/plugins/discovery.ts +++ b/understand-anything-plugin/packages/core/src/plugins/discovery.ts @@ -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), }, ], }; diff --git a/understand-anything-plugin/packages/core/src/plugins/registry.ts b/understand-anything-plugin/packages/core/src/plugins/registry.ts index 67261f5..91ba343 100644 --- a/understand-anything-plugin/packages/core/src/plugins/registry.ts +++ b/understand-anything-plugin/packages/core/src/plugins/registry.ts @@ -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]; }