|
| 1 | +--- |
| 2 | +name: termviz |
| 3 | +description: Use when installing, launching, scripting, or explaining termviz, a terminal-first image and plot viewer with interactive TTY rendering, scriptable exports, and CSV/TSV/JSONL plot support. |
| 4 | +metadata: |
| 5 | + internal: false |
| 6 | +--- |
| 7 | + |
| 8 | +# termviz |
| 9 | + |
| 10 | +Use `termviz` when a user wants to inspect, view, or export images and small |
| 11 | +numeric plots from a shell. It is a local terminal viewer, not a server, |
| 12 | +dashboard, notebook runtime, or background daemon. |
| 13 | + |
| 14 | +## Install |
| 15 | + |
| 16 | +Install from GitHub with Cargo: |
| 17 | + |
| 18 | +```sh |
| 19 | +cargo install --git https://github.com/siriusctrl/termviz |
| 20 | +``` |
| 21 | + |
| 22 | +Install a specific release tag when reproducibility matters: |
| 23 | + |
| 24 | +```sh |
| 25 | +cargo install --git https://github.com/siriusctrl/termviz --tag vX.Y.Z |
| 26 | +``` |
| 27 | + |
| 28 | +The install provides both binaries: |
| 29 | + |
| 30 | +```sh |
| 31 | +termviz --version |
| 32 | +tvz --version |
| 33 | +``` |
| 34 | + |
| 35 | +Use `termviz` in examples when clarity matters. Use `tvz` as the short alias |
| 36 | +for daily interactive use. |
| 37 | + |
| 38 | +## Core Behavior |
| 39 | + |
| 40 | +- If stdout is a TTY, opening a supported input starts the interactive viewer. |
| 41 | +- If stdout is redirected, the default output is scriptable PNG bytes, not |
| 42 | + terminal escape sequences. |
| 43 | +- Use `--inspect` for metadata/profile text. |
| 44 | +- Use `--output-format` or `--output` for explicit exports. |
| 45 | +- Use `--protocol auto` by default. Force `kitty` or `blocks` only when testing |
| 46 | + or overriding terminal detection. |
| 47 | + |
| 48 | +## Interactive Use |
| 49 | + |
| 50 | +Open image inputs: |
| 51 | + |
| 52 | +```sh |
| 53 | +termviz image.png |
| 54 | +tvz image.webp |
| 55 | +termviz photo.jpg --protocol auto |
| 56 | +``` |
| 57 | + |
| 58 | +Open plot inputs: |
| 59 | + |
| 60 | +```sh |
| 61 | +termviz data.csv --x time --y latency |
| 62 | +termviz data.csv --x time --y latency --group service |
| 63 | +termviz data.csv --x load_ms --y cpu_pct --kind scatter --group node |
| 64 | +``` |
| 65 | + |
| 66 | +Common controls: |
| 67 | + |
| 68 | +- `q`: quit |
| 69 | +- `+` / `-`: zoom in and out |
| 70 | +- `0`: fit to terminal |
| 71 | +- arrow keys: pan |
| 72 | +- `m`: toggle metadata or plot summary overlay |
| 73 | +- mouse hover on plots: snap to nearest visible point and show x/y readout |
| 74 | +- left mouse drag on images: pan image inputs |
| 75 | + |
| 76 | +## Plot Arguments |
| 77 | + |
| 78 | +Use this argument shape for numeric table or stream data: |
| 79 | + |
| 80 | +```sh |
| 81 | +termviz INPUT --x X_FIELD --y Y_FIELD --group GROUP_FIELD --kind KIND |
| 82 | +``` |
| 83 | + |
| 84 | +Supported input formats: |
| 85 | + |
| 86 | +- Raster images: PNG, JPEG, WebP, GIF metadata/static viewing path |
| 87 | +- Vector metadata/export: SVG |
| 88 | +- Plot data: CSV, TSV, JSONL/NDJSON |
| 89 | + |
| 90 | +Supported plot kinds: |
| 91 | + |
| 92 | +- `line`: numeric `--x` and `--y`, optional `--group` |
| 93 | +- `scatter`: numeric `--x` and `--y`, optional `--group` |
| 94 | +- `bar`: numeric `--x` and `--y`, optional `--group` |
| 95 | +- `area`: numeric `--x` and `--y`, optional `--group` |
| 96 | +- `histogram`: numeric `--x`, optional `--group`, no `--y` |
| 97 | + |
| 98 | +Current bar and histogram support is numeric-axis first. Do not describe them |
| 99 | +as categorical charts unless the code has been extended. |
| 100 | + |
| 101 | +## Export Patterns |
| 102 | + |
| 103 | +Redirected stdout defaults to PNG: |
| 104 | + |
| 105 | +```sh |
| 106 | +termviz image.png > frame.png |
| 107 | +termviz data.csv --x time --y latency > chart.png |
| 108 | +``` |
| 109 | + |
| 110 | +Choose an explicit output format: |
| 111 | + |
| 112 | +```sh |
| 113 | +termviz image.png --output-format json > metadata.json |
| 114 | +termviz image.png --output-format ansi > preview.ansi |
| 115 | +termviz data.csv --x time --y latency --output-format svg > chart.svg |
| 116 | +termviz data.csv --x time --y latency --output-format json > chart.json |
| 117 | +``` |
| 118 | + |
| 119 | +Let `termviz` infer export format from `--output`: |
| 120 | + |
| 121 | +```sh |
| 122 | +termviz image.png --output frame.png |
| 123 | +termviz data.csv --x time --y latency --output chart.svg |
| 124 | +termviz data.csv --x load_ms --kind histogram --output histogram.json |
| 125 | +``` |
| 126 | + |
| 127 | +Shell redirection does not expose the target filename to `termviz`; use |
| 128 | +`--output-format` when redirecting to non-PNG formats. |
| 129 | + |
| 130 | +## Useful Recipes |
| 131 | + |
| 132 | +Inspect a file without opening the viewer: |
| 133 | + |
| 134 | +```sh |
| 135 | +termviz input.data --input-format csv --inspect |
| 136 | +``` |
| 137 | + |
| 138 | +Compare services over time: |
| 139 | + |
| 140 | +```sh |
| 141 | +termviz metrics.csv --x minute --y latency --group service --kind line |
| 142 | +``` |
| 143 | + |
| 144 | +Show grouped bars: |
| 145 | + |
| 146 | +```sh |
| 147 | +termviz errors.csv --x minute --y errors --group service --kind bar |
| 148 | +``` |
| 149 | + |
| 150 | +Show an area trend: |
| 151 | + |
| 152 | +```sh |
| 153 | +termviz throughput.csv --x minute --y throughput --group region --kind area |
| 154 | +``` |
| 155 | + |
| 156 | +Show a grouped distribution: |
| 157 | + |
| 158 | +```sh |
| 159 | +termviz samples.jsonl --input-format jsonl --x latency_ms --group endpoint --kind histogram |
| 160 | +``` |
| 161 | + |
| 162 | +## Guardrails For Agents |
| 163 | + |
| 164 | +- Keep stdout scriptable. Never rely on implicit protocol escape output in |
| 165 | + redirected stdout. |
| 166 | +- Prefer `--inspect`, `--output-format json`, or explicit file exports in |
| 167 | + automation. |
| 168 | +- For interactive demos or visual verification, use a real TTY or the repo's |
| 169 | + recording scripts instead of plain redirected command output. |
| 170 | +- For large raster inputs, expect interactive viewing to be guarded until |
| 171 | + tile-backed rendering exists. |
0 commit comments