plugin

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context = sdk.Context

Context is a type alias for the SDK Context type. Internal packages can continue to reference plugin.Context. New code should prefer pkg/sdk.

type MenuItem struct {
	Key         string
	Name        string
	Description string
}

MenuItem represents a menu entry for display on the home screen.

type NavBehavior int

NavBehavior describes how a plugin enters the navigation.

const (
	// NavReplace destroys the current view and takes its place (lateral navigation).
	NavReplace NavBehavior = iota
	// NavPush preserves the current view so the user can return to it after selection.
	NavPush
)

type Plugin

type Plugin = sdk.Plugin

Plugin is a type alias for the SDK Plugin interface. Internal packages can continue to reference plugin.Plugin. New code should prefer pkg/sdk.

type PluginFactory

type PluginFactory = sdk.PluginFactory

PluginFactory is a type alias for the SDK PluginFactory type.

type PluginMeta

type PluginMeta struct {
	Keybinding  string
	MenuVisible bool
	Nav         NavBehavior
}

PluginMeta holds external routing metadata for a plugin. Plugins themselves are invocation-agnostic — keybinding and menu visibility are controlled here.

type Registry

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

Registry holds all registered plugin factories and their instantiated plugins. It supports lookup by key binding or plugin ID.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new empty Registry with no registered factories or plugins.

func (*Registry) All

func (r *Registry) All() []Plugin

All returns the slice of all enabled and instantiated plugins.

func (*Registry) Build

func (r *Registry) Build(svc sdk.Service, configs map[string]config.PluginConfig)

Build instantiates all enabled plugins from registered factories and applies their configuration. Plugins not present in the configs map are enabled by default.

func (*Registry) ByID

func (r *Registry) ByID(id string) (Plugin, bool)

ByID looks up a plugin by its unique identifier and reports whether it was found.

func (*Registry) ByKey

func (r *Registry) ByKey(key string) (Plugin, bool)

ByKey looks up a plugin by its key binding string and reports whether it was found.

func (*Registry) MenuItems

func (r *Registry) MenuItems() []MenuItem

MenuItems returns the list of menu entries for plugins that are visible in the home menu, in registration order.

func (*Registry) NavBehaviorFor added in v1.5.0

func (r *Registry) NavBehaviorFor(id string) NavBehavior

NavBehaviorFor returns the navigation mode for the given plugin ID.

func (*Registry) RegisterFactory

func (r *Registry) RegisterFactory(id string, factory PluginFactory, meta PluginMeta)

RegisterFactory registers a plugin factory by its unique ID along with its routing metadata. The factory is not invoked until Build is called, allowing all factories to be registered before configuration is applied.

Jump to

Keyboard shortcuts

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