TUI: yazi-style Miller columns, image collections, review fixes#25
TUI: yazi-style Miller columns, image collections, review fixes#25engalar wants to merge 29 commits intomendixlabs:mainfrom
Conversation
- y key copies content to clipboard in overlay and compare view - OSC 52 terminal escape sequence for SSH/tmux environments, with fallback to pbcopy/wl-copy/xclip/xsel - "✓ Copied!" flash disappears after 1 second - Tab key switches between NDSL and MDL views in overlay when opened via b (BSON) or m (MDL) on a selected node
…rderless UI Major TUI rewrite from 2-panel + overlay to yazi-inspired design: - Miller 3-column layout (parent/current/preview) with responsive ratios - Tab system: t/T/W/1-9/[/] for multi-location and cross-project tabs - Async preview engine with cache, context cancellation, syntax highlighting - Borderless minimalist style with dim separators, no box borders - Context-sensitive key hint bar (HUD) at bottom - Mouse support: click parent=back, current=drill in, preview=forward - Scroll wheel in all columns including MDL/NDSL content preview - Soft line wrapping for preview content (no truncation) - Slide animation on column transitions (width-based, 5 frames) - Line numbers in preview pane with scroll percentage indicator - Clipboard copy (y) from preview content - Banner stripping for WARNING: and Connected to: lines New files: app.go, tab.go, miller.go, column.go, preview.go, keys.go, tabbar.go, statusbar.go, hintbar.go, icons.go Deleted: model.go, layout.go, panels/ (6 files)
- Column widths now adapt to content (IdealWidth with lipgloss.Width) - Parent capped at 30%, current at 35%, preview min 25% - Soft line wrapping in MDL/NDSL preview (wrapVisual) instead of truncation - Scroll calculations based on visual line count after wrapping - Preview auto-populates on drill-in/go-back (no more "No preview") - Animation slowed to 8 frames × 50ms = 400ms, proportional shift - Output height clamped to prevent overflow affecting other columns - Separator rendered as exact-height column of │ characters
Writes to ~/.mxcli/tui-debug.log when MXCLI_TUI_DEBUG=1. Traces: key/mouse events, resize, navigation, preview requests, column width calculations, animation state.
animTickMsg was not in the forwarding list in app.go Update(), so animation frames never decremented and parent column stayed permanently compressed.
Width-based animation caused all text to reflow simultaneously, creating a dizzying effect. Replaced with clean instant column shifts matching yazi's native behavior.
- buildDescribeCmd: add systemoverview → SHOW STRUCTURE DEPTH 2 - buildDescribeCmd: return "" for virtual container nodes (security, category, domainmodel, navigation, projectsecurity, navprofile) - fetch(): show "Select a document to preview" when cmd is empty - Add TestBuildDescribeCmd coverage for systemoverview and virtual nodes fix(sdk/mpr): resolve module names through folder hierarchy in MPR v2 In MPR v2, documents (pages, microflows, etc.) live inside Projects$Folder units, so their ContainerID points to a folder, not the module directly. The previous single-level moduleMap[ContainerID] lookup always missed, causing bson dump to fail with "page not found: Module.Name". Add resolveModuleName() which walks the container hierarchy upward until it finds a module unit, mirroring the catalog's findModuleID logic. Fix both GetRawUnitByName and ListRawUnits.
- Add imagecollection → Images$ImageCollection mapping in GetRawUnitByName and ListRawUnits (reader_units.go) so bson dump --type imagecollection works - Add imagecollection to inferBsonType() so NDSL preview mode can dump it - Add imagecollection to buildDescribeCmd() no-MDL-command list (returns "") since DESCRIBE IMAGECOLLECTION has no MDL syntax; shows friendly placeholder - Add TDD test cases for imagecollection in TestBuildDescribeCmd (RED→GREEN)
Add executor handlers for image collection statements with module lookup, duplicate detection, and hierarchy invalidation.
…E COLLECTION Parse Image.Data, Format, and ID fields from BSON in parser_misc.go. Write image data to /tmp/mxcli-preview/ and display IMAGE lines with file paths in DESCRIBE output.
…nd security fix - Add COLLECTION keyword to LSP completions - Add visitor_imagecollection.go for CREATE/DROP IMAGE COLLECTION AST handling - Fix writer_security.go to handle MaybeGeneralization in ReconcileMemberAccesses - Add implementation plan doc
SetItems() resets cursor to 0; save and restore parentCursor/currentCursor in navEntry so drillIn and goBack keep the selection visible.
- nanoflow: return empty (DESCRIBE NANOFLOW not implemented in executor) - javaaction: fix syntax to DESCRIBE JAVA ACTION (two words, matching grammar)
Writer serializes image bytes under key 'Image' (Images$Image type), but parser was looking for 'Data', so img.Data was always nil and temp files were never written during DESCRIBE IMAGE COLLECTION.
…avaaction preview 1. drillIn(): save/restore actual item index (selectedIndex) instead of filtered-list cursor position so parent column highlights the correct item after SetItems clears the active filter. 2. fetch(): strip AS $$...$$ block from DESCRIBE JAVA ACTION output so the preview shows only the MDL signature, not the Java implementation.
Add 'javaaction' to inferBsonType() so Tab toggles to NDSL mode. Add 'JavaActions$JavaAction' type prefix to GetRawUnitByName() so bson dump can resolve javaaction by qualified name.
Normalize \r\n and \r to \n in JavaAction documentation before rendering. Add RETURN NAME, parameter descriptions, and ICON as MDL comments in DESCRIBE JAVA ACTION output.
…d/mxcli/ Fix all critical and moderate issues from code review: - Fix itoa() for tab numbers >= 10 (#1) - Add TabID to LoadTreeMsg to prevent race condition (#2) - Fix UTF-8 truncation with runewidth (#3) - Change View()/viewZen() to pointer receivers (#4) - Cancel PreviewEngine on tab close and app quit (#5) - Remove ~315 lines dead code in keys.go (#6) - Remove unused NavState, MillerFocusPreview, GoBack, ToggleZen (#7) - Reset traceActive in CloseTrace() (#8) - Remove nolint:govet suppression (#9) - Extract magic numbers as named constants (#10) - Handle openDiagram temp file cleanup and WriteString error (#11) - Remove redundant rebuildZones() call (#12) - Fallback NDSL preview to MDL DESCRIBE for unsupported types - Move bson/ and tui/ packages into cmd/mxcli/ per reviewer suggestion
b8bdbaf to
68aaad9
Compare
ako
left a comment
There was a problem hiding this comment.
Code Review: TUI yazi-style Miller columns, image collections, review fixes
Alignment with Image Collection Proposal
The proposal (docs/03-development/proposals/show-describe-image-collections.md) specifies read-only SHOW/DESCRIBE. This PR goes beyond:
| Proposal | PR #25 | Status |
|---|---|---|
SHOW IMAGE COLLECTIONS [IN Module] |
Not implemented | Missing |
DESCRIBE IMAGE COLLECTION Module.Name |
Implemented (with temp file extraction) | ✅ Extended |
| — | CREATE IMAGE COLLECTION |
Beyond scope |
| — | DROP IMAGE COLLECTION |
Beyond scope |
| — | Inline terminal image rendering (Kitty/iTerm2/Sixel/chafa) | Beyond scope |
Enhance parser to capture ImageFormat |
Yes — parser extracts Format, Data, ID | ✅ |
SHOW IMAGE COLLECTIONS (the simpler listing) is missing while the more complex CREATE/DROP were implemented. Consider adding it as a follow-up.
PR #23 Overlap
PR #23 was closed without merging. This PR supersedes it — all 6 commits are rebased in, plus a commit addressing all 12 review issues. No conflicts with main.
Issues to Address in Follow-ups
Moderate:
- Image data written to
/tmp/mxcli-preview/with no cleanup (disk leak, mild security concern on shared systems) detectImageProtocolprioritizeschafaover native Kitty/iTerm2 — should be reversedimageFormatToExtsilently defaults unknown formats to.png- Three plan docs (1,645 lines total) are implementation artifacts, not reference docs
Minor:
renderImageIterm2reads entire file into memory with no size limit- Generated ANTLR parser accounts for ~12k lines of diff noise
Scope Note
This PR bundles 28 commits across 4 workstreams (TUI rewrite, image collections, package reorg, unrelated fixes). Future PRs should be scoped more narrowly for easier review.
What Looks Good
- Image collection implementation (grammar → AST → visitor → executor → BSON writer) follows established patterns well
- TUI image rendering with protocol auto-detection is a nice feature
- All PR #23 review issues were addressed
- Security fix for association member access (CE0066) is correct
Approving — the code quality is solid. Follow-up items noted above.
🤖 Generated with Claude Code
|
This PR has merge conflicts with main (in Could you rebase onto main? The grammar conflict is straightforward — I tested the rebase locally — build and tests pass cleanly after resolution. |
|
Merged manually via rebased branch push to main. All 29 commits are on main now. |
Summary
bson/andtui/intocmd/mxcli/to colocate with CLI commandsChanges
bson/andtui/packages undercmd/mxcli/Test plan
make test— 0 failures)make build)go vet ./...clean🤖 Generated with Claude Code