manager

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 47 Imported by: 0

Documentation

Overview

Package manager provides plugin management with configuration support.

Index

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

func (b *Builder) Build() *Manager

Build constructs the Manager with the configured settings. If both env and lock file are specified, lock file takes precedence.

func (*Builder) WithConfig

func (b *Builder) WithConfig(config Config) *Builder

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

func (b *Builder) WithEnvConfig() *Builder

WithEnvConfig loads configuration from environment variables. Reads TINCT_DISABLED_PLUGINS and TINCT_ENABLED_PLUGINS.

func (*Builder) WithLockFile

func (b *Builder) WithLockFile(path string) *Builder

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

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

func (p *ExternalOutputPlugin) Generate(themeData *colour.ThemeData) (map[string][]byte, error)

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

func (m *Manager) AllInputPlugins() map[string]input.Plugin

AllInputPlugins returns all registered input plugins (including disabled).

func (*Manager) AllOutputPlugins

func (m *Manager) AllOutputPlugins() map[string]output.Plugin

AllOutputPlugins returns all registered output plugins (including disabled).

func (*Manager) FilterInputPlugins

func (m *Manager) FilterInputPlugins() map[string]input.Plugin

FilterInputPlugins returns only enabled input plugins.

func (*Manager) FilterOutputPlugins

func (m *Manager) FilterOutputPlugins() map[string]output.Plugin

FilterOutputPlugins returns only enabled output plugins.

func (*Manager) GetConfig

func (m *Manager) GetConfig() Config

GetConfig returns the current configuration.

func (*Manager) GetInputPlugin

func (m *Manager) GetInputPlugin(name string) (input.Plugin, bool)

GetInputPlugin retrieves an input plugin by name.

func (*Manager) GetOutputPlugin

func (m *Manager) GetOutputPlugin(name string) (output.Plugin, bool)

GetOutputPlugin retrieves an output plugin by name.

func (*Manager) InputRegistry

func (m *Manager) InputRegistry() *input.Registry

InputRegistry returns the input plugin registry.

func (*Manager) IsInputEnabled

func (m *Manager) IsInputEnabled(plugin input.Plugin) bool

IsInputEnabled checks if an input plugin is enabled. All plugins are disabled by default and must be explicitly enabled.

func (*Manager) IsOutputDisabled

func (m *Manager) IsOutputDisabled(plugin output.Plugin) bool

IsOutputDisabled checks if an output plugin is explicitly disabled.

func (*Manager) IsOutputEnabled

func (m *Manager) IsOutputEnabled(plugin output.Plugin) bool

IsOutputEnabled checks if an output plugin is enabled. All plugins are disabled by default and must be explicitly enabled.

func (*Manager) ListInputPlugins

func (m *Manager) ListInputPlugins() []string

ListInputPlugins returns names of enabled input plugins.

func (*Manager) ListOutputPlugins

func (m *Manager) ListOutputPlugins() []string

ListOutputPlugins returns names of enabled output plugins.

func (*Manager) OutputRegistry

func (m *Manager) OutputRegistry() *output.Registry

OutputRegistry returns the output plugin registry.

func (*Manager) RegisterExternalPlugin

func (m *Manager) RegisterExternalPlugin(name, pluginType, path, description string) error

RegisterExternalPlugin registers an external plugin with the manager.

func (*Manager) SetDisabled

func (m *Manager) SetDisabled(pluginType, name string)

SetDisabled adds a plugin to the disabled list.

func (*Manager) SetEnabled

func (m *Manager) SetEnabled(pluginType, name string)

SetEnabled adds a plugin to the enabled list (whitelist mode).

func (*Manager) UpdateConfig

func (m *Manager) UpdateConfig(config Config)

UpdateConfig updates the manager's configuration without recreating plugin instances. This preserves flag bindings and other plugin state.

type PluginInfo

type PluginInfo struct {
	Name            string `json:"name"`
	Type            string `json:"type"`
	Version         string `json:"version"`
	ProtocolVersion string `json:"protocol_version"`
	Description     string `json:"description"`
}

PluginInfo holds metadata returned by a plugin's --plugin-info command.

Jump to

Keyboard shortcuts

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