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 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 ¶
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.