plugins

package
v1.0.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModule

func NewModule(name, path string) target.Module

NewModule adapts an executable plugin into an unbound target.Module. A target must BindTarget it before use.

Types

type LoadedPlugin

type LoadedPlugin struct {
	Name    string
	Path    string
	Source  string
	Version string
}

LoadedPlugin is one plugin executable registered into the runtime module map.

func BuildRegistry

func BuildRegistry(base target.ModuleRegistry, opts Options) (target.ModuleRegistry, []LoadedPlugin, error)

BuildRegistry merges built-in modules with discovered plugins. Plugin names may not shadow built-ins and duplicate plugin names are rejected.

type Options

type Options struct {
	BinaryDir              string
	WorkingDir             string
	PreferredDirs          []string
	ExclusivePreferredDirs bool
}

Options controls plugin discovery and registration.

type Plugin

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

Plugin adapts an executable plugin into target.Module. It is created unbound (path only) during BuildRegistry; a target binds it to its TargetOps backend via BindTarget. Once bound, the lazily-created client carries protocol_version and the enriched TargetInfo at initialize, and the plugin's handle-op requests (RunCommand/PutFile/GetFile) flow through the bound ops backend — including against the local target.

Plugin satisfies target.PluggableModule. It forwards Message and streams output (the silent drops of the v0 adapter are fixed): Check/Apply use the streaming SDK calls so plugin output notifications reach the runner.

func (*Plugin) Apply

func (m *Plugin) Apply(ctx context.Context, params map[string]any, out target.OutputFunc) (target.ApplyResult, error)

func (*Plugin) BindTarget

func (m *Plugin) BindTarget(ops target.TargetOps) target.Module

BindTarget returns a fresh Plugin bound to the given target ops backend. The returned Module owns its own (lazily-created) client state; the receiver stays unbound so another target can bind it independently.

func (*Plugin) Check

func (m *Plugin) Check(ctx context.Context, params map[string]any, out target.OutputFunc) (target.CheckResult, error)

func (*Plugin) Close

func (m *Plugin) Close() error

func (*Plugin) PluginPath

func (m *Plugin) PluginPath() string

PluginPath returns the filesystem path to the backing plugin executable.

Jump to

Keyboard shortcuts

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