manager

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package manager provides plugin management functionality for ReleasePilot.

Index

Constants

View Source
const (
	// DefaultPluginDir is the default directory for plugins
	DefaultPluginDir = ".release-pilot/plugins"
	// DefaultCacheDir is the default directory for cache
	DefaultCacheDir = ".release-pilot/cache"
	// ManifestFile is the name of the manifest file
	ManifestFile = "manifest.yaml"
)
View Source
const (
	// DefaultRegistryURL is the default location of the plugin registry
	DefaultRegistryURL = "https://raw.githubusercontent.com/felixgeelhaar/release-pilot/main/plugins/registry.yaml"
	// RegistryCacheFile is the name of the cached registry file
	RegistryCacheFile = "registry.yaml"
	// RegistryCacheDuration is how long to cache the registry
	RegistryCacheDuration = 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigField

type ConfigField struct {
	// Type of the field (string, boolean, integer, array, object)
	Type string `yaml:"type"`
	// Required indicates if the field is required
	Required bool `yaml:"required"`
	// Default value for the field
	Default any `yaml:"default,omitempty"`
	// Description of what the field does
	Description string `yaml:"description"`
	// Env is the environment variable to read the value from
	Env string `yaml:"env,omitempty"`
	// Options for enum/select fields
	Options []string `yaml:"options,omitempty"`
	// Validation rules
	Pattern  string `yaml:"pattern,omitempty"`
	MinValue *int   `yaml:"min_value,omitempty"`
	MaxValue *int   `yaml:"max_value,omitempty"`
}

ConfigField defines a configuration field for a plugin.

type InstalledPlugin

type InstalledPlugin struct {
	// Name of the plugin
	Name string `yaml:"name"`
	// Version of the installed plugin
	Version string `yaml:"version"`
	// InstalledAt timestamp when the plugin was installed
	InstalledAt time.Time `yaml:"installed_at"`
	// BinaryPath is the path to the plugin binary
	BinaryPath string `yaml:"binary_path"`
	// Checksum of the plugin binary (SHA256)
	Checksum string `yaml:"checksum"`
	// Enabled indicates if the plugin is enabled in the config
	Enabled bool `yaml:"enabled"`
}

InstalledPlugin represents a plugin that is installed locally.

type Installer

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

Installer handles plugin installation operations.

func NewInstaller

func NewInstaller(pluginDir string) *Installer

NewInstaller creates a new plugin installer.

func (*Installer) Install

func (i *Installer) Install(ctx context.Context, pluginInfo PluginInfo) (*InstalledPlugin, error)

Install downloads and installs a plugin binary.

func (*Installer) Uninstall

func (i *Installer) Uninstall(plugin InstalledPlugin) error

Uninstall removes a plugin binary and its manifest entry.

func (*Installer) VerifyChecksum

func (i *Installer) VerifyChecksum(plugin InstalledPlugin) error

VerifyChecksum verifies the checksum of an installed plugin.

type Manager

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

Manager coordinates plugin management operations.

func NewManager

func NewManager() (*Manager, error)

NewManager creates a new plugin manager.

func (*Manager) Disable

func (m *Manager) Disable(ctx context.Context, name string) error

Disable disables an installed plugin.

func (*Manager) Enable

func (m *Manager) Enable(ctx context.Context, name string) error

Enable enables an installed plugin.

func (*Manager) GetPluginInfo

func (m *Manager) GetPluginInfo(ctx context.Context, name string) (*PluginListEntry, error)

GetPluginInfo retrieves information about a specific plugin.

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, name string) error

Install installs a plugin from the registry.

func (*Manager) ListAvailable

func (m *Manager) ListAvailable(ctx context.Context, forceRefresh bool) ([]PluginListEntry, error)

ListAvailable returns all plugins available in the registry.

func (*Manager) ListInstalled

func (m *Manager) ListInstalled(ctx context.Context) ([]PluginListEntry, error)

ListInstalled returns only installed plugins.

func (*Manager) Uninstall

func (m *Manager) Uninstall(ctx context.Context, name string) error

Uninstall removes a plugin.

type Manifest

type Manifest struct {
	// Version of the manifest schema
	Version string `yaml:"version"`
	// Installed plugins
	Installed []InstalledPlugin `yaml:"installed"`
	// UpdatedAt timestamp when manifest was last updated
	UpdatedAt time.Time `yaml:"updated_at"`
}

Manifest tracks all installed plugins.

type PluginInfo

type PluginInfo struct {
	// Name of the plugin
	Name string `yaml:"name"`
	// Description of what the plugin does
	Description string `yaml:"description"`
	// Repository where the plugin source code lives (owner/repo)
	Repository string `yaml:"repository"`
	// Path to the plugin within the repository
	Path string `yaml:"path"`
	// Version of the plugin
	Version string `yaml:"version"`
	// Category of the plugin (vcs, notification, package_manager, etc.)
	Category string `yaml:"category"`
	// Hooks that the plugin implements
	Hooks []plugin.Hook `yaml:"hooks"`
	// ConfigSchema defines the configuration options for the plugin
	ConfigSchema map[string]ConfigField `yaml:"config_schema"`
	// Author of the plugin
	Author string `yaml:"author,omitempty"`
	// Homepage URL for the plugin
	Homepage string `yaml:"homepage,omitempty"`
	// License of the plugin
	License string `yaml:"license,omitempty"`
}

PluginInfo contains metadata about a plugin from the registry.

type PluginListEntry

type PluginListEntry struct {
	Info      PluginInfo
	Installed *InstalledPlugin
	Status    PluginStatus
}

PluginListEntry combines registry and installation information.

type PluginStatus

type PluginStatus string

PluginStatus represents the status of a plugin.

const (
	// StatusNotInstalled means the plugin is not installed
	StatusNotInstalled PluginStatus = "not_installed"
	// StatusInstalled means the plugin is installed but not enabled
	StatusInstalled PluginStatus = "installed"
	// StatusEnabled means the plugin is installed and enabled
	StatusEnabled PluginStatus = "enabled"
	// StatusUpdateAvailable means a newer version is available
	StatusUpdateAvailable PluginStatus = "update_available"
)

type Registry

type Registry struct {
	// Version of the registry schema
	Version string `yaml:"version"`
	// Plugins available in the registry
	Plugins []PluginInfo `yaml:"plugins"`
	// UpdatedAt timestamp when registry was last updated
	UpdatedAt time.Time `yaml:"updated_at"`
}

Registry represents the central registry of available plugins.

func (*Registry) Categories

func (r *Registry) Categories() []string

Categories returns all unique plugin categories.

func (*Registry) GetPlugin

func (r *Registry) GetPlugin(name string) (*PluginInfo, error)

GetPlugin retrieves information about a specific plugin from the registry.

func (*Registry) ListByCategory

func (r *Registry) ListByCategory(category string) []PluginInfo

ListByCategory returns plugins filtered by category.

type RegistryService

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

RegistryService manages the plugin registry.

func NewRegistryService

func NewRegistryService(cacheDir string) *RegistryService

NewRegistryService creates a new registry service.

func (*RegistryService) Fetch

func (r *RegistryService) Fetch(ctx context.Context, forceRefresh bool) (*Registry, error)

Fetch retrieves the plugin registry, using cache if available and fresh.

Jump to

Keyboard shortcuts

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