discovery

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package discovery provides plugin discovery and registration mechanisms

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPluginConfig

func LoadPluginConfig(configPath string) (map[string]interface{}, error)

LoadPluginConfig loads additional configuration for a plugin

func ValidateProtocolVersion

func ValidateProtocolVersion(pluginVersion, hostVersion string) error

ValidateProtocolVersion checks if a plugin's protocol version is compatible

Types

type DiscoveredPlugin

type DiscoveredPlugin struct {
	Info           PluginInfo
	ManifestPath   string
	ExecutablePath string
	ConfigPath     string
}

DiscoveredPlugin represents a discovered plugin with its metadata and location

type Discoverer

type Discoverer struct {
	// contains filtered or unexported fields
}

Discoverer handles plugin discovery

func NewDiscoverer

func NewDiscoverer(pluginDirs []string, logger *logrus.Logger) *Discoverer

NewDiscoverer creates a new plugin discoverer

func (*Discoverer) DiscoverPlugins

func (d *Discoverer) DiscoverPlugins() ([]DiscoveredPlugin, error)

DiscoverPlugins searches for plugins in configured directories

type PluginInfo

type PluginInfo struct {
	Name            string                 `toml:"name" json:"name"`
	Version         string                 `toml:"version" json:"version"`
	Executable      string                 `toml:"executable" json:"executable"`
	ProtocolVersion string                 `toml:"protocol_version" json:"protocol_version"`
	Description     string                 `toml:"description" json:"description"`
	Author          string                 `toml:"author" json:"author"`
	License         string                 `toml:"license" json:"license"`
	Capabilities    []string               `toml:"capabilities" json:"capabilities"`
	Dependencies    []string               `toml:"dependencies" json:"dependencies"`
	Config          map[string]interface{} `toml:"config" json:"config"`
}

PluginInfo contains plugin metadata

type PluginManifest

type PluginManifest struct {
	Plugin PluginInfo `toml:"plugin"`
}

PluginManifest represents the plugin.toml file structure

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages registered plugins

func NewRegistry

func NewRegistry(logger *logrus.Logger) *Registry

NewRegistry creates a new plugin registry

func (*Registry) Get

func (r *Registry) Get(name string) (*DiscoveredPlugin, bool)

Get retrieves a plugin by name

func (*Registry) List

func (r *Registry) List() []DiscoveredPlugin

List returns all registered plugins

func (*Registry) Register

func (r *Registry) Register(plugin DiscoveredPlugin) error

Register adds a plugin to the registry

func (*Registry) Remove

func (r *Registry) Remove(name string) bool

Remove unregisters a plugin

Jump to

Keyboard shortcuts

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