Move install logic into the CLI; add scratchwork update#28
Open
koomen wants to merge 1 commit into
Open
Conversation
scratchwork install owns everything after download + verification: install dir resolution, atomic placement, run check, and PATH advice. scratchwork update self-replaces the binary from GitHub Releases with checksum verification (SCRATCHWORK_VERSION pins). install.sh becomes a thin bootstrap that downloads, verifies, extracts, and delegates to `scratchwork install`. check-install-sh.ts now runs the end-to-end cases against the real compiled binary, including update self-replace, up-to-date, and tamper rejection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
scratchwork install(new): installs the currently running compiled binary into--dir,SCRATCHWORK_INSTALL_DIR, or~/.local/bin— staged copy + atomic rename, chmod, aversionrun check, and PATH advice. Refuses source runs (detected via the compiled binary's/$bunfs/entrypoint).scratchwork update(new): self-update from GitHub Releases — fetcheschecksums.txt(honoringSCRATCHWORK_DOWNLOAD_BASE), resolves latest or aSCRATCHWORK_VERSIONpin, no-ops when current, otherwise downloads the platform asset, verifies its SHA-256, extracts in a scoped temp dir, and atomically replaces the running binary in place.install.shis now a thin bootstrap: platform mapping, tool checks, checksums fetch, download, checksum verification, extraction — then hands off with"$tmp/scratchwork" install. Everything after verification lives in the CLI.install.md(manual steps end in./scratchwork install, new Updating section), README, RELEASING.md smoke step, CHANGELOG, andscratchwork help install|update.Trust model is unchanged from
install.sh: checksums and assets come from the same origin over HTTPS (integrity, not authenticity).Testing
scripts/check-install-sh.tsnow runs the end-to-end cases against the real compiled binary (cli/dist/scratchwork): the fullinstall.sh→scratchwork installloop including PATH advice, plusscratchwork updatesuccess (asserting the inode changed), already-up-to-date, and tampered-checksum rejection. sh-only cases (pinned version, checksum rejection, uname→target mapping) keep the fast fake-binary fixture, pinned to an all-fake release so a foreign-platform asset never executes.bun run cipasses in all 14 workspaces.🤖 Generated with Claude Code