update

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package update provides auto-update mechanism for the agentpair binary.

Index

Constants

View Source
const (
	// GitHubRepo is the repository for releases.
	GitHubRepo = "plexusone/agentpair"

	// ReleasesURL is the GitHub releases API endpoint.
	ReleasesURL = "https://api.github.com/repos/" + GitHubRepo + "/releases/latest"

	// CheckInterval is how often to check for updates.
	CheckInterval = 24 * time.Hour
)

Variables

View Source
var Version = "dev"

Version is the current version (set at build time).

Functions

func GetVersion

func GetVersion() string

GetVersion returns the current version.

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.

type CheckResult

type CheckResult struct {
	UpdateAvailable bool
	CurrentVersion  string
	LatestVersion   string
	DownloadURL     string
	ReleaseNotes    string
}

CheckResult contains the result of an update check.

type Release

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

Release represents a GitHub release.

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater handles checking and applying updates.

func New

func New(currentVersion string) *Updater

New creates a new updater.

func (*Updater) Check

func (u *Updater) Check(ctx context.Context) (*CheckResult, error)

Check checks for available updates.

func (*Updater) PrintUpdateNotice

func (u *Updater) PrintUpdateNotice(ctx context.Context)

PrintUpdateNotice prints a notice if an update is available.

func (*Updater) ShouldCheck

func (u *Updater) ShouldCheck() bool

ShouldCheck returns true if enough time has passed since last check.

func (*Updater) Update

func (u *Updater) Update(ctx context.Context, downloadURL string) error

Update downloads and installs the update.

Jump to

Keyboard shortcuts

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