Documentation
¶
Overview ¶
Package updatecheck reports whether a newer GitHub release of a CLI exists and how to upgrade it via the package manager that installed it. It never touches the binary — the actual upgrade is delegated to the package manager (see ADR-0005).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
Repo string // "owner/name"
BaseURL string // "" → https://api.github.com
Client *http.Client // nil → a client with a 5s timeout
}
Checker queries a GitHub repo's latest release.
type Hinter ¶
type Hinter struct {
Repo string // "owner/name"
Bin string // binary name: the hint label and brew/mise/scoop command
Module string // `go install` target path (used only when go-installed)
Current string // current version
CacheFile string // "" → always fetch (no cache)
BaseURL string // "" → https://api.github.com (test seam)
Client *http.Client // nil → default
Now func() time.Time // nil → time.Now (test seam)
}
Hinter prints a one-line upgrade hint when a newer release exists, fetching at most once per 24h (when CacheFile is set). Every error is swallowed — the hint must never break a normal run.
type InstallMethod ¶
type InstallMethod int
InstallMethod is how a binary was installed, inferred from its path.
const ( Unknown InstallMethod = iota Homebrew Mise Scoop GoInstall )
func DetectInstall ¶
func DetectInstall() InstallMethod
DetectInstall infers how the running executable was installed by resolving its real path and matching known package-manager locations.
func (InstallMethod) UpgradeCommand ¶
func (m InstallMethod) UpgradeCommand(bin, module string) string
UpgradeCommand returns the command to upgrade bin via this install method, or "" for Unknown (callers fall back to a generic message). module is the `go install` target path, used only for GoInstall.