version

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package version provides update checking against GitHub releases and semantic version comparison.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAsync

func CheckAsync(currentVersion string) tea.Cmd

CheckAsync returns a Bubble Tea command that checks for updates in background.

func IsCacheValid

func IsCacheValid(entry *CacheEntry, currentVersion string) bool

IsCacheValid checks if cache exists and is not expired. Also invalidates if user version changed (upgrade or downgrade).

func IsDevelopmentVersion

func IsDevelopmentVersion(v string) bool

IsDevelopmentVersion returns true for non-release versions.

func SaveCache

func SaveCache(entry *CacheEntry) error

SaveCache writes version check result to disk.

func UpdateCommand

func UpdateCommand(version string) string

UpdateCommand generates the go install command for updating. Returns empty string if version is invalid (prevents shell injection).

Types

type CacheEntry

type CacheEntry struct {
	LatestVersion  string    `json:"latestVersion"`
	CurrentVersion string    `json:"currentVersion"`
	CheckedAt      time.Time `json:"checkedAt"`
	HasUpdate      bool      `json:"hasUpdate"`
}

CacheEntry stores cached version check result.

func LoadCache

func LoadCache() (*CacheEntry, error)

LoadCache reads cached version check result from disk.

type CheckResult

type CheckResult struct {
	CurrentVersion string
	LatestVersion  string
	UpdateURL      string
	HasUpdate      bool
	Error          error
}

CheckResult holds the result of a version check.

func Check

func Check(currentVersion string) CheckResult

Check fetches the latest release from GitHub and compares versions.

type Release

type Release struct {
	TagName     string    `json:"tag_name"`
	PublishedAt time.Time `json:"published_at"`
	HTMLURL     string    `json:"html_url"`
}

Release represents a GitHub release response.

type UpdateAvailableMsg

type UpdateAvailableMsg struct {
	CurrentVersion string
	LatestVersion  string
	UpdateCommand  string
}

UpdateAvailableMsg is sent when a new version is available.

Jump to

Keyboard shortcuts

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