AnalyzerPlugin interface defines the contract that all language analysis plugins must satisfy. Plugins are registered with the PluginRegistry and are responsible for parsing source files, resolving imports, and optionally extracting call graphs.
AnalyzerPlugin interface
Unique identifier for this plugin (e.g.
"tree-sitter", "python-ast").List of language identifiers this plugin handles (e.g.
["typescript", "javascript"]). These are matched by the registry’s language map.Parses
content as the given filePath and returns a StructuralAnalysis.Parses import statements in
content and resolves relative paths to absolute paths. Returns an array of ImportResolution.Optional. Extracts caller→callee relationships from the file. Returns an array of
CallGraphEntry.StructuralAnalysis
The return type ofanalyzeFile. Contains all structurally interesting declarations found in a source file.
All function and arrow-function declarations found at the top level or exported.
All class declarations found in the file.
All import statements in the file.
All exported names in the file.
ImportResolution
Represents a resolved import statement, returned byresolveImports.
The module specifier as written in the source file (e.g.
"./utils", "react").Absolute filesystem path for relative imports, or the original specifier unchanged for package imports (e.g.
"/home/user/project/src/utils", "react").The imported names, identical to
StructuralAnalysis.imports[].specifiers.CallGraphEntry
A single caller→callee relationship, returned by the optionalextractCallGraph method.
Name of the function that contains the call site.
Name (or expression text) of the function being called.
Line number of the call expression (1-indexed).
Implementing a custom plugin
To add support for a new language, implementAnalyzerPlugin and register it with the PluginRegistry.
"python" language identifier to this plugin. Any file with a .py extension will automatically be routed to it via getPluginForFile.