Documentation
¶
Index ¶
- Constants
- func GetPluginsDir() string
- type DeployConfig
- type InstallResult
- type InstallStage
- type InstallStatus
- type InstalledPlugin
- type Manager
- func (m *Manager) ExtractArchive(archivePath, destDir string) error
- func (m *Manager) GetMissingPlugins(pluginIDs []*PluginID) ([]*PluginID, error)
- func (m *Manager) GetUnsatisfiedPlugins(pluginIDs []*PluginID) ([]*PluginID, error)
- func (m *Manager) Install(ctx context.Context, pluginID *PluginID, progressFn ProgressCallback) (*InstallResult, error)
- func (m *Manager) InstallAll(ctx context.Context, pluginIDs []*PluginID, progressFn ProgressCallback) ([]*InstallResult, error)
- func (m *Manager) InstallMissing(ctx context.Context, pluginIDs []*PluginID, progressFn ProgressCallback) ([]*InstallResult, error)
- func (m *Manager) IsInstalled(pluginID *PluginID) (bool, *InstalledPlugin, error)
- func (m *Manager) IsSatisfied(pluginID *PluginID) (bool, *InstalledPlugin, error)
- func (m *Manager) ListInstalled() ([]*InstalledPlugin, error)
- func (m *Manager) LoadManifest() (*PluginManifest, error)
- func (m *Manager) ResolveDependencies(ctx context.Context, pluginIDs []*PluginID) ([]*PluginID, error)
- func (m *Manager) ResolveLatestVersion(ctx context.Context, pluginID *PluginID) (string, error)
- func (m *Manager) ResolveVersion(ctx context.Context, pluginID *PluginID) (string, error)
- func (m *Manager) SaveManifest(manifest *PluginManifest) error
- func (m *Manager) Uninstall(pluginID *PluginID) *UninstallResult
- func (m *Manager) UninstallAll(pluginIDs []*PluginID) []*UninstallResult
- func (m *Manager) VerifyChecksum(filePath string, shasums []byte, expectedFilename string) error
- func (m *Manager) VerifyGPGSignature(shasums, signature []byte, signingKeys map[string]string) error
- type PluginID
- func (p *PluginID) FullyQualified() string
- func (p *PluginID) IsDefaultRegistry() bool
- func (p *PluginID) IsVersionConstraint() bool
- func (p *PluginID) ManifestKey() string
- func (p *PluginID) ParseVersionConstraint() (*version.Constraint, error)
- func (p *PluginID) String() string
- func (p *PluginID) WithVersion(version string) *PluginID
- type PluginManifest
- type ProgressCallback
- type UninstallResult
- type UninstallStatus
Constants ¶
const DefaultRegistryHost = "registry.bluelink.dev"
DefaultRegistryHost is the default registry for plugins without an explicit host.
Variables ¶
This section is empty.
Functions ¶
func GetPluginsDir ¶
func GetPluginsDir() string
GetPluginsDir returns the plugin installation directory. Priority: BLUELINK_DEPLOY_ENGINE_PLUGIN_PATH env var > default platform path. If BLUELINK_DEPLOY_ENGINE_PLUGIN_PATH contains multiple paths (separated by os.PathListSeparator), the first path is used for installation.
Directory structure:
- {pluginsDir}/manifest.json - Plugin manifest tracking installed plugins
- {pluginsDir}/bin/{namespace}/{name}/{version}/ - Plugin executables
Types ¶
type DeployConfig ¶
DeployConfig represents the structure of bluelink.deploy.json.
func LoadDeployConfig ¶
func LoadDeployConfig(path string) (*DeployConfig, error)
LoadDeployConfig loads a deploy config from the specified path.
func (*DeployConfig) GetPluginIDs ¶
func (c *DeployConfig) GetPluginIDs() ([]*PluginID, error)
GetPluginIDs parses the dependencies and returns a list of PluginIDs.
type InstallResult ¶
type InstallResult struct {
PluginID *PluginID
Status InstallStatus
Error error
}
InstallResult contains the result of a plugin installation attempt.
type InstallStage ¶
type InstallStage string
InstallStage represents the current stage of plugin installation.
const ( StageResolving InstallStage = "resolving" StageDownloading InstallStage = "downloading" StageVerifying InstallStage = "verifying" StageExtracting InstallStage = "extracting" StageComplete InstallStage = "complete" )
type InstallStatus ¶
type InstallStatus int
InstallStatus represents the result status of a plugin installation.
const ( StatusInstalled InstallStatus = iota StatusSkipped StatusFailed )
type InstalledPlugin ¶
type InstalledPlugin struct {
ID string `json:"id"`
Version string `json:"version"`
RegistryHost string `json:"registryHost"`
Shasum string `json:"shasum"`
InstalledAt time.Time `json:"installedAt"`
Type string `json:"type,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"`
}
InstalledPlugin represents a plugin that has been installed.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles plugin installation, verification, and manifest management.
func NewManager ¶
func NewManager( registryClient *registries.RegistryClient, discoveryClient *registries.ServiceDiscoveryClient, ) *Manager
NewManager creates a new plugin manager.
func NewManagerWithPluginsDir ¶
func NewManagerWithPluginsDir( registryClient *registries.RegistryClient, discoveryClient *registries.ServiceDiscoveryClient, pluginsDir string, ) *Manager
NewManagerWithPluginsDir creates a new plugin manager with a custom plugins directory.
func (*Manager) ExtractArchive ¶
ExtractArchive extracts a tar.gz archive to the destination directory.
func (*Manager) GetMissingPlugins ¶
GetMissingPlugins returns plugins from the list that are not currently installed.
func (*Manager) GetUnsatisfiedPlugins ¶
GetUnsatisfiedPlugins returns plugins from the list that are not installed or whose installed version does not satisfy the version requirement.
func (*Manager) Install ¶
func (m *Manager) Install( ctx context.Context, pluginID *PluginID, progressFn ProgressCallback, ) (*InstallResult, error)
Installs a single plugin.
func (*Manager) InstallAll ¶
func (m *Manager) InstallAll( ctx context.Context, pluginIDs []*PluginID, progressFn ProgressCallback, ) ([]*InstallResult, error)
InstallAll installs multiple plugins with dependency resolution. Dependencies are resolved and installed first in topological order.
func (*Manager) InstallMissing ¶
func (m *Manager) InstallMissing( ctx context.Context, pluginIDs []*PluginID, progressFn ProgressCallback, ) ([]*InstallResult, error)
InstallMissing checks which plugins are not installed and installs them.
func (*Manager) IsInstalled ¶
func (m *Manager) IsInstalled(pluginID *PluginID) (bool, *InstalledPlugin, error)
IsInstalled checks if a plugin is installed with the specified version.
func (*Manager) IsSatisfied ¶
func (m *Manager) IsSatisfied(pluginID *PluginID) (bool, *InstalledPlugin, error)
IsSatisfied checks if a plugin requirement is met by an installed version. Unlike IsInstalled, this handles version constraints ("^1.0.0", "~1.0.0") and "latest" (any installed version satisfies).
func (*Manager) ListInstalled ¶
func (m *Manager) ListInstalled() ([]*InstalledPlugin, error)
ListInstalled returns all installed plugins.
func (*Manager) LoadManifest ¶
func (m *Manager) LoadManifest() (*PluginManifest, error)
LoadManifest loads the plugin manifest from disk.
func (*Manager) ResolveDependencies ¶
func (m *Manager) ResolveDependencies( ctx context.Context, pluginIDs []*PluginID, ) ([]*PluginID, error)
ResolveDependencies resolves all dependencies for the given plugins and returns the full list in topological order (dependencies first, requested plugins last). Already-installed plugins are excluded from the result.
func (*Manager) ResolveLatestVersion ¶
ResolveLatestVersion finds the latest version of a plugin.
func (*Manager) ResolveVersion ¶
ResolveVersion resolves the version for a plugin. If no version is specified, returns the latest version. If a constraint is specified (^1.0.0 or ~1.0.0), returns the best matching version. If an exact version is specified, returns that version.
func (*Manager) SaveManifest ¶
func (m *Manager) SaveManifest(manifest *PluginManifest) error
SaveManifest saves the plugin manifest to disk.
func (*Manager) Uninstall ¶
func (m *Manager) Uninstall(pluginID *PluginID) *UninstallResult
Uninstall removes a single plugin from the local machine.
func (*Manager) UninstallAll ¶
func (m *Manager) UninstallAll(pluginIDs []*PluginID) []*UninstallResult
UninstallAll removes multiple plugins from the local machine.
func (*Manager) VerifyChecksum ¶
VerifyChecksum verifies the SHA256 checksum of a file against the shasums content.
type PluginID ¶
type PluginID struct {
RegistryHost string // e.g., "registry.bluelink.dev" or "registry.example.com"
Namespace string // e.g., "bluelink", "my-org"
Name string // e.g., "aws", "gcp"
Version string // e.g., "1.0.0" or "" for latest
}
PluginID represents a parsed plugin identifier with registry, namespace, name, and version.
func ParsePluginID ¶
ParsePluginID parses a plugin identifier string into a PluginID struct.
Supported formats:
- "namespace/name" -> uses DefaultRegistryHost
- "namespace/name@version" -> uses DefaultRegistryHost with version
- "host/namespace/name" -> custom registry host
- "host/namespace/name@version" -> custom registry host with version
func (*PluginID) FullyQualified ¶
FullyQualified returns the fully qualified plugin ID including the registry host. Format: "host/namespace/name" or "host/namespace/name@version"
func (*PluginID) IsDefaultRegistry ¶
IsDefaultRegistry returns true if the plugin uses the default Bluelink registry.
func (*PluginID) IsVersionConstraint ¶
IsVersionConstraint returns true if the version contains constraint prefixes (^ or ~).
func (*PluginID) ManifestKey ¶
ManifestKey returns the key used to identify this plugin in the manifest file. This excludes the version since the manifest tracks installed versions separately. Format: "host/namespace/name"
func (*PluginID) ParseVersionConstraint ¶
func (p *PluginID) ParseVersionConstraint() (*version.Constraint, error)
ParseVersionConstraint parses the version as a constraint. Returns an exact constraint if no prefix is present. Returns an error if no version is specified.
func (*PluginID) String ¶
String returns the short form of the plugin ID. For default registry: "namespace/name" or "namespace/name@version" For custom registry: "host/namespace/name" or "host/namespace/name@version"
func (*PluginID) WithVersion ¶
WithVersion returns a copy of the PluginID with the specified version.
type PluginManifest ¶
type PluginManifest struct {
Plugins map[string]*InstalledPlugin `json:"plugins"`
}
PluginManifest tracks all installed plugins.
type ProgressCallback ¶
type ProgressCallback func(pluginID *PluginID, stage InstallStage, downloaded, total int64)
ProgressCallback is called during installation to report progress.
type UninstallResult ¶
type UninstallResult struct {
PluginID *PluginID
Status UninstallStatus
Error error
}
UninstallResult contains the result of a plugin uninstallation attempt.
type UninstallStatus ¶
type UninstallStatus int
UninstallStatus represents the result status of a plugin uninstallation.
const ( UninstallStatusRemoved UninstallStatus = iota UninstallStatusNotFound UninstallStatusFailed )