feat: scrollable transcript viewer for the interactive share wizard#88
Merged
kai-rayward merged 1 commit intoJun 19, 2026
Merged
Conversation
The `share --interactive` wizard dumped full transcripts straight to stdout, overflowing terminal scrollback so long transcripts couldn't be reviewed. Add a modal, scrollable viewer and route the two full-transcript views through it. - transcript_viewer.view_transcript(): a full-screen pager built on a read-only, buffer-backed prompt_toolkit TextArea. A buffer is required to scroll — a cursorless control snaps the scroll position back on every render. Mouse wheel, arrows, PgUp/PgDn, and Home/End all work; q / Ctrl-C exit. Message text is plain; the user/assistant role labels keep their original colors via a small lexer. - Falls back to the plain dump whenever a TUI can't run (stdin or stdout is not a tty, prompt_toolkit unavailable, or any runtime error) so the share flow is never aborted — even on a malformed session. - Extract a pure _transcript_lines() helper from render_transcript and reuse it for both the dump and the pager. - Add prompt_toolkit>=3.0, imported lazily. - Wire the step-2 redact preview and step-3 [v]iew calls in share_cli to the viewer; the short inline previews are unchanged. Hardening from PR review: - Strip C0/DEL control characters from displayed message content so terminal escape sequences in (untrusted) agent logs cannot manipulate the reviewer's terminal — applied in _transcript_lines, covering both the pager and the plain dump. - Emit a one-line stderr breadcrumb when the viewer falls back, so the "never abort" degradation is diagnosable rather than silent. - Narrow the tty-helper excepts to (AttributeError, OSError); document prompt_toolkit as a hard dependency; add tests for mouse-wheel scroll, Home/End, the lexer wiring, escape stripping, and zero-message sessions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Thanks @lwshanbd ! |
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.
Closes #89
Problem
clawjournal share --interactivedumped full transcripts straight to stdout, overflowing terminal scrollback so long transcripts couldn't be reviewed.Change
Adds a modal, scrollable transcript viewer and routes the two full-transcript views through it.
transcript_viewer.view_transcript()— a full-screen pager on a read-only, buffer-backed prompt_toolkitTextArea. (A buffer is required to scroll: a cursorless control snaps the scroll position back every render.) Mouse wheel, arrows, PgUp/PgDn, and Home/End all work;q/Ctrl-Cexit. Theuser/assistantrole labels keep their colors via a small lexer.$TERM, or a malformed session), leaving a one-linestderrbreadcrumb instead of failing silently._transcript_lines, covering both the pager and the plain dump._transcript_lines()helper fromrender_transcript; addsprompt_toolkit>=3.0(imported lazily); wires the step-2 redact preview and step-3[v]iewcalls (the short inline previews are unchanged).Testing
Full suite green (2275 passed). New tests cover the scroll-and-hold regression (real Down keys, cursor advances & holds), mouse-wheel scrolling, Home/End, the lexer wiring, escape stripping, zero-message sessions, and the non-tty / missing-dep / malformed-session fallback paths.
🤖 Generated with Claude Code