Add output formats, interactive table browser, and multi-chunk results#4646
Open
simonfaltum wants to merge 4 commits intomainfrom
Open
Add output formats, interactive table browser, and multi-chunk results#4646simonfaltum wants to merge 4 commits intomainfrom
simonfaltum wants to merge 4 commits intomainfrom
Conversation
… results Replace the single JSON-to-stderr output with format-aware routing: - Interactive terminal: table browser (viewport-based, with search) - Non-interactive / --output json: JSON array of objects - Small results (<=30 rows): static formatted table Add libs/tableview, a reusable interactive table browser component using bubbles/viewport. Features: horizontal + vertical scrolling, cursor row highlighting, / search with match navigation (n/N), g/G for top/bottom. Add multi-chunk result fetching via GetStatementResultChunkN for queries returning more data than fits in a single response chunk.
Avoid opening the interactive table browser when stdin cannot accept input by falling back to static tables, and add output routing tests with updated command help text.
Fix a bug where search highlighting on the cursor line would fail because cursorStyle.Render() wrapped the line in ANSI codes before highlightSearch tried to match against it. Now search highlighting is applied first on clean text, then cursor style wraps the result. Also merge two const blocks and derive totalRows from lines instead of storing it as redundant state.
Collaborator
|
Commit: 7172334
29 interesting tests: 8 FAIL, 7 KNOWN, 7 SKIP, 5 flaky, 2 BUG
Top 21 slowest tests (at least 2 minutes):
|
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.
Why
The
aitools tools querycommand outputs results as JSON to stderr viacmdio.LogString. This means output can't be piped, there's no tabular display for interactive use, and large multi-chunk results are truncated to the first chunk.Changes
Before: always JSON to stderr, single chunk only.
Now: format-aware output routing with interactive table browser.
Output routing:
--output json: JSON array of objects (backwards compatible)Interactive table browser (
libs/tableview/):Reusable shared component using
bubbles/viewport. Features:/search with yellow match highlighting,n/Nto navigate matchesg/Gfor top/bottom,qto quitMulti-chunk fetching:
Queries returning more data than fits in a single response chunk now fetch all chunks via
GetStatementResultChunkNand combine them.Screen.Recording.2026-03-03.at.17.46.00.mov
Screen.Recording.2026-03-03.at.17.43.34.mov
Test plan
libs/tableview(table rendering, search, highlighting)fetchAllRows(single chunk, multi-chunk, nil result)make lintfullcleanmake checksclean| catproduces JSON--output jsonforces JSON