Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(init): start the plugin-installer handoff at the top of the screen - #1448

Merged
betegon merged 1 commit into
mainfrom
fix/init-completion-exit-clear
Aug 21, 2026
Merged

betegon merged 1 commit into
mainfrom
fix/init-completion-exit-clear

Conversation

@betegon

@betegon betegon commented Aug 21, 2026

Copy link
Copy Markdown
Member

Problem

When exiting sentry init with finish after opting into the agent plugin, the exit summary and the interactive npx @sentry/ai install UI render from mid-screen, with a blank gap above them:

  • The wizard runs in the alternate screen buffer.
  • On teardown we leave it (\x1b[?1049l), which restores the cursor to the row where sentry init was invoked — usually low on the screen.
  • The exit summary and the installer (spawned with stdio: "inherit") then print from that row, leaving the top of the screen blank.

Startup already clears + homes on entry (\x1b[?1049h\x1b[2J\x1b[H); the exit-to-installer path did not.

Fix

In tearDown(), when a post-exit action is queued (the agent-plugin installer), append \x1b[2J\x1b[H right after leaving the alt buffer — the same clean top-of-screen start the wizard uses on entry.

\x1b[?1049l              → normal exit (unchanged): compact summary flows into scrollback
\x1b[?1049l\x1b[2J\x1b[H → installer handoff: starts at the top of the screen

The normal exit (no installer) is untouched, so its compact summary still lands in the restored scrollback at the invocation point.

Testing

  • New test/lib/init/ui/ink-ui-teardown.test.ts locks in both branches (clears on handoff, doesn't clear on normal exit); spawn is stubbed so teardown never launches a real installer.
  • tsc ✅ · biome ✅ · init UI test suite ✅

Note: the alt-screen behavior can't be asserted from a screenshot in CI (needs a real TTY + the spawned installer), so it's covered by the escape-sequence test rather than a visual snapshot.

🤖 Generated with Claude Code

Exiting the alternate screen buffer restores the cursor to the row where
`sentry init` was invoked — usually low on the screen. The exit summary and the
interactive `npx @sentry/ai install` UI (spawned with inherited stdio) then
rendered from mid-screen, leaving a blank gap above them.

When a post-exit action is queued (the agent-plugin installer), clear the
restored screen and home the cursor right after leaving the alt buffer — the
same clean top-of-screen start the wizard uses on entry. The normal exit (no
installer) is untouched, so its compact summary still flows into the restored
scrollback at the invocation point.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli Ready Ready Preview Aug 21, 2026 9:08am

Request Review

@betegon
betegon merged commit 59c00f4 into main Aug 21, 2026
30 checks passed
@betegon
betegon deleted the fix/init-completion-exit-clear branch August 21, 2026 10:36

This branch was successfully deployed

1 active deployment
Preview — 12002f63 Deployed Aug 21, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant