update

package
v0.2.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package update finds, installs, and restarts onto codeaf releases.

Index

Constants

View Source
const (
	// CurlCommand is the independent installation road shown at launch beside
	// /update and after a failed or unavailable in-place update. IT IS THE
	// SUPPORTED LINE, NOT THE SCRIPT UNDER IT: agentfield.ai/get/codeaf serves
	// scripts/install.sh from main, and the address is the one a person can
	// remember and the one every other place codeaf documents spells, so a
	// launch line and the README can never hand out two different roads.
	CurlCommand = "curl -fsSL https://agentfield.ai/get/codeaf | bash"

	NoUpdateCheckEnv  = "CODEAF_NO_UPDATE_CHECK"
	GitHubAPIEnv      = "CODEAF_GITHUB_API"
	GitHubDownloadEnv = "CODEAF_GITHUB_DOWNLOAD"
)

Variables

This section is empty.

Functions

func ChannelTag

func ChannelTag(channel, date, sha string) (string, error)

ChannelTag forms a dev or staging tag from a date and revision.

func CleanupOld

func CleanupOld(string)

CleanupOld removes nothing on systems where the running executable can be replaced directly.

func CleanupOldRunning

func CleanupOldRunning(func() (string, error))

CleanupOldRunning does nothing where replacing a running executable leaves no backup. In particular, it does not resolve the executable during launch.

func CompareSemverTags

func CompareSemverTags(left, right string) (int, bool)

CompareSemverTags orders stable and release-candidate tags. A stable tag follows every release candidate on its own version line.

func ExecutableTarget

func ExecutableTarget(executable func() (string, error)) (string, error)

ExecutableTarget resolves the running binary before an installer replaces it.

func Kind

func Kind(tag string) string

Kind names the release channel encoded by a tag.

func NextSemverTag

func NextSemverTag(tags []string, channel, component string) (string, error)

NextSemverTag returns the next stable or release-candidate tag.

func Restart

func Restart(plan Plan) error

Restart replaces this process after the terminal has been restored.

func RestartArgs

func RestartArgs(original []string, transcript string) []string

RestartArgs keeps the original launch shape and points it at this transcript.

func ValidDate

func ValidDate(value string) bool

ValidDate reports whether a date has the channel tag's YYYYMMDD shape.

func ValidSHA

func ValidSHA(value string) bool

ValidSHA reports whether a revision can form a channel tag.

Types

type Available

type Available struct {
	Latest  string
	Running string
}

Available is the stable release comparison shown at launch or by --check.

func CheckLaunch

func CheckLaunch(ctx context.Context, options CheckOptions) (Available, bool)

CheckLaunch silently checks the newest stable release when this build is a stable or release-candidate build. Every failure is absence at this surface.

func (Available) Newer

func (a Available) Newer() bool

Newer reports whether the selected stable release supersedes this build.

func (Available) Notice

func (a Available) Notice() string

Notice is the one launch line carrying both update roads.

type CheckOptions

type CheckOptions struct {
	Running    string
	ProfileDir string
	Client     *Client
	Now        func() time.Time
	Disabled   bool
}

CheckOptions supplies the launch policy's disk, clock, and release client.

type Choice

type Choice struct {
	Channel string
	Version string
}

Choice selects one release channel or one exact tag.

type Client

type Client struct {
	HTTP         *http.Client
	APIBase      string
	DownloadBase string
	Token        string
	Revision     string
}

Client talks to the release API and release asset host.

func NewClient

func NewClient(revision string, timeout time.Duration) *Client

NewClient builds the release client from the same mirror and token inputs as the shell installer. The timeout covers the whole request, including bodies.

func (*Client) Select

func (c *Client) Select(ctx context.Context, choice Choice) (Release, error)

Select resolves a channel with the same timestamp law as the shell installer.

type InstallOptions

type InstallOptions struct {
	Client  *Client
	Release Release
	Target  string
	GOOS    string
	GOARCH  string
}

InstallOptions describes one in-place replacement.

type InstallResult

type InstallResult struct {
	Release Release
	Path    string
}

InstallResult is the release and executable path that are ready to restart.

func Install

func Install(ctx context.Context, options InstallOptions) (InstallResult, error)

Install downloads, checks, and atomically replaces one executable.

type Plan

type Plan struct {
	Path string
	Args []string
}

Plan is the executable and arguments a restored terminal restarts with.

type RCTag

type RCTag struct {
	Base    Version
	Counter int
}

RCTag is a release candidate and the stable line it belongs to.

func ParseRC

func ParseRC(tag string) (RCTag, bool)

ParseRC parses a release-candidate tag.

type Release

type Release struct {
	Tag        string
	Repository string
}

Release is one selected GitHub release and the repository that answered.

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version is the stable semantic part of a release tag.

func ParseStable

func ParseStable(tag string) (Version, bool)

ParseStable parses a stable release tag.

func (Version) Bump

func (v Version) Bump(component string) (Version, error)

Bump advances one semantic component.

func (Version) Compare

func (v Version) Compare(other Version) int

Compare orders stable semantic versions.

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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