update

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package update checks the npm registry for newer Puzzle CLI releases and caches the result for passive notifications.

Index

Constants

This section is empty.

Variables

View Source
var CacheDir string

CacheDir overrides the directory containing update-check.json. When empty, Puzzle uses <os.UserCacheDir()>/puzzle. Tests may redirect it to a temp dir.

Functions

func CheckPassive

func CheckPassive(current string) (string, bool)

CheckPassive returns a newer cached version, when one exists, and refreshes stale cache data in the background. It never blocks on or reports registry errors.

func Compare

func Compare(a, b string) (int, error)

Compare compares two supported semantic versions, returning -1, 0, or 1.

func FetchLatest

func FetchLatest(timeout time.Duration) (string, error)

FetchLatest fetches the latest published @magic-spells/puzzle version.

func WriteCache

func WriteCache(latest string, checkedAt time.Time) error

WriteCache records a successful registry check.

Types

type Cache

type Cache struct {
	CheckedAt time.Time
	Latest    string
}

Cache is the last successful registry check.

func ReadCache

func ReadCache() (Cache, error)

ReadCache reads the cached registry result.

func (Cache) Stale

func (c Cache) Stale(now time.Time) bool

Stale reports whether the cached check is at least 24 hours old.

Jump to

Keyboard shortcuts

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