{"modulePath":"github.com/newstack-cloud/bluelink/apps/cli","version":"v0.6.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugins\n\n## Constants\n\n```go\nconst DefaultRegistryHost = \"registry.bluelink.dev\"\n```\nDefaultRegistryHost is the default registry for plugins without an explicit host.\n\n## Functions\n\n```go\nfunc GetPluginsDir() string\n```\nGetPluginsDir returns the plugin installation directory. Priority: BLUELINK\\_DEPLOY\\_ENGINE\\_PLUGIN\\_PATH env var \u003e default platform path. If BLUELINK\\_DEPLOY\\_ENGINE\\_PLUGIN\\_PATH contains multiple paths (separated by os.PathListSeparator), the first path is used for installation.\n\nDirectory structure:\n\n  - {pluginsDir}/manifest.json - Plugin manifest tracking installed plugins\n  - {pluginsDir}/bin/{namespace}/{name}/{version}/ - Plugin executables\n\n## Types\n\n```go\ntype DeployConfig struct {\n\tDependencies map[string]string `json:\"dependencies\"`\n}\n```\nDeployConfig represents the structure of bluelink.deploy.json.\n\n```go\nfunc LoadDeployConfig(path string) (*DeployConfig, error)\n```\nLoadDeployConfig loads a deploy config from the specified path.\n\n```go\nfunc (c *DeployConfig) GetPluginIDs() ([]*PluginID, error)\n```\nGetPluginIDs parses the dependencies and returns a list of PluginIDs.\n\n```go\ntype InstallResult struct {\n\tPluginID *PluginID\n\tStatus   InstallStatus\n\tError    error\n}\n```\nInstallResult contains the result of a plugin installation attempt.\n\n```go\ntype InstallStage string\n```\nInstallStage represents the current stage of plugin installation.\n\n```go\nconst (\n\tStageResolving   InstallStage = \"resolving\"\n\tStageDownloading InstallStage = \"downloading\"\n\tStageVerifying   InstallStage = \"verifying\"\n\tStageExtracting  InstallStage = \"extracting\"\n\tStageComplete    InstallStage = \"complete\"\n)\n```\n\n```go\ntype InstallStatus int\n```\nInstallStatus represents the result status of a plugin installation.\n\n```go\nconst (\n\tStatusInstalled InstallStatus = iota\n\tStatusSkipped\n\tStatusFailed\n)\n```\n\n```go\ntype InstalledPlugin struct {\n\tID           string            `json:\"id\"`\n\tVersion      string            `json:\"version\"`\n\tRegistryHost string            `json:\"registryHost\"`\n\tShasum       string            `json:\"shasum\"`\n\tInstalledAt  time.Time         `json:\"installedAt\"`\n\tType         string            `json:\"type,omitempty\"`\n\tDependencies map[string]string `json:\"dependencies,omitempty\"`\n}\n```\nInstalledPlugin represents a plugin that has been installed.\n\n```go\ntype Manager struct {\n\t// contains filtered or unexported fields\n}\n```\nManager handles plugin installation, verification, and manifest management.\n\n```go\nfunc NewManager(\n\tregistryClient *registries.RegistryClient,\n\tdiscoveryClient *registries.ServiceDiscoveryClient,\n) *Manager\n```\nNewManager creates a new plugin manager.\n\n```go\nfunc NewManagerWithPluginsDir(\n\tregistryClient *registries.RegistryClient,\n\tdiscoveryClient *registries.ServiceDiscoveryClient,\n\tpluginsDir string,\n) *Manager\n```\nNewManagerWithPluginsDir creates a new plugin manager with a custom plugins directory.\n\n```go\nfunc (m *Manager) ExtractArchive(archivePath, destDir string) error\n```\nExtractArchive extracts a tar.gz archive to the destination directory.\n\n```go\nfunc (m *Manager) GetMissingPlugins(pluginIDs []*PluginID) ([]*PluginID, error)\n```\nGetMissingPlugins returns plugins from the list that are not currently installed.\n\n```go\nfunc (m *Manager) GetUnsatisfiedPlugins(pluginIDs []*PluginID) ([]*PluginID, error)\n```\nGetUnsatisfiedPlugins returns plugins from the list that are not installed or whose installed version does not satisfy the version requirement.\n\n```go\nfunc (m *Manager) Install(\n\tctx context.Context,\n\tpluginID *PluginID,\n\tprogressFn ProgressCallback,\n) (*InstallResult, error)\n```\nInstalls a single plugin.\n\n```go\nfunc (m *Manager) InstallAll(\n\tctx context.Context,\n\tpluginIDs []*PluginID,\n\tprogressFn ProgressCallback,\n) ([]*InstallResult, error)\n```\nInstallAll installs multiple plugins with dependency resolution. Dependencies are resolved and installed first in topological order.\n\n```go\nfunc (m *Manager) InstallMissing(\n\tctx context.Context,\n\tpluginIDs []*PluginID,\n\tprogressFn ProgressCallback,\n) ([]*InstallResult, error)\n```\nInstallMissing checks which plugins are not installed and installs them.\n\n```go\nfunc (m *Manager) IsInstalled(pluginID *PluginID) (bool, *InstalledPlugin, error)\n```\nIsInstalled checks if a plugin is installed with the specified version.\n\n```go\nfunc (m *Manager) IsSatisfied(pluginID *PluginID) (bool, *InstalledPlugin, error)\n```\nIsSatisfied 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).\n\n```go\nfunc (m *Manager) ListInstalled() ([]*InstalledPlugin, error)\n```\nListInstalled returns all installed plugins.\n\n```go\nfunc (m *Manager) LoadManifest() (*PluginManifest, error)\n```\nLoadManifest loads the plugin manifest from disk.\n\n```go\nfunc (m *Manager) ResolveDependencies(\n\tctx context.Context,\n\tpluginIDs []*PluginID,\n) ([]*PluginID, error)\n```\nResolveDependencies 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.\n\n```go\nfunc (m *Manager) ResolveLatestVersion(ctx context.Context, pluginID *PluginID) (string, error)\n```\nResolveLatestVersion finds the latest version of a plugin.\n\n```go\nfunc (m *Manager) ResolveVersion(ctx context.Context, pluginID *PluginID) (string, error)\n```\nResolveVersion 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.\n\n```go\nfunc (m *Manager) SaveManifest(manifest *PluginManifest) error\n```\nSaveManifest saves the plugin manifest to disk.\n\n```go\nfunc (m *Manager) Uninstall(pluginID *PluginID) *UninstallResult\n```\nUninstall removes a single plugin from the local machine.\n\n```go\nfunc (m *Manager) UninstallAll(pluginIDs []*PluginID) []*UninstallResult\n```\nUninstallAll removes multiple plugins from the local machine.\n\n```go\nfunc (m *Manager) VerifyChecksum(filePath string, shasums []byte, expectedFilename string) error\n```\nVerifyChecksum verifies the SHA256 checksum of a file against the shasums content.\n\n```go\nfunc (m *Manager) VerifyGPGSignature(shasums, signature []byte, signingKeys map[string]string) error\n```\nVerifyGPGSignature verifies the GPG signature of the shasums file.\n\n```go\ntype PluginID struct {\n\tRegistryHost string // e.g., \"registry.bluelink.dev\" or \"registry.example.com\"\n\tNamespace    string // e.g., \"bluelink\", \"my-org\"\n\tName         string // e.g., \"aws\", \"gcp\"\n\tVersion      string // e.g., \"1.0.0\" or \"\" for latest\n}\n```\nPluginID represents a parsed plugin identifier with registry, namespace, name, and version.\n\n```go\nfunc ParsePluginID(input string) (*PluginID, error)\n```\nParsePluginID parses a plugin identifier string into a PluginID struct.\n\nSupported formats:\n\n  - \"namespace/name\" -\u003e uses DefaultRegistryHost\n  - \"namespace/name@version\" -\u003e uses DefaultRegistryHost with version\n  - \"host/namespace/name\" -\u003e custom registry host\n  - \"host/namespace/name@version\" -\u003e custom registry host with version\n\n```go\nfunc (p *PluginID) FullyQualified() string\n```\nFullyQualified returns the fully qualified plugin ID including the registry host. Format: \"host/namespace/name\" or \"host/namespace/name@version\"\n\n```go\nfunc (p *PluginID) IsDefaultRegistry() bool\n```\nIsDefaultRegistry returns true if the plugin uses the default Bluelink registry.\n\n```go\nfunc (p *PluginID) IsVersionConstraint() bool\n```\nIsVersionConstraint returns true if the version contains constraint prefixes (^ or ~).\n\n```go\nfunc (p *PluginID) ManifestKey() string\n```\nManifestKey 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\"\n\n```go\nfunc (p *PluginID) ParseVersionConstraint() (*version.Constraint, error)\n```\nParseVersionConstraint parses the version as a constraint. Returns an exact constraint if no prefix is present. Returns an error if no version is specified.\n\n```go\nfunc (p *PluginID) String() string\n```\nString 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\"\n\n```go\nfunc (p *PluginID) WithVersion(version string) *PluginID\n```\nWithVersion returns a copy of the PluginID with the specified version.\n\n```go\ntype PluginManifest struct {\n\tPlugins map[string]*InstalledPlugin `json:\"plugins\"`\n}\n```\nPluginManifest tracks all installed plugins.\n\n```go\ntype ProgressCallback func(pluginID *PluginID, stage InstallStage, downloaded, total int64)\n```\nProgressCallback is called during installation to report progress.\n\n```go\ntype UninstallResult struct {\n\tPluginID *PluginID\n\tStatus   UninstallStatus\n\tError    error\n}\n```\nUninstallResult contains the result of a plugin uninstallation attempt.\n\n```go\ntype UninstallStatus int\n```\nUninstallStatus represents the result status of a plugin uninstallation.\n\n```go\nconst (\n\tUninstallStatusRemoved UninstallStatus = iota\n\tUninstallStatusNotFound\n\tUninstallStatusFailed\n)\n```\n\n","path":"github.com/newstack-cloud/bluelink/apps/cli/internal/plugins","name":"plugins","synopsis":"","isRedistributable":true}
