Documentation
¶
Overview ¶
Package upgrade implements `codegraph upgrade` (CLI-02, D-11..D-14): resolve the target release version from GitHub Releases, download and verify its sigstore-go signature bundle IN-PROCESS (D-12 — never shell out to a cosign CLI), and only on successful verification atomically replace the running binary (D-13). This is the only intentional network path in the whole binary (D-15/telemetry) and the project's first cryptographic-verification code (T-06-06-01/T-06-06-02).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes `codegraph upgrade` end to end: resolve latest → (Check? report and return, no download) → refuse a non-writable targetPath BEFORE downloading (D-13) → download → verify (a non-nil error is FATAL and Run NEVER falls through to swap — Pitfall 7, T-06-06-01/02) → swap. targetPath is the self-replace target; the caller (internal/cli/ upgrade.go) resolves it via os.Executable() so Run itself stays fully testable without touching the real running binary.
Types ¶
type Options ¶
type Options struct {
// Check, when true, resolves and reports the latest version WITHOUT
// downloading, verifying, or swapping anything (D-11).
Check bool
// Version pins a specific release tag to install; empty means "the
// resolved latest."
Version string
// Force, when true, bypasses the same-version no-op guard and forces a
// full download → verify → swap reinstall even when the resolved
// target already matches currentVersion. It does NOT affect
// verification in any way — verify() remains an unconditional,
// fail-closed step before every swap regardless of Force
// (T-08-03-01).
Force bool
// Out receives human-readable status lines (the --check report, the
// final "upgraded to vX" line). Defaults to io.Discard if nil.
Out io.Writer
// contains filtered or unexported fields
}
Options configures a single upgrade.Run invocation (D-11). The four unexported func fields are the injectable seams described above — zero value (nil) means "use the real implementation."