plugin

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 11 Imported by: 0

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

func NewManager(logger *slog.Logger) *Manager

NewManager creates a plugin manager.

func (*Manager) LoadAll

func (m *Manager) LoadAll(s *gossip.Server) error

LoadAll registers all plugins' rules and metadata with the server.

func (*Manager) Loaded

func (m *Manager) Loaded() []Plugin

Loaded returns the list of loaded plugins.

func (*Manager) Register

func (m *Manager) Register(p Plugin)

Register adds a plugin to the 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

type PluginFunc func() (Plugin, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL