plugin

package
v0.2.49 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const PluginManifestFlag = "--dr-plugin-manifest"

PluginManifestFlag is the command-line flag plugins must implement to output their manifest

View Source
const PluginPrefix = "dr-"

PluginPrefix is the required prefix for all plugin executables

View Source
const PluginRegistryTerminology = "registry"

PluginRegistryTerminology is the user-facing term for the plugin registry

View Source
const PluginRegistryURL = "https://cli.datarobot.com/plugins/index.json"

PluginRegistryURL is the default URL for the remote plugin registry

Variables

This section is empty.

Functions

func BackupPlugin added in v0.2.40

func BackupPlugin(name string) (string, error)

BackupPlugin creates a backup of an installed plugin in a temporary directory Returns the path to the backup directory

func CleanupBackup added in v0.2.40

func CleanupBackup(backupPath string)

CleanupBackup removes a backup directory

func ExecutePlugin

func ExecutePlugin(manifest PluginManifest, executable string, args []string) int

ExecutePlugin runs a plugin and returns its exit code If the plugin manifest requires authentication, it will check/prompt for auth first

func FindPluginScript added in v0.2.40

func FindPluginScript(pluginDir, pluginName string) (string, error)

FindPluginScript finds the plugin script in the given directory.

func InstallPlugin added in v0.2.40

func InstallPlugin(pluginEntry RegistryPlugin, version RegistryVersion, baseURL string) error

InstallPlugin downloads and installs a plugin

func ManagedPluginsDir added in v0.2.40

func ManagedPluginsDir() (string, error)

ManagedPluginsDir returns the user-global managed plugins directory. It respects XDG_CONFIG_HOME if set, otherwise falls back to ~/.config/datarobot/plugins/

func RestorePlugin added in v0.2.40

func RestorePlugin(name, backupPath string) error

RestorePlugin restores a plugin from a backup directory

func UninstallPlugin added in v0.2.40

func UninstallPlugin(name string) error

UninstallPlugin removes an installed plugin

func ValidateLicense added in v0.2.41

func ValidateLicense(pluginDir string) error

ValidateLicense validates that a plugin has a LICENSE.txt file.

func ValidatePlugin added in v0.2.40

func ValidatePlugin(name string) error

ValidatePlugin validates that a plugin installation is working correctly

func ValidatePluginScript added in v0.2.40

func ValidatePluginScript(pluginDir string, expectedManifest PluginManifest) error

ValidatePluginScript validates that a plugin script outputs a manifest matching the expected manifest. All fields must match exactly, including Scripts and MinCLIVersion for managed plugins.

Types

type BasicPluginManifest added in v0.2.40

type BasicPluginManifest struct {
	Name           string `json:"name"`
	Version        string `json:"version,omitempty"`
	Description    string `json:"description,omitempty"`
	Authentication bool   `json:"authentication,omitempty"`
}

BasicPluginManifest contains the core fields that all plugin manifests must have.

type DiscoveredPlugin

type DiscoveredPlugin struct {
	Manifest   PluginManifest
	Executable string // Full path to executable
}

DiscoveredPlugin pairs a manifest with its executable path

func GetPlugins

func GetPlugins() ([]DiscoveredPlugin, error)

GetPlugins returns discovered plugins, discovering lazily on first call TODO: Consider file-based caching with TTL to avoid manifest fetching on every CLI invocation

type DiscoveredPluginsRegistry added in v0.2.40

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

DiscoveredPluginsRegistry holds discovered plugins with lazy initialization

type InstalledPlugin added in v0.2.40

type InstalledPlugin struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Source      string `json:"source"`      // URL or local path where it was installed from
	InstalledAt string `json:"installedAt"` // RFC3339 timestamp
}

InstalledPlugin represents metadata about an installed remote plugin

func GetInstalledPlugins added in v0.2.40

func GetInstalledPlugins() ([]InstalledPlugin, error)

GetInstalledPlugins returns metadata about installed managed plugins

type PluginManifest

type PluginManifest struct {
	BasicPluginManifest
	Scripts       *PluginScripts `json:"scripts,omitempty"`       // Platform-specific script paths
	MinCLIVersion string         `json:"minCLIVersion,omitempty"` // Minimum CLI version required
}

PluginManifest represents the full JSON manifest returned by managed plugins. Embeds BasicPluginManifest and adds additional fields for managed plugins.

func ExecPluginManifest added in v0.2.40

func ExecPluginManifest(scriptPath string) (*PluginManifest, error)

ExecPluginManifest executes a plugin script and returns its manifest.

type PluginRegistry

type PluginRegistry struct {
	Version string                    `json:"version"`
	Plugins map[string]RegistryPlugin `json:"plugins"`
}

PluginRegistry represents the remote plugin registry structure

func FetchRegistry added in v0.2.40

func FetchRegistry(registryURL string) (*PluginRegistry, string, error)

FetchRegistry downloads and parses the plugin registry from the remote URL. Returns the registry, the base URL (directory of registry file), and any error.

type PluginScripts added in v0.2.40

type PluginScripts struct {
	Posix   string `json:"posix,omitempty"`   // Script for Linux/macOS (e.g., "scripts/plugin.sh")
	Windows string `json:"windows,omitempty"` // Script for Windows (e.g., "scripts/plugin.ps1")
}

PluginScripts maps platforms to their script paths within the plugin package

type RegistryPlugin added in v0.2.40

type RegistryPlugin struct {
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	Repository  string            `json:"repository,omitempty"`
	Versions    []RegistryVersion `json:"versions"`
}

RegistryPlugin represents a plugin entry in the remote registry

type RegistryVersion added in v0.2.40

type RegistryVersion struct {
	Version     string `json:"version"`
	URL         string `json:"url"`
	SHA256      string `json:"sha256,omitempty"`
	ReleaseDate string `json:"releaseDate,omitempty"`
}

RegistryVersion represents a specific version in the plugin registry

func ResolveVersion added in v0.2.40

func ResolveVersion(versions []RegistryVersion, constraint string) (*RegistryVersion, error)

ResolveVersion finds the best matching version for a constraint Supports full semver constraint syntax including: exact (1.2.3), caret (^1.2.3), tilde (~1.2.3), ranges (>=1.0.0), comma-separated constraints (>=1.0.0, <2.0.0), and latest

Jump to

Keyboard shortcuts

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