extensions

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package extensions provides the gpd extension system for installable subcommands.

Package extensions provides the gpd extension system for installable subcommands.

Package extensions provides the gpd extension system for installable subcommands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExecutablePath

func GetExecutablePath(name string) (string, error)

GetExecutablePath returns the full path to an extension's executable.

func GetExtensionsDir

func GetExtensionsDir() string

GetExtensionsDir returns the directory where extensions are installed.

func IsBuiltInCommand

func IsBuiltInCommand(name string) bool

IsBuiltInCommand checks if a command name is reserved for built-in commands.

func IsInstalled

func IsInstalled(name string) bool

IsInstalled checks if an extension is installed.

func Remove

func Remove(name string) error

Remove removes an installed extension.

Types

type Extension

type Extension struct {
	Name        string    `json:"name" yaml:"name"`
	Version     string    `json:"version" yaml:"version"`
	Description string    `json:"description,omitempty" yaml:"description,omitempty"`
	Author      string    `json:"author,omitempty" yaml:"author,omitempty"`
	Bin         string    `json:"bin,omitempty" yaml:"bin,omitempty"`
	Source      string    `json:"source" yaml:"source"` // GitHub repo path (owner/repo)
	InstalledAt time.Time `json:"installedAt" yaml:"installedAt"`
	UpdatedAt   time.Time `json:"updatedAt" yaml:"updatedAt"`
	Pinned      bool      `json:"pinned" yaml:"pinned"`                           // Whether auto-upgrade is disabled
	PinnedRef   string    `json:"pinnedRef,omitempty" yaml:"pinnedRef,omitempty"` // Tag or commit if pinned
	Type        string    `json:"type" yaml:"type"`                               // "binary" or "script"
}

Extension represents an installed gpd extension.

func List

func List() ([]Extension, error)

List returns all installed extensions.

func LoadExtension

func LoadExtension(name string) (*Extension, error)

LoadExtension loads an extension by name from the extensions directory.

type InstallOptions

type InstallOptions struct {
	Source    string        // GitHub repo (owner/repo) or local path
	Pin       bool          // Pin to specific ref
	PinnedRef string        // Tag or commit to pin to
	Force     bool          // Overwrite existing
	Timeout   time.Duration // HTTP timeout
}

InstallOptions contains options for installing an extension.

type InstallResult

type InstallResult struct {
	Extension *Extension
	Installed bool // Whether this was a new install or update
}

InstallResult contains information about the installed extension.

func Install

func Install(ctx context.Context, opts InstallOptions) (*InstallResult, error)

Install installs an extension from a GitHub repository or local path.

type Manifest

type Manifest struct {
	Name        string `json:"name" yaml:"name"`
	Version     string `json:"version" yaml:"version"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Author      string `json:"author,omitempty" yaml:"author,omitempty"`
	Bin         string `json:"bin,omitempty" yaml:"bin,omitempty"` // Executable name (defaults to gpd-<name>)
	Homepage    string `json:"homepage,omitempty" yaml:"homepage,omitempty"`
}

Manifest represents the .gpd-extension file in an extension repository.

func (*Manifest) DefaultBinName

func (m *Manifest) DefaultBinName() string

DefaultBinName returns the default executable name for an extension.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate checks if the manifest is valid.

Jump to

Keyboard shortcuts

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