Documentation
¶
Index ¶
- Constants
- Variables
- func CompareVersionStrings(a, b string) (int, bool)
- func IsVersionOutdated(current, latest string) bool
- func LaunchBackgroundUpdateCheck() error
- func NormalizeVersion(v string) string
- func PerformUpdateCheck(ctx context.Context) error
- func RunUpgrade(ctx context.Context, currentVersion, targetVersion string, ...) error
- func SaveState(state *State) error
- func SetupUpdateChecks(rootCmd *cobra.Command, version string)
- func ShouldCheckForUpdates(state *State) bool
- func WarnIfOutdated(currentVersion string, state *State)
- type ReleaseInfo
- type State
Constants ¶
const ( SkipUpdateEnvVar = "TERM_LLM_SKIP_UPDATE_CHECK" RepoOwner = "samsaffron" RepoName = "term-llm" )
Variables ¶
var UpdateCheckCmd = &cobra.Command{ Use: updateCheckCommandArg, Short: "internal update check", Hidden: true, RunE: func(cmd *cobra.Command, args []string) error { if os.Getenv(SkipUpdateEnvVar) == "" { os.Setenv(SkipUpdateEnvVar, "1") } return PerformUpdateCheck(cmd.Context()) }, }
UpdateCheckCmd is the hidden command for background update checks
Functions ¶
func CompareVersionStrings ¶
CompareVersionStrings compares two version strings Returns -1 if a < b, 0 if equal, 1 if a > b
func IsVersionOutdated ¶
IsVersionOutdated returns true if current is older than latest
func LaunchBackgroundUpdateCheck ¶
func LaunchBackgroundUpdateCheck() error
LaunchBackgroundUpdateCheck spawns a background process to check for updates
func NormalizeVersion ¶
NormalizeVersion strips v prefix and any non-numeric suffixes
func PerformUpdateCheck ¶
PerformUpdateCheck fetches the latest release and updates state
func RunUpgrade ¶
func RunUpgrade(ctx context.Context, currentVersion, targetVersion string, stdout, stderr io.Writer) error
RunUpgrade performs the upgrade to the specified version (or latest if empty)
func SetupUpdateChecks ¶
SetupUpdateChecks initializes update checking on CLI startup
func ShouldCheckForUpdates ¶
ShouldCheckForUpdates returns true if enough time has passed since last check
func WarnIfOutdated ¶
WarnIfOutdated prints a warning if a newer version is available
Types ¶
type ReleaseInfo ¶
type ReleaseInfo struct {
TagName string `json:"tag_name"`
}
ReleaseInfo contains information about a GitHub release. Only TagName is populated by FetchLatestRelease (redirect-based detection).
func FetchLatestRelease ¶
func FetchLatestRelease(ctx context.Context) (*ReleaseInfo, error)
FetchLatestRelease gets the latest release tag from GitHub by following the releases/latest redirect. This avoids the GitHub API rate limit (60 req/hour for unauthenticated requests).