versioncheck

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 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.

func MaybeAutoUpdate added in v0.5.6

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

MaybeAutoUpdate offers an interactive upgrade after the standard "version available" notification has been printed. Silent on every failure path — it must never interrupt the CLI.

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.

Types

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"`
}

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