Add auto-update feature behind opt-in global setting#981
Add auto-update feature behind opt-in global setting#981gtrrz-victor wants to merge 6 commits intomainfrom
Conversation
Entire-Checkpoint: 5e0e77648a11
The call chain from PostCommit passes an unbounded context, so workingTreeMatchesCommit could block forever on a hung git process. Thread the caller's context through and wrap it with a 5s timeout, matching the pattern used by resolveWorktreeBranchGit for similar local git operations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 8b5b4eca788e
Offers codex-style "update now?" UX once per day after the existing
version check detects a newer release. Default stays off so nothing
changes for users who haven't opted in.
- New ~/.config/entire/settings.json with `auto_update: off|prompt|auto`
(default off).
- install.sh now records install provenance at ~/.config/entire/install.json
so "auto" mode can trust the resolved installer command. Legacy path
heuristic remains the fallback for notification-only.
- `entire auto-update {status|enable|disable|set <mode>}` manages the flag.
- `entire update [--yes] [--check-only]` runs the installer on demand.
- Guardrails: TTY + non-CI + kill-switch (ENTIRE_NO_AUTO_UPDATE) required;
"auto" additionally requires provenance-resolved command, a 24h release
soak, and 24h backoff after any failure.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: a5512c4eb581
There was a problem hiding this comment.
Pull request overview
Adds an opt-in, machine-wide auto-update mechanism to Entire CLI by introducing global settings + installer provenance so the CLI can safely resolve the correct updater command (brew/scoop/install.sh) and optionally execute it after the daily version check.
Changes:
- Introduce global settings at
~/.config/entire/settings.jsonwithauto_updatemodes (off|prompt|auto) and addentire auto-update ...management command. - Add
entire update [--yes] [--check-only]and implement provenance-based update command resolution via~/.config/entire/install.json(with legacy executable-path fallback). - Extend version check flow to fetch full release metadata and optionally trigger auto-update; add guardrail/backoff/soak logic and tests.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/install.sh | Writes install provenance (~/.config/entire/install.json) after successful install. |
| docs/architecture/install-provenance.md | Documents provenance file format and update-command mapping. |
| docs/architecture/auto-update.md | Documents auto-update settings, guardrails, and behavior. |
| cmd/entire/cli/versioncheck/versioncheck.go | Switches version fetch to return GitHubRelease, adds provenance-based update command resolution. |
| cmd/entire/cli/versioncheck/types.go | Extends cache + release types; adds InstallProvenance and new cache fields. |
| cmd/entire/cli/versioncheck/autoupdate.go | Implements auto-update execution path + RunUpdateNow. |
| cmd/entire/cli/versioncheck/autoupdate_test.go | Adds tests for auto-update guardrails/soak/backoff and manual update path. |
| cmd/entire/cli/versioncheck/versioncheck_test.go | Updates existing tests for new release-fetch APIs; adds provenance-based update hint tests. |
| cmd/entire/cli/settings/global.go | Adds global settings read/write helpers + validation. |
| cmd/entire/cli/settings/global_test.go | Tests global settings defaults, persistence, and validation. |
| cmd/entire/cli/auto_update.go | Adds `entire auto-update {status |
| cmd/entire/cli/auto_update_test.go | Tests auto-update CLI command behavior and persistence. |
| cmd/entire/cli/update.go | Adds entire update command wrapper around RunUpdateNow. |
| cmd/entire/cli/update_test.go | Tests entire update --check-only output using seeded provenance. |
| cmd/entire/cli/root.go | Registers new auto-update and update commands. |
| cmd/entire/cli/strategy/content_overlap.go | Uses git diff --quiet to avoid CRLF normalization false-positives when deciding carry-forward files. |
| cmd/entire/cli/strategy/content_overlap_test.go | Adds regression test for core.autocrlf normalized working tree. |
| runErr := runInstaller(ctx, cmdStr) | ||
| recordUpdateAttempt(ctx, runErr == nil) | ||
| if runErr != nil { | ||
| fmt.Fprintf(w, "Update failed: %v\n", runErr) |
There was a problem hiding this comment.
MaybeAutoUpdate is documented as being silent on error paths, but when runInstaller fails it prints Update failed: ... to w. This can add unexpected user-facing output on failures; if the goal is “never interrupt the CLI”, consider logging the error and returning without printing (or only printing in prompt mode).
| fmt.Fprintf(w, "Update failed: %v\n", runErr) | |
| logging.Debug(ctx, "auto-update: installer failed", "error", runErr.Error(), "command", cmdStr) |
# Conflicts: # cmd/entire/cli/versioncheck/versioncheck.go # cmd/entire/cli/versioncheck/versioncheck_test.go # scripts/install.sh
Replaces the tri-state mode, global settings file, and two dedicated
subcommands with a single interactive confirm right after the existing
"version available" notification. Declining skips; accepting runs the
same command the notification already prints. The 24h version-check
cache prevents the prompt from repeating more than once per day.
Removed:
- `entire auto-update {status|enable|disable|set}` subcommand
- `entire update [--yes|--check-only]` subcommand
- `GlobalSettings` / ~/.config/entire/settings.json file
- `auto_update` tri-state (off | prompt | auto)
- 24h release soak, failed-attempt retry cooldown
- `VersionCache.LastUpdateAttempt*`, `GitHubRelease.PublishedAt`
Kept:
- TTY + CI + `ENTIRE_NO_AUTO_UPDATE` kill-switch guardrails
- `sh -c` / `cmd /C` installer exec with streamed stdio
- Test seams for `runInstaller`, `stdoutIsTerminal`, `confirmUpdate`
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: e6958d9551ac
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 39034c3. Configure here.
| // Show notification and offer an interactive upgrade when outdated | ||
| if isOutdated(currentVersion, latestVersion) { | ||
| printNotification(w, currentVersion, latestVersion) | ||
| MaybeAutoUpdate(ctx, w, currentVersion) |
There was a problem hiding this comment.
Existing CheckAndNotify tests lack auto-update guard
Medium Severity
The new MaybeAutoUpdate call in CheckAndNotify means existing tests like TestCheckAndNotify_PrintsNotificationWhenOutdated now reach the real confirmUpdate / realConfirmUpdate code path. setupCheckAndNotifyTest never sets ENTIRE_NO_AUTO_UPDATE, never mocks stdoutIsTerminal, and never mocks confirmUpdate. The only thing preventing an interactive huh prompt from hanging these tests is the assumption that term.IsTerminal(os.Stdout.Fd()) returns false under go test — which is environment-dependent and fragile. Setting t.Setenv(envKillSwitch, "1") in setupCheckAndNotifyTest (or mocking the seams) would make the tests robust regardless of TTY state.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 39034c3. Configure here.
|
Superseded by #997 — rebuilt on top of latest main with a clean single-commit history (drops the two unrelated content_overlap commits). |


Example
Summary
versioncheck.updateCommand(current)resolves to (brew upgrade --cask entire[@nightly],mise upgrade entire,scoop update entire/cli, or the curl-pipe-bash fallback). stdin/stdout/stderr stream through so installer prompts and progress reach the user.CImust be empty,ENTIRE_NO_AUTO_UPDATE=1is a kill switch.Test plan
mise run checkgreen locally (unit + integration + canary)Non-goals
See
docs/architecture/auto-update.md.🤖 Generated with Claude Code
Note
Medium Risk
Adds an interactive flow that can shell out to OS installer commands (e.g.,
brew/sh/cmd) and also introducesgit diffsubprocess usage for checkpoint carry-forward detection, so behavior now depends on external tooling and environment conditions.Overview
When the daily version check detects the CLI is outdated, it now prompts interactively to install the update and (on confirmation) runs the resolved installer command via a subprocess, with guardrails for non-TTY,
CI, andENTIRE_NO_AUTO_UPDATE.Checkpoint carry-forward detection is adjusted to first consult
git diff --quiet(with a short timeout) before byte-level hashing, preventing false “remaining changes” when Git clean/smudge filters likecore.autocrlfnormalize line endings; corresponding tests and anauto-updatearchitecture doc are added.Reviewed by Cursor Bugbot for commit 39034c3. Configure here.