eval the changes this PR is adding. do we have anywherelse in the code a logic similar…
- User
eval the changes this PR is adding. do we have anywherelse in the code a logic similar to this? Prompting to update the cli?
Assistant
PR eval task. Look diff first, then hunt for similar update-prompt logic elsewhere.
Assistant
Diff clear. Now check existing update-prompt logic elsewhere — versioncheck package have one already. Also check uncommitted working-tree changes.
Assistant
- User
I want only one flow. This flow can be triggered by version check which ends up running the original command after update, same as if we get an cli_upgrade_required error. Different triggers but exactly same flow afterwards. How can we make it unique?
Assistant
One flow, two triggers, shared tail (installer → reexec original command → loop guard). Need read version-check trigger path first:
CheckAndNotify, cache semantics,uiform, root.go wiring.Assistant
Decisions clear. Design settled — write plan.
Assistant
Plan approved. Execute — TDD order. First check existing seam-swap pattern in autoupdate_test.go so new tests match.
Assistant
Pattern clear — package seams +
t.Cleanup, no parallel (Setenv). Write red tests now.Assistant
Red confirmed. Green: write
updateflow.go.Assistant
Green. Fix lint hint (
errors.AsType, Go 1.26).Assistant
Now step 3: refactor
autoupdate.goonto shared gate + tail.Assistant
Now step 4: shrink
upgrade_required.goonto shared pieces.Assistant
Now adapt cli tests to the single
runUpdateseam.Assistant
Both suites pass. Diagnostics shown = pre-existing files, unrelated. Now fmt + lint + dup + verification grep.
Assistant
Single flow verified.
CanAutoInstallexport now unreferenced — delete per plan.Assistant
dup task hit same stale-binary issue — advisory only, skip. Run full unit suite.
Assistant
One failure —
tokenstorepackage, untouched by this change. Check if pre-existing.Assistant
Done. One flow now. Summary:
What changed
New
cmd/entire/cli/versioncheck/updateflow.go— the single shared flow:PromptAllowed(w)— one gate for both triggers: kill switch, post-update-rerun loop guard,canAutoInstall, TTY, terminal writer.RunUpdate(ctx, w, cmdStr, argv)— shared tail after user accepts: announce → installer → failure-with-retry message. Success: → "Update complete. Re-run entire…" (version-check trigger, command already ran); → re-exec original command with (upgrade-required trigger, retry of failed command).
- User
ship it
Assistant
Ship flow. CLAUDE.md require integration + canary before commit — run those first (unit + lint already green).
Assistant
Pushed
2f89deb4f. PR #1794 body now stale — "Implementation notes" describes the three exports (, , ) that this commit deleted, and doesn't mention the unified flow. Propose description edit: replace the "Implementation notes" section with the text below, everything else (problem, decision tree, leaf outputs, testing) unchanged except one appended testing line.