update

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package update implements the core of `abcd update` (itd-130 / spc-32): a user-invoked fetch/verify/swap for the PATH-installed binary. It is adr-38 tier 2 — the verb's documented meaning IS the fetch; nothing here runs implicitly — and it completes a chosen update (tier 3): the tag is named before anything is replaced, the asset is verified against the same release's checksums.txt, and the swap is atomic in the target's directory. The transport is pinned: no proxy, no CA overrides from the environment, redirects only onto the release origin's own hosts, every hop re-checked under the urlguard policy. Transport-agnostic (adr-23): everything returns a structured Report; the CLI renders it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action is the outcome class a Report carries.

const (
	ActionSwapped Action = "swapped"
	ActionCurrent Action = "already-current"
	ActionRefused Action = "refused"
)

type Refusal

type Refusal struct {
	Shape  string `json:"shape"`
	Detail string `json:"detail"`
	Remedy string `json:"remedy"`
}

Refusal is a named no: the shape that refused, why, and the remedy. Every refusal is loud and names its way out (the itd-130 dispatch contract).

func Plan

func Plan(t ahoy.UpdateTarget) *Refusal

Plan maps the resolved PATH target onto the spc-32 dispatch table: only a regular file outside a package manager's tree proceeds; every other shape is a refusal naming the mechanism that owns it.

type Report

type Report struct {
	Origin     string   `json:"origin"`
	Tag        string   `json:"tag,omitempty"`
	Asset      string   `json:"asset,omitempty"`
	Digest     string   `json:"digest,omitempty"`
	TargetPath string   `json:"target_path,omitempty"`
	OldVersion string   `json:"old_version,omitempty"`
	NewVersion string   `json:"new_version,omitempty"`
	Action     Action   `json:"action"`
	EnvIgnored []string `json:"env_ignored,omitempty"`
	Refusal    *Refusal `json:"refusal,omitempty"`
}

Report is the update receipt: origin, tag, digest, and what happened. It prints in both TTY and piped modes — silence is only ever about progress.

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater fetches and applies releases from one pinned origin.

func NewGitHubUpdater

func NewGitHubUpdater() *Updater

NewGitHubUpdater builds the updater as it ships: the pinned origin, the full urlguard policy, and GitHub's own asset hosts as the only legal redirect targets.

func (*Updater) Apply

func (u *Updater) Apply(target, tag string, progress io.Writer) (Report, error)

Apply completes the chosen update: prove the target file is abcd's by provenance (its digest appears in a published release's checksums.txt), download the tag's asset, verify it against the same release's manifest, and swap atomically. It never leaves a partial file: verification happens before anything at the target path is touched. The old version is DERIVED — the release whose manifest matches the on-disk bytes — never read from the running binary, which may not be the file being replaced.

func (*Updater) ResolveTag

func (u *Updater) ResolveTag(requested string) (string, error)

ResolveTag validates an explicit tag, or resolves `releases/latest` when none is given — the one discovery this verb performs, and only because the user typed the verb (adr-38 tier 2).

Jump to

Keyboard shortcuts

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