Documentation
¶
Overview ¶
Package updater implements auto-update checking and installation for DevClaw.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker periodically checks for new versions against a remote assets URL.
func NewChecker ¶
func NewChecker(currentVersion, assetsURL string, interval time.Duration, logger *slog.Logger) *Checker
NewChecker creates a new update checker. If currentVersion is "dev", the checker will not perform checks.
func (*Checker) CheckNow ¶
func (c *Checker) CheckNow() (UpdateInfo, error)
CheckNow performs an immediate update check. Supports both GitHub releases URLs and plain latest.txt endpoints.
func (*Checker) LastCheck ¶
func (c *Checker) LastCheck() UpdateInfo
LastCheck returns the result of the most recent update check (thread-safe).
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer handles downloading and installing new versions.
func NewInstaller ¶
NewInstaller creates a new installer.
func (*Installer) Install ¶
Install downloads the latest release and replaces the current binary. It performs a safe install with backup/rollback.
func (*Installer) InstallAndRestart ¶
InstallAndRestart performs Install followed by a PM2 restart.
type UpdateInfo ¶
type UpdateInfo struct {
Available bool `json:"available"`
CurrentVersion string `json:"current_version"`
LatestVersion string `json:"latest_version"`
CheckedAt time.Time `json:"checked_at"`
}
UpdateInfo holds the result of an update check.
type Version ¶
type Version struct {
Major, Minor, Patch int
// Pre is the number of commits after the tag (git-describe format: v0.0.4-9 → Pre=9).
// Zero means this is an exact tag match.
Pre int
Raw string
}
Version represents a parsed semantic version with optional git-describe metadata.
func ParseVersion ¶
ParseVersion parses a version string like "v1.2.3", "1.2.3", or "v1.2.3-9-gabcdef" into a Version.
func (Version) IsNewerThan ¶
IsNewerThan returns true if v is a newer version than other.