Skip to content

Move install logic into the CLI; add scratchwork update#28

Open
koomen wants to merge 1 commit into
mainfrom
worktree-cli-install-command
Open

Move install logic into the CLI; add scratchwork update#28
koomen wants to merge 1 commit into
mainfrom
worktree-cli-install-command

Conversation

@koomen

@koomen koomen commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • scratchwork install (new): installs the currently running compiled binary into --dir, SCRATCHWORK_INSTALL_DIR, or ~/.local/bin — staged copy + atomic rename, chmod, a version run check, and PATH advice. Refuses source runs (detected via the compiled binary's /$bunfs/ entrypoint).
  • scratchwork update (new): self-update from GitHub Releases — fetches checksums.txt (honoring SCRATCHWORK_DOWNLOAD_BASE), resolves latest or a SCRATCHWORK_VERSION pin, 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.sh is 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.
  • Docs updated: install.md (manual steps end in ./scratchwork install, new Updating section), README, RELEASING.md smoke step, CHANGELOG, and scratchwork 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.ts now runs the end-to-end cases against the real compiled binary (cli/dist/scratchwork): the full install.shscratchwork install loop including PATH advice, plus scratchwork update success (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 ci passes in all 14 workspaces.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant