update

package
v1.0.98 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient *http.Client

DefaultClient is the HTTP client used for npm registry requests. Override in tests with an httptest server client.

Functions

func FetchManifest added in v1.0.98

FetchManifest fetches the configured manifest and records its target in the update cache. Callers should use this entry point instead of fetching a manifest directly so a successful explicit check resets the cache TTL.

func RefreshCache

func RefreshCache(ctx context.Context, currentVersion string)

RefreshCache fetches the configured target and updates the local cache. No-op if the cache is still fresh (< 24h). Safe to call from a goroutine.

func SetPending

func SetPending(info *UpdateInfo)

SetPending stores the update info for consumption by output decorators.

Types

type Target added in v1.0.98

type Target struct {
	Version string
	Exact   bool
}

Target describes the active source's desired CLI version.

func FetchTarget added in v1.0.98

func FetchTarget(ctx context.Context) (Target, error)

FetchTarget synchronously queries the active update source and refreshes the local cache. It is intended for explicit checks such as update and doctor.

func FetchTargetForSource added in v1.0.98

func FetchTargetForSource(ctx context.Context, src distribution.Source) (Target, error)

FetchTargetForSource queries an already-resolved source, refreshes the local cache, and does not consult the extension registry again.

func (Target) Available added in v1.0.98

func (t Target) Available(current string) bool

Available reports whether the target should be offered for current.

type UpdateInfo

type UpdateInfo struct {
	Current string `json:"current"`
	Latest  string `json:"latest"`
	Source  string `json:"source,omitempty"`
}

UpdateInfo holds version update information.

func CheckCached

func CheckCached(ctx context.Context, currentVersion string) *UpdateInfo

CheckCached checks the local cache only (no network). Always fast.

func GetPending

func GetPending() *UpdateInfo

GetPending returns the pending update info, or nil.

func (*UpdateInfo) Message

func (u *UpdateInfo) Message() string

Message returns a concise update notification including the canonical fix command. Aligned with skillscheck.StaleNotice.Message style so AI agents can parse a unified "run: lark-cli update" hint across both notice types.

Jump to

Keyboard shortcuts

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