Documentation
¶
Overview ¶
Package providers contains installation provider implementations.
Package providers contains installation provider implementations.
Package providers contains installation provider implementations.
Index ¶
- func FormatInstallError(manager, operation, stderr string) string
- func ProgressWriter(ctx context.Context) io.Writer
- func WithProgressWriter(ctx context.Context, w io.Writer) context.Context
- type BrewProvider
- func (p *BrewProvider) GetLatestVersion(ctx context.Context, method catalog.InstallMethodDef) (agent.Version, error)
- func (p *BrewProvider) Install(ctx context.Context, agentDef catalog.AgentDef, ...) (*Result, error)
- func (p *BrewProvider) IsAvailable() bool
- func (p *BrewProvider) Method() agent.InstallMethod
- func (p *BrewProvider) Name() string
- func (p *BrewProvider) Uninstall(ctx context.Context, inst *agent.Installation, method catalog.InstallMethodDef) error
- func (p *BrewProvider) Update(ctx context.Context, inst *agent.Installation, agentDef catalog.AgentDef, ...) (*Result, error)
- type NPMProvider
- func (p *NPMProvider) GetLatestVersion(ctx context.Context, method catalog.InstallMethodDef) (agent.Version, error)
- func (p *NPMProvider) Install(ctx context.Context, agentDef catalog.AgentDef, ...) (*Result, error)
- func (p *NPMProvider) IsAvailable() bool
- func (p *NPMProvider) Method() agent.InstallMethod
- func (p *NPMProvider) Name() string
- func (p *NPMProvider) Uninstall(ctx context.Context, inst *agent.Installation, method catalog.InstallMethodDef) error
- func (p *NPMProvider) Update(ctx context.Context, inst *agent.Installation, agentDef catalog.AgentDef, ...) (*Result, error)
- type NativeProvider
- func (p *NativeProvider) Install(ctx context.Context, agentDef catalog.AgentDef, ...) (*Result, error)
- func (p *NativeProvider) IsAvailable() bool
- func (p *NativeProvider) Method() agent.InstallMethod
- func (p *NativeProvider) Name() string
- func (p *NativeProvider) Uninstall(ctx context.Context, inst *agent.Installation, method catalog.InstallMethodDef) error
- func (p *NativeProvider) Update(ctx context.Context, inst *agent.Installation, agentDef catalog.AgentDef, ...) (*Result, error)
- type PipProvider
- func (p *PipProvider) GetLatestVersion(ctx context.Context, method catalog.InstallMethodDef) (agent.Version, error)
- func (p *PipProvider) Install(ctx context.Context, agentDef catalog.AgentDef, ...) (*Result, error)
- func (p *PipProvider) IsAvailable() bool
- func (p *PipProvider) Method() agent.InstallMethod
- func (p *PipProvider) Name() string
- func (p *PipProvider) Uninstall(ctx context.Context, inst *agent.Installation, method catalog.InstallMethodDef) error
- func (p *PipProvider) Update(ctx context.Context, inst *agent.Installation, agentDef catalog.AgentDef, ...) (*Result, error)
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatInstallError ¶
FormatInstallError formats an installation error with helpful hints based on the error content.
func ProgressWriter ¶ added in v1.2.0
ProgressWriter returns the writer associated with the context, or io.Discard if none was set. Callers should use the returned writer unconditionally.
func WithProgressWriter ¶ added in v1.2.0
WithProgressWriter returns a new context that carries the given writer. Providers use it to tee the subprocess stdout/stderr while they run, so callers can surface live output for long-running installs or updates.
Passing nil is a no-op: the returned context is the input context, so a previously attached writer is NOT cleared. To actually silence streaming after one was attached, start from a context that never had one. This asymmetry lets middleware attach a writer safely without worrying about downstream code accidentally clobbering it with nil.
Providers always still capture the full output into Result.Output, so callers that ignore the stream lose no information.
The returned writer is safe for concurrent calls to Write — providers use it to tee BOTH cmd.Stdout and cmd.Stderr, which os/exec writes to from separate goroutines. Internally Write calls serialize on a mutex so concurrent writes produce non-interleaved byte sequences per call.
Types ¶
type BrewProvider ¶
type BrewProvider struct {
// contains filtered or unexported fields
}
BrewProvider handles Homebrew-based installations.
func NewBrewProvider ¶
func NewBrewProvider(p platform.Platform) *BrewProvider
NewBrewProvider creates a new Homebrew provider.
func (*BrewProvider) GetLatestVersion ¶
func (p *BrewProvider) GetLatestVersion(ctx context.Context, method catalog.InstallMethodDef) (agent.Version, error)
GetLatestVersion returns the latest version of a brew package.
Results are cached process-wide with a short TTL to avoid re-running `brew info --json=v2 <pkg>` once per agent per refresh. Concurrent callers for the same package coalesce via a per-key sync.Once so only one subprocess is launched at a time.
func (*BrewProvider) Install ¶
func (p *BrewProvider) Install(ctx context.Context, agentDef catalog.AgentDef, method catalog.InstallMethodDef, force bool) (*Result, error)
Install installs an agent via Homebrew.
func (*BrewProvider) IsAvailable ¶
func (p *BrewProvider) IsAvailable() bool
IsAvailable returns true if brew is available.
func (*BrewProvider) Method ¶
func (p *BrewProvider) Method() agent.InstallMethod
Method returns the install method this provider handles.
func (*BrewProvider) Uninstall ¶
func (p *BrewProvider) Uninstall(ctx context.Context, inst *agent.Installation, method catalog.InstallMethodDef) error
Uninstall removes a Homebrew-installed agent.
func (*BrewProvider) Update ¶
func (p *BrewProvider) Update(ctx context.Context, inst *agent.Installation, agentDef catalog.AgentDef, method catalog.InstallMethodDef) (*Result, error)
Update updates a Homebrew-installed agent.
type NPMProvider ¶
type NPMProvider struct {
// contains filtered or unexported fields
}
NPMProvider handles npm-based installations.
func NewNPMProvider ¶
func NewNPMProvider(p platform.Platform) *NPMProvider
NewNPMProvider creates a new NPM provider.
func (*NPMProvider) GetLatestVersion ¶
func (p *NPMProvider) GetLatestVersion(ctx context.Context, method catalog.InstallMethodDef) (agent.Version, error)
GetLatestVersion returns the latest version of an npm package from the registry.
func (*NPMProvider) Install ¶
func (p *NPMProvider) Install(ctx context.Context, agentDef catalog.AgentDef, method catalog.InstallMethodDef, force bool) (*Result, error)
Install installs an agent via npm.
func (*NPMProvider) IsAvailable ¶
func (p *NPMProvider) IsAvailable() bool
IsAvailable returns true if npm is available.
func (*NPMProvider) Method ¶
func (p *NPMProvider) Method() agent.InstallMethod
Method returns the install method this provider handles.
func (*NPMProvider) Uninstall ¶
func (p *NPMProvider) Uninstall(ctx context.Context, inst *agent.Installation, method catalog.InstallMethodDef) error
Uninstall removes an npm-installed agent.
func (*NPMProvider) Update ¶
func (p *NPMProvider) Update(ctx context.Context, inst *agent.Installation, agentDef catalog.AgentDef, method catalog.InstallMethodDef) (*Result, error)
Update updates an npm-installed agent.
type NativeProvider ¶
type NativeProvider struct {
// contains filtered or unexported fields
}
NativeProvider handles native binary installations (shell scripts, direct downloads).
func NewNativeProvider ¶
func NewNativeProvider(p platform.Platform) *NativeProvider
NewNativeProvider creates a new native provider.
func (*NativeProvider) Install ¶
func (p *NativeProvider) Install(ctx context.Context, agentDef catalog.AgentDef, method catalog.InstallMethodDef, force bool) (*Result, error)
Install installs an agent via native method.
func (*NativeProvider) IsAvailable ¶
func (p *NativeProvider) IsAvailable() bool
IsAvailable returns true - native install is always available.
func (*NativeProvider) Method ¶
func (p *NativeProvider) Method() agent.InstallMethod
Method returns the install method this provider handles.
func (*NativeProvider) Name ¶
func (p *NativeProvider) Name() string
Name returns the provider name.
func (*NativeProvider) Uninstall ¶
func (p *NativeProvider) Uninstall(ctx context.Context, inst *agent.Installation, method catalog.InstallMethodDef) error
Uninstall removes a native-installed agent.
func (*NativeProvider) Update ¶
func (p *NativeProvider) Update(ctx context.Context, inst *agent.Installation, agentDef catalog.AgentDef, method catalog.InstallMethodDef) (*Result, error)
Update updates a native-installed agent.
type PipProvider ¶
type PipProvider struct {
// contains filtered or unexported fields
}
PipProvider handles pip/pipx/uv-based installations.
func NewPipProvider ¶
func NewPipProvider(p platform.Platform) *PipProvider
NewPipProvider creates a new pip provider.
func (*PipProvider) GetLatestVersion ¶
func (p *PipProvider) GetLatestVersion(ctx context.Context, method catalog.InstallMethodDef) (agent.Version, error)
GetLatestVersion returns the latest version of a pip package from PyPI.
func (*PipProvider) Install ¶
func (p *PipProvider) Install(ctx context.Context, agentDef catalog.AgentDef, method catalog.InstallMethodDef, force bool) (*Result, error)
Install installs an agent via pip/pipx/uv.
func (*PipProvider) IsAvailable ¶
func (p *PipProvider) IsAvailable() bool
IsAvailable returns true if pip, pipx, or uv is available.
func (*PipProvider) Method ¶
func (p *PipProvider) Method() agent.InstallMethod
Method returns the install method this provider handles.
func (*PipProvider) Uninstall ¶
func (p *PipProvider) Uninstall(ctx context.Context, inst *agent.Installation, method catalog.InstallMethodDef) error
Uninstall removes a pip/pipx/uv-installed agent.
func (*PipProvider) Update ¶
func (p *PipProvider) Update(ctx context.Context, inst *agent.Installation, agentDef catalog.AgentDef, method catalog.InstallMethodDef) (*Result, error)
Update updates a pip/pipx/uv-installed agent.
type Result ¶
type Result struct {
AgentID string
AgentName string
Method agent.InstallMethod
Version agent.Version
FromVersion agent.Version // For updates
InstallPath string
ExecutablePath string
Duration time.Duration
Output string
WasUpdated bool // For updates
}
Result represents the result of an install or update operation.