Documentation
¶
Overview ¶
Package pkg provides package management actions for the operation graph.
Index ¶
- type Provider
- func (p *Provider) CompensateInstall(state any) error
- func (p *Provider) CompensateRemove(state any) error
- func (p *Provider) CompensateUpgrade(_ any) error
- func (p *Provider) Install(packages []string, manager string, cask bool) (result []string, state map[string]any, err error)
- func (p *Provider) Installed(name string) (bool, error)
- func (p *Provider) NotInstalled(name string) (bool, error)
- func (p *Provider) Remove(packages []string, manager string, cask bool) (result []string, state map[string]any, err error)
- func (p *Provider) Update(manager string) (string, error)
- func (p *Provider) Upgrade(packages []string, manager string, cask bool) (result []string, state map[string]any, err error)
- func (p *Provider) VersionGTE(name, version string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
Provider provides platform-independent package management. All platform-specific behavior is delegated to the Platform injected at construction time from op.Context.Platform.
Compensable Forward methods return ([]string, map[string]any, error): the packages acted upon, the compensation receipt, and an error. The map is opaque to the executor, meaningful only to the corresponding Compensate* Backward method.
+devlore:access=both
func (*Provider) CompensateInstall ¶
CompensateInstall undoes an Install by removing packages that weren't already installed before the action.
func (*Provider) CompensateRemove ¶
CompensateRemove undoes a Remove by reinstalling the removed packages.
func (*Provider) CompensateUpgrade ¶
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) (result []string, state map[string]any, err 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 ¶
Installed returns true if the named package is installed.
Parameters:
- name: Package name to check
func (*Provider) NotInstalled ¶
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) (result []string, state map[string]any, err 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 ¶
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) (result []string, state map[string]any, err 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