Repository navigation
Conversation
…nd manage books in the terminal
…les, remove people, and edit your profile
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved defects can crash the TUI on resize, display stale search results or images from another instance, and hide selected entries or clip content.
15 open issues
Resolve image URLs and restrict credential forwarding · New Wrap editor text by terminal display width · New Place the cursor on a new row when the line is full · New Include instance host in image cache keys · New Preserve table structure when rendering Markdown · New Wrap words using terminal display widths · New Split overlong words to fit the reading column · New Let Tab advance fields on the profile screen · New Account for scrolled-off image rows when laying out text · New Scroll the index to keep the selected leaf visible · New Allow retrying a failed search with the same query · New Discard stale search responses using request generations · New Keep the selected person visible in the list · New Keep the selected instance visible in the picker · New Avoid division by zero when gallery has no vertical space · New
What changed in this PR
Adds writebook tui, an interactive terminal interface for browsing and editing books that reuses the CLI’s sign-ins and API client.
Changes:
- Adds book browsing, Markdown reading and editing, file selection, publishing, settings, and profile screens.
- Adds terminal rendering dependencies, image support, contextual help, and UI tests.
- Preserves highlighted search snippets and reports sign-in renewal failures to TUI and MCP callers.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
| File | Description |
|---|---|
tests/tui.rs |
Tests rejection of non-terminal execution. |
src/tui/views.rs |
Draws galleries, lists, forms, and confirmation overlays. |
src/tui/theme.rs |
Maps book themes to terminal colors. |
src/tui/starfield.rs |
Animates the instance picker’s background. |
src/tui/settings.rs |
Adds people and invitation management. |
src/tui/search.rs |
Adds search input, results, and highlighting. |
src/tui/reader.rs |
Displays pages, pictures, sections, and the index. |
src/tui/profile.rs |
Adds profile and password editing. |
src/tui/markdown.rs |
Renders styled Markdown and image rows. |
src/tui/images.rs |
Loads, caches, and renders images. |
src/tui/help.rs |
Formats contextual keyboard help. |
src/tui/files.rs |
Adds file selection with image previews. |
src/tui/editor.rs |
Adds Markdown editing, styling, and list continuation. |
src/tui/edit.rs |
Adds book creation and settings forms. |
src/tui/data.rs |
Connects TUI operations to existing authentication and APIs. |
src/read.rs |
Exposes search results and preserves highlighted snippets. |
src/mcp.rs |
Propagates sign-in renewal errors. |
src/main.rs |
Registers the tui command. |
src/creds.rs |
Adds token retrieval with explicit renewal errors. |
skills/writebook/SKILL.md |
Documents that the TUI requires human interaction. |
README.md |
Introduces the terminal UI command. |
Cargo.toml |
Adds terminal, image, Markdown, and QR dependencies. |
Cargo.lock |
Locks the added dependencies. |
Review effort: Balanced
Each screen and overlay now owns its state, keys, bindings, drawing and the requests it starts; tui.rs keeps the event loop, message routing and global keys. Background work goes through one spawn helper, the yes/no questions are one confirmation overlay, search and the file picker share one large window, and the "not signed in" error lives in one place.
…hat it does, and encode the clipboard with the base64 crate
…at instead of what's selected when it's answered
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved findings include a critical zero-height gallery division that can crash the TUI during resizing, alongside image handling, search, and rendering defects.
15 open issues
Avoid division by zero when gallery has no vertical space Keep the selected instance visible in the picker Keep the selected person visible in the list Discard stale search responses using request generations Allow retrying a failed search with the same query Scroll the index to keep the selected leaf visible Account for scrolled-off image rows when laying out text Let Tab advance fields on the profile screen Split overlong words to fit the reading column Wrap words using terminal display widths Preserve table structure when rendering Markdown Include instance host in image cache keys Place the cursor on a new row when the line is full Wrap editor text by terminal display width Resolve image URLs and restrict credential forwarding
Review effort: Balanced
…other than what's open, and retry a failed search on enter
…resses on the instance
…ore ctrl and alt letters in fields, keep tab for the profile's fields, and continue a list only from after its marker
…r a line, keep every bullet of nested list items, and render tables a row to a line
…er a page's Markdown once per width instead of every frame
…ll the people, instances and index to the selected row, and keep the selected person on the list after a reload
… MB and decoded within limits, and fetch images from other sites without the token
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues can crash the TUI, apply asynchronous results to unrelated screens or instances, discard unsaved edits, and falsely mark changes as saved.
14 open issues
Remove pending bullets when flushing an empty list item · New Match publishing responses to the originating book and request · New Match book-save completions to the originating editor · New Only close the screen matching the completed deletion · New Validate the originating host on leaf-load responses · New Ignore paste while a page save is pending · New Clamp the selected book index after reload · New Deliver publication results to overlays retained in quit prompts · New Deliver search results to searches retained in quit prompts · New Block address editing while visibility changes are pending · New Deliver load results to books retained behind forms · New Prevent uploads from modifying the editor during save · New Match invite-reset responses to the instance and request · New Match profile-save responses to the originating editor session · New
15 resolved since last review
Avoid division by zero when gallery has no vertical space Keep the selected instance visible in the picker Keep the selected person visible in the list Discard stale search responses using request generations Allow retrying a failed search with the same query Scroll the index to keep the selected leaf visible Account for scrolled-off image rows when laying out text Let Tab advance fields on the profile screen Split overlong words to fit the reading column Wrap words using terminal display widths Preserve table structure when rendering Markdown Include instance host in image cache keys Place the cursor on a new row when the line is full Wrap editor text by terminal display width Resolve image URLs and restrict credential forwarding
Review effort: Balanced
…nds, so the next paragraph doesn't look for its prefix
…each one gets when it's made Replies found their target by what was open when they arrived, so a book save, a deletion, a loaded page or a publishing change could land on another book's screen, and replies for screens set aside under settings, an editor or a page, or for an overlay under the quit question, were dropped. Now every request carries the id of the screen or overlay it's for, and its reply goes there wherever it is, or nowhere if it's gone. A page gets a new id for each page turned to, saving waits for uploads into the page to finish, and only the last invite reset shows its link.
…ress while its visibility saves


Adds
writebook tui, a terminal UI for browsing and editing books.Screens
vswitches to a list./searches all books,nmakes a new book,sopens settings.aadds a page, picture or section.ddeletes,mmoves,ppublishes (address, copy, QR code),eedits the book./searches the book.eon a page. You write Markdown, which styles itself as you type, like hey-cli's composer.Help sits at the bottom of every screen, in hey-cli's style, and
?toggles it. Every confirmation is a Yes/No choice. Ctrl+C asks before quitting, and a second Ctrl+C quits.How it's built
creds::signed_in_tokenreports why renewing a sign-in failed rather than printing a note.writebook mcpnow uses it too, so it no longer says "you're not signed in" when the server is down.Needs basecamp/writebook#520 for the JSON it reads.
Tests cover the screens' keys and layout, the Markdown rendering and editor styling, the file picker, and search highlighting.
writebook tuiwithout a terminal stops with an error.