selfupdate

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedDownloadPrefixes = []string{
	"https://github.com/",
	"https://api.github.com/",
}

AllowedDownloadPrefixes controls which URL prefixes are accepted by DownloadAsset. Exported for test injection only.

View Source
var ReleaseURL = "https://api.github.com/repos/DeusData/codebase-memory-mcp/releases/latest"

ReleaseURL is the GitHub API endpoint for latest release. Exported for test injection.

Functions

func AssetName

func AssetName() string

AssetName returns the expected release asset name for the current platform.

func CompareVersions

func CompareVersions(a, b string) int

CompareVersions compares two semver strings (e.g. "0.2.1" vs "0.2.0"). Returns >0 if a > b, <0 if a < b, 0 if equal.

func DownloadAsset

func DownloadAsset(ctx context.Context, rawURL string) (io.ReadCloser, int64, error)

DownloadAsset downloads a release asset and returns the body reader and content length. Caller must close the returned ReadCloser.

func DownloadChecksums

func DownloadChecksums(ctx context.Context, release *Release) (map[string]string, error)

DownloadChecksums downloads and parses the checksums.txt file from a release. Returns a map of filename → hex-encoded SHA-256 hash.

Types

type Asset

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

Asset holds a single release artifact.

type Release

type Release struct {
	TagName string  `json:"tag_name"`
	Assets  []Asset `json:"assets"`
}

Release holds parsed GitHub release metadata.

func FetchLatestRelease

func FetchLatestRelease(ctx context.Context) (*Release, error)

FetchLatestRelease fetches release metadata from GitHub.

func (*Release) FindAsset

func (r *Release) FindAsset(name string) *Asset

FindAsset finds a release asset by name.

func (*Release) LatestVersion

func (r *Release) LatestVersion() string

LatestVersion returns the version string from the latest release (without "v" prefix).

Jump to

Keyboard shortcuts

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