Documentation
¶
Overview ¶
Package agentspec builds the concrete update commands for an agent's chosen strategy. These are pure functions over the agent registry types; the resolver that decides which strategy applies (given the environment) lives in cmd/uca for now and calls into these builders.
Index ¶
- func IsNodeKind(kind string) bool
- func NodeBatchUpdateCommand(kind string, pkgs []string) []string
- func NodePackageName(strategies []agents.UpdateStrategy) string
- func NodeUpdateCommand(strat agents.UpdateStrategy) []string
- func ShouldLockKind(kind string) bool
- func VersionSpec(v string) string
- type Env
- type Resolved
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNodeKind ¶
IsNodeKind reports whether the kind is a node package manager (npm/pnpm/yarn/bun).
func NodeBatchUpdateCommand ¶
NodeBatchUpdateCommand builds one install command that updates several @latest packages at once under a single manager.
func NodePackageName ¶
func NodePackageName(strategies []agents.UpdateStrategy) string
NodePackageName returns the package name from an agent's first node strategy.
func NodeUpdateCommand ¶
func NodeUpdateCommand(strat agents.UpdateStrategy) []string
NodeUpdateCommand builds the single-package update command for a node strategy (honoring a pinned Version, else @latest).
func ShouldLockKind ¶
ShouldLockKind reports whether updates of this kind mutate shared global state and must be serialized per manager.
func VersionSpec ¶
VersionSpec returns the version selector for a package spec: a pinned version when set, otherwise "latest" (forced to avoid getting stuck on old minor/prerelease versions, common for 0.x CLIs).
Types ¶
type Env ¶
type Env interface {
HasBinary(name string) bool
HasNodeManager(kind string) bool
NodeManagerForBinary(name string) string
NodeBinHasBinary(kind, name string) bool
NodeManagerForPackage(pkg string) string
HasBrew() bool
BrewHas(formula string) bool
HasPython() bool
PipHas(pkg string) bool
HasUv() bool
UvHas(pkg string) bool
CodeCmd() string
VscodeHas(extID string) bool
HelpMatches(binary, contains string) bool
}
Env is the minimal environment-capability surface Resolve needs. *detect.Env satisfies it structurally, so cmd passes the concrete type without an adapter.
type Resolved ¶
type Resolved struct {
Cmd []string
Reason string
Method string
Detail string
VersionCmd []string
// Pkg is the package/formula identifier the update targets, used by --check to
// look up the latest version. Empty when latest is not knowable.
Pkg string
// Version is the pinned version for the resolved strategy (empty = @latest).
Version string
}
Resolved is the outcome of resolving an agent against the environment: the update command and how it was chosen.