Documentation
¶
Overview ¶
Package plugins provides plugin installation and lifecycle management.
ABOUTME: Plugin installation and management operations ABOUTME: Handles install, uninstall, update operations for plugins
Index ¶
- type ActivationConfig
- type ActivationContext
- type ConfigSchema
- type Installer
- type Loader
- func (l *Loader) DiscoverAll() ([]*Plugin, error)
- func (l *Loader) GetPlugin(name string) (*Plugin, error)
- func (l *Loader) GetPluginsDir() string
- func (l *Loader) LoadEnabled(context *ActivationContext) ([]*Plugin, error)
- func (l *Loader) SaveState() error
- func (l *Loader) State() *State
- func (l *Loader) ValidatePlugin(pluginDir string) error
- type MCPConfig
- type Manifest
- func (m *Manifest) FullID() string
- func (m *Manifest) GetAgentPaths(pluginDir string) []string
- func (m *Manifest) GetCommandPaths(pluginDir string) []string
- func (m *Manifest) GetSkillPaths(pluginDir string) []string
- func (m *Manifest) GetTemplatePaths(pluginDir string) []string
- func (m *Manifest) Save(path string) error
- func (m *Manifest) ShouldActivate(context *ActivationContext) bool
- func (m *Manifest) Validate() error
- type Plugin
- type PluginState
- type Registry
- func (r *Registry) Count() int
- func (r *Registry) Disable(name string) error
- func (r *Registry) Enable(name string) error
- func (r *Registry) Get(name string) (*Plugin, bool)
- func (r *Registry) GetAgentPaths() []string
- func (r *Registry) GetAll() []*Plugin
- func (r *Registry) GetCommandPaths() []string
- func (r *Registry) GetHooks() map[string][]map[string]interface{}
- func (r *Registry) GetMCPServers() map[string]MCPConfig
- func (r *Registry) GetPluginsDir() string
- func (r *Registry) GetSkillPaths() []string
- func (r *Registry) GetStateFile() string
- func (r *Registry) GetTemplatePaths() []string
- func (r *Registry) Install(source string) error
- func (r *Registry) List() []string
- func (r *Registry) ListInstalled() ([]*Plugin, error)
- func (r *Registry) LoadAll(context *ActivationContext) error
- func (r *Registry) Uninstall(name string) error
- func (r *Registry) Update(name string) error
- type RepositoryInfo
- type State
- func (s *State) AddPlugin(name, version, path string)
- func (s *State) DisablePlugin(name string) error
- func (s *State) EnablePlugin(name string) error
- func (s *State) GetPlugin(name string) (*PluginState, error)
- func (s *State) IsEnabled(name string) bool
- func (s *State) IsInstalled(name string) bool
- func (s *State) ListAll() []string
- func (s *State) ListEnabled() []string
- func (s *State) RemovePlugin(name string)
- func (s *State) Save(stateFile string) error
- func (s *State) UpdatePlugin(name, version string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivationConfig ¶
type ActivationConfig struct {
OnStartup bool `json:"onStartup,omitempty"`
Languages []string `json:"languages,omitempty"`
Files []string `json:"files,omitempty"`
Projects []string `json:"projects,omitempty"`
}
ActivationConfig defines when a plugin should activate
type ActivationContext ¶
type ActivationContext struct {
Languages []string // Detected languages in project
Files []string // Important files in project
ProjectTypes []string // Detected project types (e.g., "react", "django")
}
ActivationContext provides context for plugin activation decisions
type ConfigSchema ¶
type ConfigSchema struct {
Defaults map[string]interface{} `json:"defaults,omitempty"`
Schema map[string]interface{} `json:"schema,omitempty"`
}
ConfigSchema defines plugin configuration options
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer handles plugin installation operations
func NewInstaller ¶
NewInstaller creates a new plugin installer
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader discovers and loads plugins from directories
func (*Loader) DiscoverAll ¶
DiscoverAll finds all plugins in the plugins directory
func (*Loader) GetPluginsDir ¶
GetPluginsDir returns the plugins directory path
func (*Loader) LoadEnabled ¶
func (l *Loader) LoadEnabled(context *ActivationContext) ([]*Plugin, error)
LoadEnabled loads all enabled plugins
func (*Loader) ValidatePlugin ¶
ValidatePlugin checks if a plugin directory is valid
type MCPConfig ¶
type MCPConfig struct {
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
}
MCPConfig defines an MCP server configuration
type Manifest ¶
type Manifest struct {
// Required fields
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
// Optional metadata
Author string `json:"author,omitempty"`
License string `json:"license,omitempty"`
Homepage string `json:"homepage,omitempty"`
Repository *RepositoryInfo `json:"repository,omitempty"`
Keywords []string `json:"keywords,omitempty"`
Engines map[string]string `json:"engines,omitempty"`
// Plugin dependencies
Dependencies map[string]string `json:"dependencies,omitempty"`
// What the plugin contributes
Skills []string `json:"skills,omitempty"`
Commands []string `json:"commands,omitempty"`
Hooks map[string]interface{} `json:"hooks,omitempty"`
MCPServers map[string]MCPConfig `json:"mcpServers,omitempty"`
Agents []string `json:"agents,omitempty"`
Templates []string `json:"templates,omitempty"`
Scripts map[string]string `json:"scripts,omitempty"`
Activation *ActivationConfig `json:"activation,omitempty"`
Config *ConfigSchema `json:"configuration,omitempty"`
}
Manifest represents a plugin's metadata and configuration
func LoadManifest ¶
LoadManifest loads and validates a plugin manifest from a file
func (*Manifest) GetAgentPaths ¶
GetAgentPaths returns full paths to agent files
func (*Manifest) GetCommandPaths ¶
GetCommandPaths returns full paths to command files
func (*Manifest) GetSkillPaths ¶
GetSkillPaths returns full paths to skill files
func (*Manifest) GetTemplatePaths ¶
GetTemplatePaths returns full paths to template files
func (*Manifest) ShouldActivate ¶
func (m *Manifest) ShouldActivate(context *ActivationContext) bool
ShouldActivate checks if the plugin should activate in the current context
type Plugin ¶
type Plugin struct {
Name string
Version string
Dir string
Manifest *Manifest
Enabled bool
Installed bool
}
Plugin represents a loaded plugin with its manifest and metadata
type PluginState ¶
type PluginState struct {
Enabled bool `json:"enabled"`
Version string `json:"version"`
Installed time.Time `json:"installed"`
Updated time.Time `json:"updated,omitempty"`
Path string `json:"path"` // Full path to plugin directory
}
PluginState tracks an individual plugin's state
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages loaded plugins and their contributions
func DefaultRegistry ¶
DefaultRegistry creates a registry with default paths
func NewRegistry ¶
NewRegistry creates a new plugin registry
func (*Registry) GetAgentPaths ¶
GetAgentPaths returns all agent file paths from loaded plugins
func (*Registry) GetCommandPaths ¶
GetCommandPaths returns all command file paths from loaded plugins
func (*Registry) GetMCPServers ¶
GetMCPServers returns all MCP server configs from loaded plugins
func (*Registry) GetPluginsDir ¶
GetPluginsDir returns the plugins directory path
func (*Registry) GetSkillPaths ¶
GetSkillPaths returns all skill file paths from loaded plugins
func (*Registry) GetStateFile ¶
GetStateFile returns the state file path
func (*Registry) GetTemplatePaths ¶
GetTemplatePaths returns all template file paths from loaded plugins
func (*Registry) ListInstalled ¶
ListInstalled returns all installed plugins (enabled and disabled)
func (*Registry) LoadAll ¶
func (r *Registry) LoadAll(context *ActivationContext) error
LoadAll discovers and loads all enabled plugins
type RepositoryInfo ¶
RepositoryInfo contains source repository metadata
type State ¶
type State struct {
Plugins map[string]*PluginState `json:"plugins"`
}
State tracks the installation state of all plugins
func (*State) DisablePlugin ¶
DisablePlugin disables a plugin
func (*State) EnablePlugin ¶
EnablePlugin enables a plugin
func (*State) GetPlugin ¶
func (s *State) GetPlugin(name string) (*PluginState, error)
GetPlugin retrieves a plugin's state
func (*State) IsInstalled ¶
IsInstalled checks if a plugin is installed
func (*State) ListEnabled ¶
ListEnabled returns all enabled plugin names
func (*State) RemovePlugin ¶
RemovePlugin removes a plugin from state
func (*State) UpdatePlugin ¶
UpdatePlugin updates a plugin's version and timestamp