fix(opencode): handle cancel in upgrade process and customize spinner#26150
fix(opencode): handle cancel in upgrade process and customize spinner#26150mortalYoung wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
kowanietz
left a comment
There was a problem hiding this comment.
I also experience the spinner jitter. Might be worth looking into centralizing it
|
|
||
| prompts.log.info(`From ${InstallationVersion} → ${target}`) | ||
| const spinner = prompts.spinner() | ||
| const spinner = prompts.spinner({ frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] }) |
There was a problem hiding this comment.
This fixes the spinner jitter for upgrade, but I noticed other CLI commands still call prompts.spinner() directly. Would it make sense to move this spinner config into the existing helper for consistency?
There was a problem hiding this comment.
Ok. I defined createSpinner function and put it into a new file named prompt.ts as a result of I can't find an appropriate existing helper file.
Issue for this PR
Closes #26154
Type of change
What does this PR do?
The
upgradecommand had two issues:Cancel not handled: When the user pressed
Ctrl+Cor dismissed the confirmation prompt,prompts.isCancel()was not checked. The cancelled value was falsy but only a bare!installcheck was used — this works incidentally butprompts.isCancel()should be checked explicitly to correctly handle the cancel signal returned by@clack/prompts.Default spinner frames: The default spinner frames use characters in the range U+25D0–U+25D3 (◐◓◑◒), which are classified as "Neutral" width in the Unicode standard — meaning each font decides their rendered size independently. Many monospace fonts (Menlo, SF Mono, Fira Code, etc.) render these glyphs inconsistently: some frames appear slightly wider or taller than others, causing visible jitter in the animation. The Braille dot characters (⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏) are classified as "Narrow" width and render at a consistent single column width across fonts, producing a stable animation.
How did you verify your code works?
Tested locally by running
bun dev upgrade, pressingCtrl+Cat the confirmation prompt and confirming it exits cleanly with "Done". Also verified the spinner renders correctly during the upgrade process.Screenshots / recordings
N/A — CLI-only change, no UI.
Checklist