feat(herd): port the sidebar to hqtui, as a folding tree - #547
Merged
Merged
Conversation
"are we using hqtui.com library for this tui? it looks pretty old and
outdated. upgrade it to hqtui"
moshcode did not use hqtui at all: zero references in src/ or bin/, and
the TUI is hand-rolled escape sequences throughout. So this is a port,
not a version bump. @profullstack/hqtui joins as a dependency at ^0.7.0,
a house package with zero runtime dependencies.
SCOPE. The herd sidebar, which is the surface Anthony is looking at when
he complains, and nothing else. src/herd-workspace.mjs keeps the tmux
half and only the tmux half; src/herd-sidebar.mjs is the new view. The
right-hand pane is still a real tmux pane running a real agent, because
no renderer can substitute for one.
WHAT THE LIBRARY BUYS. Three bugs came out of the hand-rolled shape and
none of them were ever about herds:
- the click map was a second source of truth. sidebarRows() numbered
the lines and renderSidebar() printed them, and when they drifted
every click landed on the row below the pointer. hqtui's tree
reports the row it drew each node on, so the map is built by the
thing that draws it.
- there was no hover, so a click had to be spent selecting, which is
where the double-click came from. onHoverRow plus hovered is now
the whole of it.
- the restore path was escape sequences only. hqtui's Terminal
restores on SIGINT, SIGTERM and an uncaught error by default.
A FOLDING TREE, IN PLACE. The herd is herds containing members, which is
a tree, and the expectation for a pane of things-containing-things is
that it unfolds in place on ONE click with the row under the pointer
lit. Clicking a herd folds it; clicking a member opens it, meaning shown
and given the keyboard. Nothing is swapped out for a different screen.
Actions are real buttons with onPress.
Neither known trap is tripped: collapseBorders only merges where two
bordered siblings touch and there is nothing here to merge, so it is off
with the reasoning written down; and no panel carries both a title and a
subtitle, which is where near-identical panels truncate differently.
The tests are the part worth having. renderToScreen draws the real view
headlessly and then presses real cells, so "is the thing that says api
the thing that opens api" is answered by clicking the cell that says
api, rather than by two pieces of code agreeing about a line number.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
ThreatCrush Security Scan0 finding(s) in the 7 file(s) this pull request changes. Nothing in the files this pull request changes. 104 pre-existing finding(s) elsewhere in the repository — **HIGH/CRITICAL**: 8 | **MEDIUM**: 85 | **LOW**: 11Not introduced by this pull request. The full set is in the Security tab.
…and 84 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Recovers the hqtui port from PR #546, whose commits never reached
main.Why this PR exists
#546 was opened with
herd-ui-defaultas its base rather thanmain, because it was stacked on #545. #545 merged tomainfirst, so when #546 merged it merged into an already-merged branch. GitHub marks it MERGED and it looks done, butmainnever receivedsrc/herd-sidebar.mjsor the@profullstack/hqtuidependency. This is the same commit (b084216), cherry-picked ontomain.What it does
moshcode used hqtui nowhere. The TUI was entirely hand-rolled escape sequences, which is why it looked dated. This adds
@profullstack/hqtui@^0.7.0and ports the herd sidebar to it.src/herd-workspace.mjsis now the tmux half (221 lines) andsrc/herd-sidebar.mjsis the view. The sidebar is a folding tree: one click opens a member, one click folds a herd in place, hover lights the row under the pointer, and actions are real buttons.The local
~/hqtuicheckout is 0.6.2 and has notreewidget. 0.7.0 does, withonRow/hovered/onSelectRow/onHoverRow, which is what made the folding tree straightforward.Neither known hqtui trap tripped:
collapseBordersis off with the reasoning written down, and no panel carries both a title and a subtitle.Scope
Sidebar only. The PR body of #546 has the honest write-up of what porting
herd-ui.mjs,herd-bar.mjs,herd-tile.mjs,rss-ui.mjsandtui.mjswould take.tui.mjsis a readline rewrite rather than a rendering port and wants its own PRD.Dependency note
This adds the second runtime dependency.
install.shalready handles that path (install_depsrunsnpm install --omit=devin staging and fails loudly rather than shipping a CLI that cannot start), which is the fix from #505 after@profullstack/synconfigbroke installs in 0.96.0. Verified locally:pnpm installthenmoshcode --versionstarts clean.Testing
node --test "test/*.test.mjs"on the cherry-picked tree: 2726 tests, 2722 pass, 0 fail, 4 skipped. The lower count versus #546's 3514 is only becauseapps/pwadeps are not installed locally; CI installs them.🤖 Generated with Claude Code