Full-screen session via the terminal alternate screen buffer#20
Merged
Conversation
`devflow start` now takes over the screen like vim/less/htop: it switches to
the alternate screen buffer (and hides the cursor) on launch, and restores the
user's original terminal — scrollback and all — on exit.
- Guarded on `process.stdout.isTTY`, so piped/non-interactive output is
unchanged (single code path, no rendering-mode flag to maintain).
- Enter happens only after every early-exit validation, so error paths stay on
the real terminal. Restore runs in the single `cleanup()` teardown plus a
`process.on("exit")` safety net, so the terminal is always restored on every
exit path (complete, stop, Ctrl+C, SIGTERM, unexpected throw).
- On exit, a compact summary line (e.g. `✓ done · 1h 15m focused · 3 pomodoros
· lo-fi`) is printed to the real terminal after leaving the alt screen, so a
trace of the session survives in scrollback.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BGajYfJGLkYwBWbgoKcjM
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
devflow startnow takes over the screen likevim/less/htop: it switches to the terminal's alternate screen buffer (and hides the cursor) on launch, and restores the user's original terminal — scrollback and all — on exit.Behavior
On by default, TTY-guarded. Only activates when
process.stdout.isTTY; piped/non-interactive output (CI, redirects) is byte-for-byte unchanged. One code path — no rendering-mode flag to maintain.Always restores. Enter happens only after every early-exit validation (so error paths stay on the real terminal). Restore runs in the single
cleanup()teardown and aprocess.on("exit")safety net, guaranteeing the terminal is restored on every exit path: natural completion,stop, Ctrl+C, SIGTERM, even an unexpected throw. (The two restore calls are idempotent.)Leaves a trace. Since the alt screen erases the in-session phase log on exit, a compact recap is printed to the real terminal after leaving the alt screen, so it persists in scrollback:
(Reads
stopped · …when interrupted.)Implementation
src/lib/display.ts:enterFullscreen()/exitFullscreen()helpers (alt buffer + cursor show/hide), best-effort and TTY-guarded.src/commands/start.ts: enter before the header; restore + summary incleanup();sessionSummary()built from the same snapshot already used for history logging; first-run setup tip moved to print inside the takeover (no flash).Verification
pnpm typecheck+pnpm buildpass.stopped) and a naturally completed (✓ done · 1m focused) session.🤖 Generated with Claude Code
Generated by Claude Code