versioncheck

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndNotify

func CheckAndNotify(ctx context.Context, w io.Writer, currentVersion string)

CheckAndNotify performs a version check and notifies the user if a newer version is available. This is the main entry point for the version check system. The function is silent on all errors to avoid interrupting CLI operations.

Types

type AutoUpdateAction added in v0.6.0

type AutoUpdateAction string

AutoUpdateAction describes the result of an update prompt.

func MaybeAutoUpdate added in v0.5.6

func MaybeAutoUpdate(ctx context.Context, w io.Writer, currentVersion, latestVersion string) AutoUpdateAction

MaybeAutoUpdate prints an update notification and offers an interactive upgrade. Silent on every failure path — it must never interrupt the CLI.

The same 3-option prompt (update / skip / skip until next version) is shown for every install manager that supports auto-installation (brew, mise, scoop, curl-bash). The only thing that varies between installers is the shell command interpolated into option 1.

If the installer command fails, a hint with the exact command is printed so the user can retry manually. The 24h version-check cache is not invalidated on failure: we don't want to re-prompt on every invocation while an upstream issue (network, auth, repo outage) is still in place.

When the prompt cannot be shown (kill switch set, or non-interactive environment like CI / agent subprocess / no TTY) the installer command is printed so the user still learns what to run manually.

On Windows + unknown install manager the POSIX curl-pipe-bash fallback can't auto-run and there's no native equivalent, so we point the user at the releases download page instead.

type GitHubRelease

type GitHubRelease struct {
	TagName    string `json:"tag_name"`
	Prerelease bool   `json:"prerelease"`
}

GitHubRelease represents the GitHub API response for a release.

type VersionCache

type VersionCache struct {
	LastCheckTime  time.Time `json:"last_check_time"`
	SkippedVersion string    `json:"skipped_version,omitempty"`
}

VersionCache represents the cached version check data.

Jump to

Keyboard shortcuts

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