plugins

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BinaryPrefix = "orca-plugin-"

BinaryPrefix is the filename prefix every plugin executable must have.

Variables

View Source
var ErrKilled = errors.New("plugin manager has been killed")

ErrKilled is returned when trying to load a plugin after Kill has been called.

Functions

func BuildCommands

func BuildCommands(provider plugin.CommandProvider, specs []plugin.CommandSpec) []*cobra.Command

BuildCommands converts a plugin's command specs into cobra commands that call back into the plugin when run.

func Discover

func Discover(afs afero.Fs, dirs []string) ([]string, error)

Discover returns the paths of all plugin executables found in the given directories. Directories that don't exist are skipped. If the same plugin name appears in multiple directories, the first one wins.

Types

type CachedPlugin added in v0.20.0

type CachedPlugin struct {
	Name     string
	Commands []plugin.CommandSpec
}

CachedPlugin is a plugin's commands, as stored in the CommandCache.

type CommandCache added in v0.20.0

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

CommandCache stores the commands each plugin provides, so that shell completion can offer them without starting any plugins, which would be far too slow. It's only a cache: orca rewrites it whenever it runs a command, so it's always safe to delete.

func NewCommandCache added in v0.20.0

func NewCommandCache(fs afero.Fs, path string) *CommandCache

func (*CommandCache) Read added in v0.20.0

func (c *CommandCache) Read() ([]CachedPlugin, error)

Read returns the cached plugins. There's no cache until orca has run a command, in which case there are none.

func (*CommandCache) Write added in v0.20.0

func (c *CommandCache) Write(loaded []LoadedPlugin) error

Write replaces the cache with the commands of the given plugins, so a plugin that's no longer loaded is removed from it.

type ExitError

type ExitError struct {
	Code int
	Err  error
}

ExitError is returned when a plugin command fails, so orca can exit with the plugin's exit code.

func (ExitError) Error

func (e ExitError) Error() string

func (ExitError) Unwrap

func (e ExitError) Unwrap() error

type LoadedPlugin

type LoadedPlugin struct {
	Name     string
	Path     string
	Provider plugin.CommandProvider
	Commands []plugin.CommandSpec
}

LoadedPlugin is a running plugin process, along with the commands it provides.

type Manager

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

func NewManager

func NewManager(logger *slog.Logger) *Manager

func (*Manager) Kill

func (m *Manager) Kill()

Kill stops all plugin processes, and prevents any more from being started. It must be called before orca exits, and is safe to call multiple times or concurrently.

func (*Manager) Load

func (m *Manager) Load(paths []string) []LoadedPlugin

Load starts each plugin binary and fetches its commands. A plugin that fails to start is logged and skipped, so a broken plugin never stops orca from running.

func (*Manager) Loaded

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

func (*Manager) Logger

func (m *Manager) Logger() *slog.Logger

Jump to

Keyboard shortcuts

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