Rewrite terphite in Go with dashboards - #6
Open
benwtr wants to merge 5 commits into
Open
Conversation
Replace the CoffeeScript/blessed implementation with a Go rewrite built on bubbletea/lipgloss/bubbles, distributed as a single static binary instead of an npm package with a stale request dependency and a blessed fork pinned to a GitHub commit. Along the way: proper error handling on all Graphite API calls (the original silently swallowed fetch errors), env-var credential support alongside the existing user:pass@ URL form, a cross-platform clipboard copy instead of the iTerm2-only escape sequence, and test coverage across the core packages (previously none existed). Also adds dashboards — save a set of graphs and view them together as a grid instead of one at a time, which the original README flagged as a "next step" but never implemented.
Replace the single-dot scatter plot with a braille sub-character canvas (2x4 dots per cell), connecting datapoints with Bresenham lines instead of leaving them as isolated points, for much smoother-looking charts. Add graphite-web-style draw modes cycled with 'g': line (as above), area (independent per-series fill to the bottom of the plot), and stacked (cumulative area, non-overlapping bands). Saved dashboard panels remember their own draw mode via a new Panel.DrawMode field.
In terminals that support inline images, display Graphite's own rendered PNGs instead of ASCII charts — giving graphite-web's real axis labels, legends, and gridlines rather than reimplementing them in braille. Supports the iTerm2 protocol (iTerm2, WezTerm) and the Kitty graphics protocol (Kitty, Ghostty), auto-detected from environment variables at startup with an 'I' key to override when detection guesses wrong — it can, since tmux and SSH don't always relay these escape sequences. Terminals without support keep the existing braille charts. Fetch selection is centralized in refreshCmd() so every action that changes what's plotted requests the right format, and built escape sequences are cached against image version + display size rather than re-base64-encoding the payload on every frame.
Add an up-front disclaimer that the Go rewrite was written entirely by an LLM and has only been tested against a mock Graphite server. Also move the graphical-mode section below the dashboard key table — it had been inserted between the two key tables, making the dashboard keys read as if they belonged to graphical mode.
The inline-image work broke the layout: an image escape sequence is a single line of text but occupies many rows on screen, so lipgloss padded the chart pane to full height on top of an image already consuming it. The frame came out roughly twice the terminal height, which scrolled and smeared previous frames. Images are now painted as an overlay at absolute coordinates over a correctly-sized blank region, leaving the frame's line count honest. Fix a second overflow of the same kind found while testing: helpBoxHeight capped the box's declared height, but lipgloss only pads and never truncates, so help longer than the cap overflowed. helpText now fits itself to an explicit row budget and the box is sized from what it actually produced. Lay the help out in columns (5 rows instead of 18 at 170 cols) and add `?` to collapse it to a single line. Graphical mode now defaults to off — detection can't see through tmux or SSH, so it's opt-in via `I`, whose first press picks the detected protocol. Add `l` (and undocumented `ctrl+l`) to force a redraw. In dashboard view only ctrl+l binds, since `l` is vim-style pane movement there.
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.
Replace the CoffeeScript/blessed implementation with a Go rewrite built
on bubbletea/lipgloss/bubbles, distributed as a single static binary
instead of an npm package with a stale request dependency and a
blessed fork pinned to a GitHub commit.
Along the way: proper error handling on all Graphite API calls (the
original silently swallowed fetch errors), env-var credential support
alongside the existing user:pass@ URL form, a cross-platform clipboard
copy instead of the iTerm2-only escape sequence, and test coverage
across the core packages (previously none existed).
Also adds dashboards — save a set of graphs and view them together as
a grid instead of one at a time, which the original README flagged as
a "next step" but never implemented.