Documentation
¶
Overview ¶
Package plugins provides a plugin system for monox.
Index ¶
- Variables
- func GetForProject(project *api.Project) (api.LanguagePlugin, bool)
- func List() []api.LanguagePlugin
- func Register(plugin api.LanguagePlugin)
- type AnalysisResult
- type AnalyzerPlugin
- type ExecPlugin
- func (p *ExecPlugin) Call(ctx context.Context, method string, args map[string]any) (map[string]any, error)
- func (p *ExecPlugin) Initialize(config map[string]any) error
- func (p *ExecPlugin) Name() string
- func (p *ExecPlugin) Shutdown() error
- func (p *ExecPlugin) Type() PluginType
- func (p *ExecPlugin) Version() string
- type ExecutorPlugin
- type GeneratorPlugin
- type GeneratorSpec
- type HookPlugin
- type Issue
- type LanguagePluginRegistry
- type Loader
- type Plugin
- type PluginManifest
- type PluginType
- type Registry
- func (r *Registry) Analyzers() []AnalyzerPlugin
- func (r *Registry) Executors() []ExecutorPlugin
- func (r *Registry) Generators() []GeneratorPlugin
- func (r *Registry) Get(name string) (Plugin, bool)
- func (r *Registry) Hooks() []HookPlugin
- func (r *Registry) Initialize(globalConfig map[string]any) error
- func (r *Registry) Load(path string) error
- func (r *Registry) LoadFromDirectory(dir string) error
- func (r *Registry) Shutdown() error
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = defaultLanguageRegistry
DefaultRegistry returns the default language plugin registry.
Functions ¶
func GetForProject ¶
func GetForProject(project *api.Project) (api.LanguagePlugin, bool)
GetForProject returns the appropriate language plugin for a project.
Types ¶
type AnalysisResult ¶
type AnalysisResult struct {
Issues []Issue `json:"issues"`
Metrics map[string]any `json:"metrics"`
}
AnalysisResult holds analysis results.
type AnalyzerPlugin ¶
type AnalyzerPlugin interface {
Plugin
Analyze(ctx context.Context, project *api.ProjectConfig) (*AnalysisResult, error)
}
AnalyzerPlugin analyzes code.
type ExecPlugin ¶
type ExecPlugin struct {
// contains filtered or unexported fields
}
ExecPlugin wraps an external executable as a plugin.
func (*ExecPlugin) Call ¶
func (p *ExecPlugin) Call(ctx context.Context, method string, args map[string]any) (map[string]any, error)
Call invokes the plugin with the given method and args.
func (*ExecPlugin) Initialize ¶
func (p *ExecPlugin) Initialize(config map[string]any) error
func (*ExecPlugin) Name ¶
func (p *ExecPlugin) Name() string
func (*ExecPlugin) Shutdown ¶
func (p *ExecPlugin) Shutdown() error
func (*ExecPlugin) Type ¶
func (p *ExecPlugin) Type() PluginType
func (*ExecPlugin) Version ¶
func (p *ExecPlugin) Version() string
type ExecutorPlugin ¶
type ExecutorPlugin interface {
Plugin
CanExecute(target *api.TargetConfig) bool
Execute(ctx context.Context, project *api.ProjectConfig, target *api.TargetConfig) error
}
ExecutorPlugin executes tasks.
type GeneratorPlugin ¶
type GeneratorPlugin interface {
Plugin
Generators() []GeneratorSpec
Generate(ctx context.Context, spec string, options map[string]any) error
}
GeneratorPlugin generates code.
type GeneratorSpec ¶
type GeneratorSpec struct {
Name string `json:"name"`
Description string `json:"description"`
Schema any `json:"schema"`
}
GeneratorSpec describes a generator.
type HookPlugin ¶
type HookPlugin interface {
Plugin
OnPreBuild(ctx context.Context, project *api.ProjectConfig) error
OnPostBuild(ctx context.Context, project *api.ProjectConfig, success bool) error
OnPreTest(ctx context.Context, project *api.ProjectConfig) error
OnPostTest(ctx context.Context, project *api.ProjectConfig, success bool) error
}
HookPlugin provides lifecycle hooks.
type Issue ¶
type Issue struct {
Severity string `json:"severity"`
Message string `json:"message"`
File string `json:"file"`
Line int `json:"line"`
Column int `json:"column"`
Rule string `json:"rule"`
}
Issue represents an analysis issue.
type LanguagePluginRegistry ¶
type LanguagePluginRegistry struct {
// contains filtered or unexported fields
}
LanguagePluginRegistry manages language-specific plugins.
func (*LanguagePluginRegistry) DetectLanguage ¶
func (r *LanguagePluginRegistry) DetectLanguage(projectPath string) string
DetectLanguage detects the language for a project path.
func (*LanguagePluginRegistry) Get ¶
func (r *LanguagePluginRegistry) Get(name string) (api.LanguagePlugin, bool)
Get returns a language plugin by name.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader provides plugin discovery and loading.
func (*Loader) AddSearchPath ¶
AddSearchPath adds a path to search for plugins.
type Plugin ¶
type Plugin interface {
Name() string
Version() string
Type() PluginType
Initialize(config map[string]any) error
Shutdown() error
}
Plugin is the interface all plugins must implement.
type PluginManifest ¶
type PluginManifest struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author"`
Type PluginType `json:"type"`
Entrypoint string `json:"entrypoint"`
Config map[string]any `json:"config"`
Hooks []string `json:"hooks"`
}
PluginManifest describes a plugin.
type PluginType ¶
type PluginType string
PluginType represents the type of plugin.
const ( // PluginTypeExecutor provides custom task execution. PluginTypeExecutor PluginType = "executor" // PluginTypeGenerator provides code generation. PluginTypeGenerator PluginType = "generator" // PluginTypeAnalyzer provides code analysis. PluginTypeAnalyzer PluginType = "analyzer" // PluginTypeCache provides custom caching. PluginTypeCache PluginType = "cache" // PluginTypeHook provides lifecycle hooks. PluginTypeHook PluginType = "hook" )
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages loaded plugins.
func (*Registry) Analyzers ¶
func (r *Registry) Analyzers() []AnalyzerPlugin
Analyzers returns all analyzer plugins.
func (*Registry) Executors ¶
func (r *Registry) Executors() []ExecutorPlugin
Executors returns all executor plugins.
func (*Registry) Generators ¶
func (r *Registry) Generators() []GeneratorPlugin
Generators returns all generator plugins.
func (*Registry) Initialize ¶
Initialize initializes all loaded plugins.
func (*Registry) LoadFromDirectory ¶
LoadFromDirectory loads all plugins from a directory.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package golang provides the Go language plugin for monox.
|
Package golang provides the Go language plugin for monox. |
|
Package node provides plugin support for Node.js/TypeScript projects.
|
Package node provides plugin support for Node.js/TypeScript projects. |
|
Package nodejs provides the Node.js/TypeScript language plugin for monox.
|
Package nodejs provides the Node.js/TypeScript language plugin for monox. |
|
Package python provides the Python language plugin for monox.
|
Package python provides the Python language plugin for monox. |