plugins

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandInfo

type CommandInfo struct {
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Usage       string     `json:"usage"`
	Flags       []FlagInfo `json:"flags"`
	Examples    []string   `json:"examples"`
}

CommandInfo represents a plugin command

type DefaultPluginService

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

DefaultPluginService provides a default implementation

func (*DefaultPluginService) DisablePlugin

func (p *DefaultPluginService) DisablePlugin(ctx context.Context, name string) error

DisablePlugin disables a plugin

func (*DefaultPluginService) EnablePlugin

func (p *DefaultPluginService) EnablePlugin(ctx context.Context, name string) error

EnablePlugin enables a plugin

func (*DefaultPluginService) ExecutePlugin

func (p *DefaultPluginService) ExecutePlugin(ctx context.Context, name string, args []string) (*PluginResult, error)

ExecutePlugin executes a plugin with the given arguments

func (*DefaultPluginService) GetPluginInfo

func (p *DefaultPluginService) GetPluginInfo(ctx context.Context, name string) (*PluginInfo, error)

GetPluginInfo gets information about a specific plugin

func (*DefaultPluginService) InstallPlugin

func (p *DefaultPluginService) InstallPlugin(ctx context.Context, name string, source string) error

InstallPlugin installs a plugin from a source

func (*DefaultPluginService) ListPlugins

func (p *DefaultPluginService) ListPlugins(ctx context.Context) ([]PluginInfo, error)

ListPlugins lists all installed plugins

func (*DefaultPluginService) SearchPlugins

func (p *DefaultPluginService) SearchPlugins(ctx context.Context, query string) ([]PluginSearchResult, error)

SearchPlugins searches for plugins in the registry

func (*DefaultPluginService) UninstallPlugin

func (p *DefaultPluginService) UninstallPlugin(ctx context.Context, name string) error

UninstallPlugin removes a plugin

func (*DefaultPluginService) UpdatePlugin

func (p *DefaultPluginService) UpdatePlugin(ctx context.Context, name string) error

UpdatePlugin updates a plugin to the latest version

type FlagInfo

type FlagInfo struct {
	Name        string `json:"name"`
	Short       string `json:"short"`
	Description string `json:"description"`
	Type        string `json:"type"`
	Default     string `json:"default"`
	Required    bool   `json:"required"`
}

FlagInfo represents a command flag

type LocalPluginRegistry

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

LocalPluginRegistry implements a local plugin registry

func (*LocalPluginRegistry) Download

func (r *LocalPluginRegistry) Download(name string, version string) ([]byte, error)

Download downloads a plugin from the registry

func (*LocalPluginRegistry) GetMetadata

func (r *LocalPluginRegistry) GetMetadata(name string) (*PluginManifest, error)

GetMetadata gets plugin metadata from the registry

func (*LocalPluginRegistry) Search

func (r *LocalPluginRegistry) Search(query string) ([]PluginSearchResult, error)

Search searches for plugins in the registry

func (*LocalPluginRegistry) Verify

func (r *LocalPluginRegistry) Verify(data []byte, checksum string) error

Verify verifies a plugin's integrity

type Plugin

type Plugin interface {
	GetInfo() *PluginInfo
	Execute(args []string) (*PluginResult, error)
	Configure(config map[string]string) error
	Validate() error
}

Plugin interface defines the contract for AlloraCLI plugins

type PluginInfo

type PluginInfo struct {
	Name         string            `json:"name"`
	Version      string            `json:"version"`
	Description  string            `json:"description"`
	Author       string            `json:"author"`
	License      string            `json:"license"`
	Homepage     string            `json:"homepage"`
	Repository   string            `json:"repository"`
	Tags         []string          `json:"tags"`
	Commands     []CommandInfo     `json:"commands"`
	Status       string            `json:"status"`
	Enabled      bool              `json:"enabled"`
	Installed    time.Time         `json:"installed"`
	Updated      time.Time         `json:"updated"`
	Config       map[string]string `json:"config"`
	Dependencies []string          `json:"dependencies"`
}

PluginInfo represents plugin information

type PluginManager

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

PluginManager manages the plugin lifecycle

func NewPluginManager

func NewPluginManager(service PluginService, registry PluginRegistry) *PluginManager

NewPluginManager creates a new plugin manager

func (*PluginManager) CleanupClients

func (m *PluginManager) CleanupClients()

CleanupClients cleans up all plugin clients

func (*PluginManager) GetClient

func (m *PluginManager) GetClient(name string) (*plugin.Client, error)

GetClient gets a plugin client for communication

type PluginManifest

type PluginManifest struct {
	Name         string            `yaml:"name"`
	Version      string            `yaml:"version"`
	Description  string            `yaml:"description"`
	Author       string            `yaml:"author"`
	License      string            `yaml:"license"`
	Homepage     string            `yaml:"homepage"`
	Repository   string            `yaml:"repository"`
	Tags         []string          `yaml:"tags"`
	Commands     []CommandInfo     `yaml:"commands"`
	Dependencies []string          `yaml:"dependencies"`
	Config       map[string]string `yaml:"config"`
	Binary       string            `yaml:"binary"`
	Checksum     string            `yaml:"checksum"`
}

PluginManifest represents the plugin manifest file

type PluginRegistry

type PluginRegistry interface {
	Search(query string) ([]PluginSearchResult, error)
	GetMetadata(name string) (*PluginManifest, error)
	Download(name string, version string) ([]byte, error)
	Verify(data []byte, checksum string) error
}

Plugin registry interface for advanced plugin management

func NewLocalPluginRegistry

func NewLocalPluginRegistry(baseURL string) PluginRegistry

NewLocalPluginRegistry creates a new local plugin registry

type PluginResult

type PluginResult struct {
	ExitCode int                    `json:"exit_code"`
	Output   string                 `json:"output"`
	Error    string                 `json:"error"`
	Data     map[string]interface{} `json:"data"`
	Duration time.Duration          `json:"duration"`
}

PluginResult represents the result of plugin execution

type PluginSearchResult

type PluginSearchResult struct {
	Name        string    `json:"name"`
	Version     string    `json:"version"`
	Description string    `json:"description"`
	Author      string    `json:"author"`
	Tags        []string  `json:"tags"`
	Downloads   int       `json:"downloads"`
	Rating      float64   `json:"rating"`
	Updated     time.Time `json:"updated"`
	Source      string    `json:"source"`
}

PluginSearchResult represents a plugin search result

type PluginService

type PluginService interface {
	ListPlugins(ctx context.Context) ([]PluginInfo, error)
	InstallPlugin(ctx context.Context, name string, source string) error
	UpdatePlugin(ctx context.Context, name string) error
	UninstallPlugin(ctx context.Context, name string) error
	EnablePlugin(ctx context.Context, name string) error
	DisablePlugin(ctx context.Context, name string) error
	GetPluginInfo(ctx context.Context, name string) (*PluginInfo, error)
	ExecutePlugin(ctx context.Context, name string, args []string) (*PluginResult, error)
	SearchPlugins(ctx context.Context, query string) ([]PluginSearchResult, error)
}

PluginService interface defines plugin management operations

func NewPluginService

func NewPluginService(cfg *config.Config) (PluginService, error)

NewPluginService creates a new plugin service

Jump to

Keyboard shortcuts

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