Documentation
¶
Overview ¶
Package plugin defines the in-process Plugin interface for registering rule providers with Telescope. User-authored rules use YAML config and the Bun sidecar (TypeScript/JavaScript); this package is for internal wiring.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager loads and registers plugins with the gossip server.
func NewManager ¶
NewManager creates a plugin manager.
func (*Manager) RegisterFunc ¶
func (m *Manager) RegisterFunc(fn PluginFunc) error
RegisterFunc creates and registers a plugin from a constructor function.
type Plugin ¶
type Plugin interface {
// Name returns the plugin's unique identifier.
Name() string
// Version returns the plugin's version string.
Version() string
// Checks returns the tree-sitter pattern-based checks this plugin provides.
// Keys are rule IDs.
Checks() map[string]treesitter.Check
// Analyzers returns the semantic analyzer rules this plugin provides.
// Keys are rule IDs.
Analyzers() map[string]treesitter.Analyzer
// Meta returns metadata for all rules in this plugin.
Meta() []rules.RuleMeta
}
Plugin is the interface that custom rule providers implement.
type PluginFunc ¶
PluginFunc is a constructor function that creates a Plugin instance. Plugins can be registered via this function type for lazy initialization.
type YAMLRulePlugin ¶
type YAMLRulePlugin struct {
// contains filtered or unexported fields
}
YAMLRulePlugin is a plugin constructed from a YAML declarative rule file.
func LoadYAMLPlugin ¶
func LoadYAMLPlugin(path string, logger *slog.Logger) (*YAMLRulePlugin, error)
LoadYAMLPlugin loads a YAML ruleset file and converts its rules into a Plugin. Rules with JSONPath "given" expressions are evaluated through the Spectral engine; rules with tree-sitter pattern strings are registered as tree-sitter Checks for backward compatibility.
func (*YAMLRulePlugin) Analyzers ¶
func (p *YAMLRulePlugin) Analyzers() map[string]treesitter.Analyzer
func (*YAMLRulePlugin) Checks ¶
func (p *YAMLRulePlugin) Checks() map[string]treesitter.Check
func (*YAMLRulePlugin) Meta ¶
func (p *YAMLRulePlugin) Meta() []rules.RuleMeta
func (*YAMLRulePlugin) Name ¶
func (p *YAMLRulePlugin) Name() string
func (*YAMLRulePlugin) Version ¶
func (p *YAMLRulePlugin) Version() string