pkg

package
v0.1.0-dev.20260222185005 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(reg *execution.ActionRegistry)

Register registers all pkg actions with the given registry.

Types

type Install

type Install struct{ Impl *Provider }

Install — Install installs packages using the platform's package manager. Returns compensation state with pre-install status per package.

func (*Install) Do

func (*Install) Name

func (o *Install) Name() string

func (*Install) Undo

func (o *Install) Undo(state execution.UndoState) error

type Installed

type Installed struct{ Impl *Provider }

Installed — Installed returns true if the named package is installed.

func (*Installed) Do

func (*Installed) Name

func (o *Installed) Name() string

type NotInstalled

type NotInstalled struct{ Impl *Provider }

NotInstalled — NotInstalled returns true if the named package is not installed.

func (*NotInstalled) Do

func (*NotInstalled) Name

func (o *NotInstalled) Name() string

type Provider

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

Provider provides platform-independent package management. The package manager is resolved at runtime via host.PackageManager().

Compensable Forward methods return (string, map[string]any, error): a summary of affected packages, the compensation receipt, and an error. The map is opaque to the executor, meaningful only to the corresponding Compensate* Backward method.

func (*Provider) CompensateInstall

func (p *Provider) CompensateInstall(state any) error

CompensateInstall undoes an Install by removing packages that weren't already installed before the action.

func (*Provider) CompensateRemove

func (p *Provider) CompensateRemove(state any) error

CompensateRemove undoes a Remove by reinstalling the removed packages.

func (*Provider) CompensateUpgrade

func (p *Provider) CompensateUpgrade(_ any) error

CompensateUpgrade is a diagnostic no-op. Previous versions are captured in state for manual recovery, but automatic downgrade is not reliable across package managers.

func (*Provider) Install

func (p *Provider) Install(packages []string, manager string, cask bool) (string, map[string]any, error)

Install installs packages using the platform's package manager. Returns compensation state with pre-install status per package.

Parameters:

  • packages: List of package names to install
  • manager: Package manager override (empty for auto-detect)
  • cask: If true, use Homebrew cask for macOS GUI apps

func (*Provider) Installed

func (p *Provider) Installed(name string) (bool, error)

Installed returns true if the named package is installed.

Parameters:

  • name: Package name to check

func (*Provider) NotInstalled

func (p *Provider) NotInstalled(name string) (bool, error)

NotInstalled returns true if the named package is not installed.

Parameters:

  • name: Package name to check

func (*Provider) Remove

func (p *Provider) Remove(packages []string, manager string, cask bool) (string, map[string]any, error)

Remove removes packages using the platform's package manager. Returns compensation state for reinstallation.

Parameters:

  • packages: List of package names to remove
  • manager: Package manager override (empty for auto-detect)
  • cask: If true, use Homebrew cask for macOS GUI apps

func (*Provider) Update

func (p *Provider) Update(manager string) (string, error)

Update refreshes the package manager index.

Parameters:

  • manager: Package manager override (empty for auto-detect)

func (*Provider) Upgrade

func (p *Provider) Upgrade(packages []string, manager string, cask bool) (string, map[string]any, error)

Upgrade upgrades packages using the platform's package manager. Returns compensation state with pre-upgrade versions per package.

Parameters:

  • packages: List of package names to upgrade
  • manager: Package manager override (empty for auto-detect)
  • cask: If true, use Homebrew cask for macOS GUI apps

func (*Provider) VersionGTE

func (p *Provider) VersionGTE(name, version string) (bool, error)

VersionGTE returns true if the installed version of name is >= version.

Parameters:

  • name: Package name to check
  • version: Minimum version string to compare against

type Remove

type Remove struct{ Impl *Provider }

Remove — Remove removes packages using the platform's package manager. Returns compensation state for reinstallation.

func (*Remove) Do

func (*Remove) Name

func (o *Remove) Name() string

func (*Remove) Undo

func (o *Remove) Undo(state execution.UndoState) error

type Update

type Update struct{ Impl *Provider }

Update — Update refreshes the package manager index.

func (*Update) Do

func (*Update) Name

func (o *Update) Name() string

type Upgrade

type Upgrade struct{ Impl *Provider }

Upgrade — Upgrade upgrades packages using the platform's package manager. Returns compensation state with pre-upgrade versions per package.

func (*Upgrade) Do

func (*Upgrade) Name

func (o *Upgrade) Name() string

func (*Upgrade) Undo

func (o *Upgrade) Undo(state execution.UndoState) error

type VersionGTE

type VersionGTE struct{ Impl *Provider }

VersionGTE — VersionGTE returns true if the installed version of name is >= version.

func (*VersionGTE) Do

func (*VersionGTE) Name

func (o *VersionGTE) Name() string

Jump to

Keyboard shortcuts

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