Conversation
Ships two pieces:
1. `oc update` — fetches the latest GitHub release (oc-<goos>-<goarch>
asset), verifies its SHA256 against checksums.txt, and atomically
replaces the running binary via rename(2). Flags:
--check report whether an update is available, don't install
--yes skip the confirmation prompt
Refuses to self-update dev builds. Gives a clear error when the
binary path isn't user-writable.
2. A background update-check hook in PersistentPostRun: once every 24h
(cached to $XDG_CACHE_HOME/opencomputer/update-check.json), prints a
one-line nag to stderr when a newer release is available. Silent for
dev builds, non-TTY stderr, and when OC_NO_UPDATE_CHECK=1; skipped
for `oc update`, `oc help`, and shell-completion scaffolding. 2s
network timeout so a slow/blocked GitHub API never slows down the
CLI.
No server changes. Release pipeline already produces the assets this
consumes (.github/workflows/release-cli.yml publishes oc-<os>-<arch>
binaries + checksums.txt on every push to main).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two CLI self-maintenance pieces.
1.
oc updateFetches the latest release from GitHub (
diggerhq/opencomputer), picks the asset matchingruntime.GOOS/GOARCH(oc-linux-amd64,oc-darwin-arm64, etc.), verifies its SHA256 against the release'schecksums.txt, and atomically replaces the running binary viarename(2).Flags:
--check— report whether an update is available, don't install--yes— skip the confirmation promptBehavior:
Version == "dev") — you'd overwrite your local dev binary with a published release, which is rarely what you want.os.WriteFileto a sibling.newpath +os.Rename, so there's no window where the binary is half-written.2. Background update-check
New
PersistentPostRunhook that prints a one-line nag to stderr when a newer release is available:Rules:
$XDG_CACHE_HOME/opencomputer/update-check.json.OC_NO_UPDATE_CHECK=1.oc update,oc help, and shell-completion scaffolding.No server changes
The release pipeline (
.github/workflows/release-cli.yml) already publishesoc-<os>-<arch>binaries +checksums.txton every push to main. This PR is a pure client against that existing surface.Test plan
oc update --checkon a dev build → prints current/latest, "dev build — skipping update"oc update --checkon a build older than latest → prints "update available: run `oc update`..."oc update --checkon a build equal to latest → prints "already up to date"oc update --yeson an older build → downloads, verifies SHA, replaces;oc --versionreports the new versionoc updatewithout--yes→ prompts; empty input or "y" proceeds, anything else abortsoc updateon a read-only binary (e.g. system /usr/local/bin without sudo) → clear permission error, no partial writeoc sandbox lsin a real terminal with an older version → nag line appears on stderr onceoc sandbox ls 2>/dev/null→ nag suppressed (non-TTY stderr)OC_NO_UPDATE_CHECK=1 oc sandbox ls→ nag suppressedoc sandbox lswithin 24h → uses cached check (no network call)🤖 Generated with Claude Code