Documentation
¶
Overview ¶
Package plugin defines the unified plugin host for huan extensions.
Plugin is the minimal base interface every plugin satisfies. Capability interfaces (e.g. deploy.Deployer) embed Plugin and add domain-specific methods. The Registry holds plugins keyed by Name(); Find[T] returns the subset implementing a given capability.
See docs/adr/0003-unified-plugin-system.md for the architectural decisions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Plugin ¶
type Plugin interface {
// Name is the plugin's unique identifier. It matches the yaml key under
// plugins: (e.g. Name()=="cloudflare" pairs with yaml plugins.cloudflare.*).
Name() string
}
Plugin is the base interface every plugin satisfies. Capability interfaces (Deployer, future PaymentProvider, etc.) embed Plugin and add methods.
Plugin intentionally has only Name(): config injection happens via the plugin's constructor (e.g. cloudflare.New(cfg)), not via an Init method. Lifecycle hooks (Start/Stop), when needed, live on the specific capability interface rather than the base.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds plugins keyed by Name(). The order slice preserves registration order for deterministic iteration in Find[T] and All.
func (*Registry) All ¶
All returns all registered plugins in registration order. The returned slice is a copy; callers may mutate it without affecting the registry.
func (*Registry) Register ¶
Register adds a plugin to the registry. Returns an error if a plugin with the same Name() is already registered — duplicate registration is treated as a programming error rather than silently overwritten.
func (*Registry) SortedNames ¶
SortedNames returns registered plugin names in lexicographic order. Useful for CLI listing where deterministic alphabetical output is preferred over registration order.