Repository navigation
Native /view: read-only viewer for files and completed output (#397) - #413
Merged
Merged
Conversation
/view <path> reads a regular file relative to the shell's directory, /view N completed output N (numbered as /copy), /view alone the latest output; block Actions gain View output. Markdown files render (m shows the source), source files get syntax roles and line numbers, diffs read as diffs. Find, go to line, wrap or horizontal scroll, copy all. Files are opened non-blocking and only regular files are read: at most 8 MiB and 200,000 lines, binary and UTF-16 refused, invalid UTF-8 shown with a note. Drawing is bounded to what is visible, and every control or format character is drawn as a visible mark. Viewing never writes to the file or transcript.
This was referenced Oct 18, 2026
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.
Stacked on #412 (reliability), which is stacked on #411 (design). Merge in order; GitHub retargets each PR to
devwhen its base merges.What
/view, a read-only native viewer in a full-height panel (the existing panel slot and key chain; it owns keys only while open):/view <path>: a file relative to the shell's directory (~for home)./view N: completed output N, numbered as/copynumbers it./view: the latest output. Block Actions gain View output. Open in pager stays.src/markdownrenderer;mshows the source. Output is never treated as Markdown..diff/.patchfiles andgit diff/git show/diff -uoutput read as diffs./find (smart case),n/Nnext/previous (wrapping with a note),:go to line.g/G, PageUp/PageDown and the mouse wheel scroll.wwrap on/off (Left/Right scroll sideways with‹/›marks),lline numbers.ccopies the whole text (exactly what/copygives for output). Esc clears the search, then closes.Safety and limits
lstat, thenopen(O_RDONLY|O_NONBLOCK)andfstat. Only regular files are read: directories, devices and FIFOs are refused, and a FIFO is refused at once. At most 8 MiB, cut at a UTF-8 boundary, and 200,000 lines, with a note naming the rest. Binary (NUL) and UTF-16 files are refused. Invalid UTF-8 is shown with�and a note. Symlinks are followed, aslessdoes, and the header shows the target. Nothing is written.ESC[2Jwould otherwise have cleared the transcript. Markdown links are links only through the renderer's existing allowed targets.Tests
viewer.test.ts: file refusals (directory, missing, binary, UTF-16, FIFO, permission), UTF-8 cuts, line caps, symlinks, hostile content and hostile file names at 32/80/120 columns, Markdown Rendered/Source, diff detection, search, navigation, bounds, tiny panels.viewerApp.test.ts:/view,/view Nand the block action; keys owned while open; the transcript unchanged; missing-file notice.viewerLive.test.ts: a real PTY through the binary covering Markdown, latest output, find, go-to-line, copy all via a stand-in clipboard, and Esc back to the composer./view.Not verified
Physical terminal checks:
docs/testing/v021-physical-qa.mdsection 2, not run.Refs #397, #402, #410