agentspec

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 3 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNodeKind

func IsNodeKind(kind string) bool

IsNodeKind reports whether the kind is a node package manager (npm/pnpm/yarn/bun).

func NodeBatchUpdateCommand

func NodeBatchUpdateCommand(kind string, pkgs []string) []string

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

func ShouldLockKind(kind string) bool

ShouldLockKind reports whether updates of this kind mutate shared global state and must be serialized per manager.

func VersionSpec

func VersionSpec(v string) string

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.

func Resolve

func Resolve(agent agents.Agent, env Env) Resolved

Resolve decides how to update an agent given the detected environment, walking its strategies in order and returning the first applicable update command (or a reason it was skipped).

Jump to

Keyboard shortcuts

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