update

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package update provides version checking and self-update functionality.

Index

Constants

View Source
const (
	// GitHubRepo is the repository to check for updates
	GitHubRepo = "asheshgoplani/agent-deck"

	// CacheFileName stores the last update check result
	CacheFileName = "update-cache.json"

	// DefaultCheckInterval is the default check interval (1 hour)
	// Can be overridden via config.toml [updates] check_interval_hours
	DefaultCheckInterval = 1 * time.Hour
)

Variables

This section is empty.

Functions

func CheckForUpdateAsync

func CheckForUpdateAsync(currentVersion string) <-chan *UpdateInfo

CheckForUpdateAsync checks for updates in the background Returns a channel that will receive the result

func CompareVersions

func CompareVersions(v1, v2 string) int

CompareVersions compares two semantic versions Returns: -1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2

func FetchChangelog added in v0.8.86

func FetchChangelog() (string, error)

FetchChangelog fetches the CHANGELOG.md from GitHub

func FormatChangelogForDisplay added in v0.8.86

func FormatChangelogForDisplay(entries []ChangelogEntry) string

FormatChangelogForDisplay formats changelog entries for terminal display

func PerformUpdate

func PerformUpdate(downloadURL string) error

PerformUpdate downloads and installs the latest version

func SetCheckInterval added in v0.8.2

func SetCheckInterval(hours int)

SetCheckInterval sets the update check interval from config

Types

type Asset

type Asset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
	Size               int64  `json:"size"`
}

Asset represents a release asset (binary download)

type ChangelogEntry added in v0.8.86

type ChangelogEntry struct {
	Version string
	Date    string
	Content string
}

ChangelogEntry represents a single version's changelog

func GetChangesBetweenVersions added in v0.8.86

func GetChangesBetweenVersions(entries []ChangelogEntry, currentVersion, latestVersion string) []ChangelogEntry

GetChangesBetweenVersions returns changelog entries between two versions (exclusive of current, inclusive of latest)

func ParseChangelog added in v0.8.86

func ParseChangelog(content string) []ChangelogEntry

ParseChangelog parses CHANGELOG.md and returns entries for versions

type Release

type Release struct {
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	PublishedAt time.Time `json:"published_at"`
	HTMLURL     string    `json:"html_url"`
	Assets      []Asset   `json:"assets"`
}

Release represents a GitHub release

type UpdateCache

type UpdateCache struct {
	CheckedAt      time.Time `json:"checked_at"`
	LatestVersion  string    `json:"latest_version"`
	CurrentVersion string    `json:"current_version"`
	DownloadURL    string    `json:"download_url"`
	ReleaseURL     string    `json:"release_url"`
}

UpdateCache stores the last check result

type UpdateInfo

type UpdateInfo struct {
	Available      bool
	CurrentVersion string
	LatestVersion  string
	DownloadURL    string
	ReleaseURL     string
}

UpdateInfo contains information about an available update

func CheckForUpdate

func CheckForUpdate(currentVersion string, forceCheck bool) (*UpdateInfo, error)

CheckForUpdate checks if a new version is available Uses cache to avoid hitting GitHub API too frequently

Jump to

Keyboard shortcuts

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