Documentation
¶
Overview ¶
Package manager provides plugin management with configuration support.
Index ¶
- type Builder
- type Config
- type ExternalInputPlugin
- func (p *ExternalInputPlugin) Description() string
- func (p *ExternalInputPlugin) Generate(ctx context.Context, opts input.GenerateOptions) (*colour.Palette, error)
- func (p *ExternalInputPlugin) GetArgs() map[string]any
- func (p *ExternalInputPlugin) GetDryRun() bool
- func (p *ExternalInputPlugin) GetFlagHelp() []input.FlagHelp
- func (p *ExternalInputPlugin) Name() string
- func (p *ExternalInputPlugin) RegisterFlags(_ *cobra.Command)
- func (p *ExternalInputPlugin) SetArgs(args map[string]any)
- func (p *ExternalInputPlugin) SetDryRun(dryRun bool)
- func (p *ExternalInputPlugin) Validate() error
- func (p *ExternalInputPlugin) Version() string
- func (p *ExternalInputPlugin) WallpaperPath() string
- type ExternalOutputPlugin
- func (p *ExternalOutputPlugin) DefaultOutputDir() string
- func (p *ExternalOutputPlugin) Description() string
- func (p *ExternalOutputPlugin) Generate(themeData *colour.ThemeData) (map[string][]byte, error)
- func (p *ExternalOutputPlugin) GetArgs() map[string]any
- func (p *ExternalOutputPlugin) GetDryRun() bool
- func (p *ExternalOutputPlugin) GetFlagHelp() []input.FlagHelp
- func (p *ExternalOutputPlugin) GetVerbose() bool
- func (p *ExternalOutputPlugin) Name() string
- func (p *ExternalOutputPlugin) PostExecute(ctx context.Context, writtenFiles []string) error
- func (p *ExternalOutputPlugin) PreExecute(ctx context.Context) (skip bool, reason string, err error)
- func (p *ExternalOutputPlugin) RegisterFlags(_ *cobra.Command)
- func (p *ExternalOutputPlugin) SetAlternatePalette(palette *colour.CategorisedPalette)
- func (p *ExternalOutputPlugin) SetArgs(args map[string]any)
- func (p *ExternalOutputPlugin) SetDryRun(dryRun bool)
- func (p *ExternalOutputPlugin) SetVerbose(verbose bool)
- func (p *ExternalOutputPlugin) Validate() error
- func (p *ExternalOutputPlugin) Version() string
- type Manager
- func (m *Manager) AllInputPlugins() map[string]input.Plugin
- func (m *Manager) AllOutputPlugins() map[string]output.Plugin
- func (m *Manager) FilterInputPlugins() map[string]input.Plugin
- func (m *Manager) FilterOutputPlugins() map[string]output.Plugin
- func (m *Manager) GetConfig() Config
- func (m *Manager) GetInputPlugin(name string) (input.Plugin, bool)
- func (m *Manager) GetOutputPlugin(name string) (output.Plugin, bool)
- func (m *Manager) InputRegistry() *input.Registry
- func (m *Manager) IsInputEnabled(plugin input.Plugin) bool
- func (m *Manager) IsOutputDisabled(plugin output.Plugin) bool
- func (m *Manager) IsOutputEnabled(plugin output.Plugin) bool
- func (m *Manager) ListInputPlugins() []string
- func (m *Manager) ListOutputPlugins() []string
- func (m *Manager) OutputRegistry() *output.Registry
- func (m *Manager) RegisterExternalPlugin(name, pluginType, path, description string) error
- func (m *Manager) SetDisabled(pluginType, name string)
- func (m *Manager) SetEnabled(pluginType, name string)
- func (m *Manager) UpdateConfig(config Config)
- type PluginInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder provides a fluent interface for constructing a Manager with configuration.
func NewBuilder ¶
func NewBuilder() *Builder
NewBuilder creates a new Manager builder with default settings.
func (*Builder) Build ¶
Build constructs the Manager with the configured settings. If both env and lock file are specified, lock file takes precedence.
func (*Builder) WithConfig ¶
WithConfig sets the configuration for the manager.
func (*Builder) WithCustomRegistries ¶
func (b *Builder) WithCustomRegistries(inputReg *input.Registry, outputReg *output.Registry) *Builder
WithCustomRegistries allows providing custom plugin registries (useful for testing).
func (*Builder) WithEnvConfig ¶
WithEnvConfig loads configuration from environment variables. Reads TINCT_DISABLED_PLUGINS and TINCT_ENABLED_PLUGINS.
func (*Builder) WithLockFile ¶
WithLockFile sets the path to a plugin lock file to load configuration from.
type Config ¶
type Config struct {
// DisabledPlugins is a list of plugin names to disable.
// Format: "plugin_type:plugin_name" (e.g., "output:tailwind", "input:image").
DisabledPlugins []string
// EnabledPlugins is a list of plugin names to explicitly enable.
// If set, only these plugins are enabled (whitelist mode).
EnabledPlugins []string
}
Config holds plugin configuration.
type ExternalInputPlugin ¶
type ExternalInputPlugin struct {
// contains filtered or unexported fields
}
ExternalInputPlugin wraps an external executable as an input plugin.
func NewExternalInputPlugin ¶
func NewExternalInputPlugin(name, description, path string) *ExternalInputPlugin
NewExternalInputPlugin creates a new external input plugin wrapper.
func (*ExternalInputPlugin) Description ¶
func (p *ExternalInputPlugin) Description() string
Description returns the plugin's description.
func (*ExternalInputPlugin) Generate ¶
func (p *ExternalInputPlugin) Generate(ctx context.Context, opts input.GenerateOptions) (*colour.Palette, error)
Generate executes the external plugin and returns a palette. Uses the hybrid executor which automatically detects and uses the appropriate protocol (go-plugin RPC or JSON-stdio).
func (*ExternalInputPlugin) GetArgs ¶
func (p *ExternalInputPlugin) GetArgs() map[string]any
GetArgs returns custom arguments for this plugin.
func (*ExternalInputPlugin) GetDryRun ¶
func (p *ExternalInputPlugin) GetDryRun() bool
GetDryRun returns the dry-run mode for this plugin.
func (*ExternalInputPlugin) GetFlagHelp ¶
func (p *ExternalInputPlugin) GetFlagHelp() []input.FlagHelp
GetFlagHelp returns help information for plugin flags. For external plugins, this queries the plugin executable via RPC.
func (*ExternalInputPlugin) Name ¶
func (p *ExternalInputPlugin) Name() string
Name returns the plugin's name.
func (*ExternalInputPlugin) RegisterFlags ¶
func (p *ExternalInputPlugin) RegisterFlags(_ *cobra.Command)
RegisterFlags is a no-op for external plugins (they don't have flags).
func (*ExternalInputPlugin) SetArgs ¶
func (p *ExternalInputPlugin) SetArgs(args map[string]any)
SetArgs sets custom arguments for this plugin.
func (*ExternalInputPlugin) SetDryRun ¶
func (p *ExternalInputPlugin) SetDryRun(dryRun bool)
SetDryRun sets the dry-run mode for this plugin.
func (*ExternalInputPlugin) Validate ¶
func (p *ExternalInputPlugin) Validate() error
Validate checks if the plugin is valid.
func (*ExternalInputPlugin) Version ¶
func (p *ExternalInputPlugin) Version() string
Version returns the plugin's version. For external plugins, this queries the plugin executable.
func (*ExternalInputPlugin) WallpaperPath ¶
func (p *ExternalInputPlugin) WallpaperPath() string
WallpaperPath returns the wallpaper path from the last plugin execution. Implements the input.WallpaperProvider interface for external plugins.
type ExternalOutputPlugin ¶
type ExternalOutputPlugin struct {
// contains filtered or unexported fields
}
ExternalOutputPlugin wraps an external executable as an output plugin.
func NewExternalOutputPlugin ¶
func NewExternalOutputPlugin(name, description, path string) *ExternalOutputPlugin
NewExternalOutputPlugin creates a new external output plugin wrapper.
func (*ExternalOutputPlugin) DefaultOutputDir ¶
func (p *ExternalOutputPlugin) DefaultOutputDir() string
DefaultOutputDir returns the default output directory (not used for external plugins).
func (*ExternalOutputPlugin) Description ¶
func (p *ExternalOutputPlugin) Description() string
Description returns the plugin's description.
func (*ExternalOutputPlugin) Generate ¶
Generate executes the external plugin and returns its output.
func (*ExternalOutputPlugin) GetArgs ¶
func (p *ExternalOutputPlugin) GetArgs() map[string]any
GetArgs returns custom arguments for this plugin.
func (*ExternalOutputPlugin) GetDryRun ¶
func (p *ExternalOutputPlugin) GetDryRun() bool
GetDryRun returns the dry-run mode for this plugin.
func (*ExternalOutputPlugin) GetFlagHelp ¶
func (p *ExternalOutputPlugin) GetFlagHelp() []input.FlagHelp
GetFlagHelp returns help information for plugin flags. For external plugins, this queries the plugin executable via RPC.
func (*ExternalOutputPlugin) GetVerbose ¶
func (p *ExternalOutputPlugin) GetVerbose() bool
GetVerbose returns the verbose setting for this plugin.
func (*ExternalOutputPlugin) Name ¶
func (p *ExternalOutputPlugin) Name() string
Name returns the plugin's name.
func (*ExternalOutputPlugin) PostExecute ¶
func (p *ExternalOutputPlugin) PostExecute(ctx context.Context, writtenFiles []string) error
PostExecute calls the external plugin's post-execute hook. Implements the output.PostExecuteHook interface.
func (*ExternalOutputPlugin) PreExecute ¶
func (p *ExternalOutputPlugin) PreExecute(ctx context.Context) (skip bool, reason string, err error)
PreExecute calls the external plugin's pre-execute hook. Implements the output.PreExecuteHook interface.
func (*ExternalOutputPlugin) RegisterFlags ¶
func (p *ExternalOutputPlugin) RegisterFlags(_ *cobra.Command)
RegisterFlags is a no-op for external plugins (they don't have flags).
func (*ExternalOutputPlugin) SetAlternatePalette ¶ added in v0.1.0
func (p *ExternalOutputPlugin) SetAlternatePalette(palette *colour.CategorisedPalette)
SetAlternatePalette sets the alternate palette for dual-theme generation.
func (*ExternalOutputPlugin) SetArgs ¶
func (p *ExternalOutputPlugin) SetArgs(args map[string]any)
SetArgs sets custom arguments for this plugin.
func (*ExternalOutputPlugin) SetDryRun ¶
func (p *ExternalOutputPlugin) SetDryRun(dryRun bool)
SetDryRun sets the dry-run mode for this plugin.
func (*ExternalOutputPlugin) SetVerbose ¶
func (p *ExternalOutputPlugin) SetVerbose(verbose bool)
SetVerbose sets the verbose flag for this plugin.
func (*ExternalOutputPlugin) Validate ¶
func (p *ExternalOutputPlugin) Validate() error
Validate checks if the plugin is valid.
func (*ExternalOutputPlugin) Version ¶
func (p *ExternalOutputPlugin) Version() string
Version returns the plugin's version. For external plugins, this queries the plugin executable.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages plugin enable/disable state and owns plugin registries.
func (*Manager) AllInputPlugins ¶
AllInputPlugins returns all registered input plugins (including disabled).
func (*Manager) AllOutputPlugins ¶
AllOutputPlugins returns all registered output plugins (including disabled).
func (*Manager) FilterInputPlugins ¶
FilterInputPlugins returns only enabled input plugins.
func (*Manager) FilterOutputPlugins ¶
FilterOutputPlugins returns only enabled output plugins.
func (*Manager) GetInputPlugin ¶
GetInputPlugin retrieves an input plugin by name.
func (*Manager) GetOutputPlugin ¶
GetOutputPlugin retrieves an output plugin by name.
func (*Manager) InputRegistry ¶
InputRegistry returns the input plugin registry.
func (*Manager) IsInputEnabled ¶
IsInputEnabled checks if an input plugin is enabled. All plugins are disabled by default and must be explicitly enabled.
func (*Manager) IsOutputDisabled ¶
IsOutputDisabled checks if an output plugin is explicitly disabled.
func (*Manager) IsOutputEnabled ¶
IsOutputEnabled checks if an output plugin is enabled. All plugins are disabled by default and must be explicitly enabled.
func (*Manager) ListInputPlugins ¶
ListInputPlugins returns names of enabled input plugins.
func (*Manager) ListOutputPlugins ¶
ListOutputPlugins returns names of enabled output plugins.
func (*Manager) OutputRegistry ¶
OutputRegistry returns the output plugin registry.
func (*Manager) RegisterExternalPlugin ¶
RegisterExternalPlugin registers an external plugin with the manager.
func (*Manager) SetDisabled ¶
SetDisabled adds a plugin to the disabled list.
func (*Manager) SetEnabled ¶
SetEnabled adds a plugin to the enabled list (whitelist mode).
func (*Manager) UpdateConfig ¶
UpdateConfig updates the manager's configuration without recreating plugin instances. This preserves flag bindings and other plugin state.