Repository navigation
Native read-only /view: files, logs, output and document previews #397
Description
Goal
Design a lightweight read-only NMSh-native /view surface for files, logs, Markdown, diffs and previously completed command output. The user likes the GUI-like discoverability of TTT Editor, but does not want NMSh to become a second full text editor or terminal emulator.
This is post-v0.20 exploratory scope, not release work or authorization to implement. Audit the existing Actions → Open in pager (less), /open host actions, bat/delta Theme Bridge, transcript folding, search, Compare, and the pending shared /copy//actions navigator before designing anything.
Proposed user experience (commands are proposals, not shipped)
/view path/to/file→ read-only document viewer;/viewmay offer a reviewed file/output selector.- From a completed command block, Actions → View full output reuses the same backing output, with no duplicate capture or secret disclosure.
- Search/find, line numbers, go-to-line, optional syntax highlighting, horizontal scroll/wrap, copy selected text or full output, and stable viewport/selection across resize.
- Useful optional Markdown rendering and diff/log presentation; raw text must stay accessible. No implicit reinterpretation of script/machine-readable output.
- Familiar concise status/help, background-focused selection, mouse + keyboard parity, Safe/NO_COLOR, narrow widths. Borrow interaction principles from TTT and Ranma without copying their UI wholesale.
- Prefer reuse of existing transcript renderer, search, selection, FoldPolicy and
HistoryViewport/future scrolling infrastructure. Don't introduce a second authoritative output store or alternate PTY manager. - For very large/binary/remote files, provide honest bounded behavior and a documented fallback to existing
less,bat,Glowor host editor; optional tools are never prerequisites.
Explicit boundaries
- No native editing, file writes, undo/redo stack, LSP, multi-cursor, integrated IDE, or independent terminal emulator. Editors like TTT/Fresh/Micro/Helix/Neovim/Zed remain external and independently owned (Workflow integrations: external editors, search, preview tools and shell utilities #366).
- Viewing must not execute/shell-source inspected content, invoke a tool with unreviewed command-line text, rewrite terminal-host config, or steal keystrokes from a foreground read/alternate-screen program.
- Preserve source bytes/encoding where supported, explain encoding/binary/truncation limitations, protect large-file latency and memory on an 8 GB Mac.
- Raw PTY output in NMSh history remains authoritative;
/viewand semantic views are presentation-only, no changes to pipes, redirections,/copy, exports, or command exit codes. - No default upload or network transmission of file content.
Acceptance / design gate
- Inventory existing pager, host-open, transcript navigation, copy/actions and theme integration; identify concrete gap against external
less/bat/TTT before implementing. - Show a production-renderer preview/flow for a source file, Markdown file, 400-line stored output and 10k-line log, at 32/80/120 columns.
- Specify file read limits, Unicode/control escaping, follow/tail policy, sensitive content treatment and keyboard ownership.
- Read-only file/path/line handling, missing/unreadable files, symlinks, binaries, search/copy and pagination tested without user-file mutations.
- Real macOS Ghostty/Terminal.app QA, Linux portability, resize/selection/passthrough, CPU/memory measurements.
- If the gap is small, prefer improving existing Open in pager over shipping redundant
/viewUI.
Related
#366 optional editor/viewer integrations; #386 semantic output (different: derived interpretation of completed output); #335 contextual keybindings; #304 Theme Bridge; #14 PTY/TUI compatibility; #330 terminal-first workspace boundary.
References: TTT Editor, Ranma, bat, Glow.
Activity
raiseCatError commentedon Oct 18, 2026
v0.21: native read-only
/viewin #413: files (bounded, regular files only, binary/UTF-16 refused, invalid UTF-8 noted),/view N//viewfor completed output, and Actions → View output. Markdown renders through the existing renderer, with Rendered/Source onm. Also: find, go-to-line, wrap or horizontal scroll, copy all, and hostile text drawn inert. Tests include a real-PTY run. Physical checks: section 2 ofdocs/testing/v021-physical-qa.md.Merge pull request #413 from raiseCatError/feature/v021-view