Skip to content

Add inline auto-update prompt after version notification#997

Open
gtrrz-victor wants to merge 9 commits intomainfrom
auto-update
Open

Add inline auto-update prompt after version notification#997
gtrrz-victor wants to merge 9 commits intomainfrom
auto-update

Conversation

@gtrrz-victor
Copy link
Copy Markdown
Contributor

@gtrrz-victor gtrrz-victor commented Apr 21, 2026

https://entire.io/gh/entireio/cli/trails/e09fcff9bd93

Example

Screenshot 2026-04-21 at 5 00 01 pm

Summary

  • When the existing daily version check flags an outdated release, the CLI prints the usual notification and then asks "Install the new version now? [Y/n]".
  • Accepting runs whatever command 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.
  • Declining skips the upgrade; the 24h version-check cache keeps the prompt from repeating more than once per day.
  • Guardrails: stdout must be a TTY, CI must be empty, ENTIRE_NO_AUTO_UPDATE=1 is a kill switch.

Test plan

  • mise run check green locally (unit + integration + canary)
  • Unit: TTY gate, CI gate, kill-switch, user-declines, happy path, installer failure
  • Manual end-to-end on a real outdated brew install (reviewer)
  • Windows scoop path verification (deferred)

Non-goals

  • No silent auto-install mode — prompt is always interactive.
  • No persisted preference / subcommands — kill-switch env is the escape hatch.
  • No self-built binary download; shells out to the native installer.

See docs/architecture/auto-update.md.

Replaces #981 (clean history — single commit on top of main with only the auto-update files).

🤖 Generated with Claude Code


Note

Medium Risk
Introduces a new interactive prompt and executes installer commands via sh -c/cmd /C, which could affect UX or fail in edge environments; guardrails and tests reduce but don’t eliminate runtime risk.

Overview
When the daily version check detects the CLI is outdated, it now follows the existing notification with an interactive Y/N prompt to install the new version, and on confirmation shells out to the resolved installer command (brew/mise/scoop/curl), streaming stdin/stdout/stderr so prompts and progress are visible.

The prompt is skipped silently when non-interactive (no TTY) or when ENTIRE_NO_AUTO_UPDATE is set, and failures are non-blocking (debug-logged or printed as a simple update failure message). Adds unit tests for the auto-update flow and documents the behavior in docs/architecture/auto-update.md.

Reviewed by Cursor Bugbot for commit 5872166. Configure here.

When the existing daily version check detects a newer release, the CLI
prints the usual notification and then asks the user "Install the new
version now? [Y/n]". Accepting runs whatever command
versioncheck.updateCommand(current) resolves to, streaming stdio so the
user sees the installer. Declining skips; the 24h version-check cache
prevents re-prompts within a day.

Guardrails: TTY + empty CI env + ENTIRE_NO_AUTO_UPDATE kill switch.
No subcommands, no settings file, no silent auto-install.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: f880b34689b1
Copilot AI review requested due to automatic review settings April 21, 2026 15:29
@gtrrz-victor gtrrz-victor marked this pull request as ready for review April 21, 2026 15:32
@gtrrz-victor gtrrz-victor requested a review from a team as a code owner April 21, 2026 15:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an interactive inline auto-update flow to the existing daily version check so that, when an outdated release is detected, the CLI can optionally run the appropriate installer command (brew/mise/scoop/curl) immediately.

Changes:

  • Invoke a new MaybeAutoUpdate prompt after printing the “newer version available” notification.
  • Add the auto-update implementation that prompts the user and shells out to the resolved installer command with stdio passthrough.
  • Add unit tests and architecture documentation for the new behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/architecture/auto-update.md Documents the new post-notification auto-update prompt and its guardrails.
cmd/entire/cli/versioncheck/versioncheck.go Calls MaybeAutoUpdate after printing the outdated-version notification; minor comment tweaks.
cmd/entire/cli/versioncheck/autoupdate.go Implements interactive confirm prompt + installer subprocess execution.
cmd/entire/cli/versioncheck/autoupdate_test.go Adds unit tests covering guardrails, decline path, success, and installer failure messaging.
cmd/entire/cli/versioncheck/versioncheck_test.go Minor refactor in TestUpdateCommand (path constant reuse).

Comment thread cmd/entire/cli/versioncheck/autoupdate.go Outdated
Comment thread cmd/entire/cli/versioncheck/versioncheck.go
Comment thread cmd/entire/cli/versioncheck/autoupdate.go
Comment thread cmd/entire/cli/versioncheck/autoupdate.go Outdated
gtrrz-victor and others added 2 commits April 22, 2026 11:27
Pre-select the affirmative so Enter accepts, matching the (Y/n) UX
described in docs/architecture/auto-update.md. Previously the zero
value of the bound bool made "No" the default, contradicting the
prompt and surprising users who expected the implied accept.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 7b8020d9f4cb
Replaces the ad-hoc stdoutIsTerminal seam with the shared
interactive.CanPromptInteractively() helper, which opens /dev/tty
directly. This handles three review items with a single change:

- Cobra redirects via cmd.SetOut(&bytes.Buffer{}) no longer matter;
  the TTY check is independent of the writer fd.
- Test binaries running from a real terminal skip the prompt via
  ENTIRE_TEST_TTY=0 set in setupCheckAndNotifyTest.
- Agent subprocesses that inherit the user's stdout but have no
  controlling terminal for stdin hit the /dev/tty open failure and
  are skipped; CI runners land on the same path.

Also drops the redundant os.Getenv("CI") check — the /dev/tty probe
already covers it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 4c7de4acdbd6
@gtrrz-victor
Copy link
Copy Markdown
Contributor Author

bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 5872166. Configure here.

Comment thread cmd/entire/cli/versioncheck/autoupdate.go
gtrrz-victor and others added 6 commits April 22, 2026 16:49
Self-hosted runners and some Docker configurations leave /dev/tty
attached, so the prior /dev/tty-only probe would let huh forms run
in CI and hang the pipeline. Gate on CI in addition to /dev/tty;
ENTIRE_TEST_TTY still overrides both so existing tests that exercise
the interactive path keep working.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 096757b44493
Remove the design-doc file from this PR as requested.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 23fdeb653d1e
CI guardrail in CanPromptInteractively short-circuits to false when CI=1,
which broke TestResume_LocalLogNewerTimestamp_UserConfirmsOverwrite in
GitHub Actions — the pty is real but the env check wins. Override with
ENTIRE_TEST_TTY=1 in RunCommandInteractive so interactive prompts work.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: a1da08f67a46
Move hasTTY from strategy package to interactive package (its
documented home) and replace all interactive.CanPromptInteractively
callers with interactive.HasTTY. One check path for agent-subprocess
and /dev/tty detection across cli, strategy, and versioncheck.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 1f83680e3b77
Keep the consolidated body (agent-subprocess + /dev/tty checks) under
the original name so call sites and tests read the same as before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: df1ddfe6b261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants