feat(ui): add adaptive file tree sidebar - #921
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR adds an adaptive built-in file sidebar that switches between compact grouped paths and an expanded ordered hierarchy based on available width.
Confidence Score: 4/5The PR appears safe to merge after the non-blocking sidebar module filename convention is addressed. The adaptive projection, selection, virtualization, and resize behavior are covered without an established runtime defect; the only accepted issue is the new component file's naming convention. Files Needing Attention: src/extensions/default/ui/sidebar/FileSidebars.tsx Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
W[Sidebar width] --> M{Content width >= 32?}
M -->|No| F[Flat grouped entries]
M -->|Yes| T[Expanded tree entries]
F --> V[Shared virtualized row renderer]
T --> V
V --> S[Stable scrollbox]
S --> N[Shared file selection and navigation]
Prompt To Fix All With AI### Issue 1
src/extensions/default/ui/sidebar/FileSidebars.tsx:1
**PascalCase sidebar module filename**
The new `FileSidebars.tsx` module violates the repository's enforced dash-case convention for TypeScript filenames, adding lint and maintenance inconsistency. Rename the module and update its imports.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(ui): retain sidebar resize drags" | Re-trigger Greptile |
| @@ -0,0 +1,245 @@ | |||
| import type { ScrollBoxRenderable } from "@opentui/core"; | |||
There was a problem hiding this comment.
PascalCase sidebar module filename
The new FileSidebars.tsx module violates the repository's enforced dash-case convention for TypeScript filenames, adding lint and maintenance inconsistency. Rename the module and update its imports.
Context Used: guidelines.mdc Cursor rule (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/extensions/default/ui/sidebar/FileSidebars.tsx
Line: 1
Comment:
**PascalCase sidebar module filename**
The new `FileSidebars.tsx` module violates the repository's enforced dash-case convention for TypeScript filenames, adding lint and maintenance inconsistency. Rename the module and update its imports.
**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
FlexFileSidebar,FlatFileSidebar, andTreeFileSidebarwhile retaining one shared scrollbox and virtualized row rendererHunkFileNavparityWhy
The compact grouped sidebar works in narrow panes, but the default wider sidebar has enough room to expose path structure one directory at a time. This makes nested changesets easier to scan without changing review navigation.
I evaluated Pierre Computer Company's
@pierre/trees. Its renderer is browser/Preact/shadow-DOM specific and its headless path store is private, so this PR does not add either dependency. It independently adapts the useful conventions: path-first hierarchy, one-row directory entries, indentation, and fixed metadata lanes.Approach
FlexFileSidebarderives the available content width and selects:FlatFileSidebarat 31 content columns or fewerTreeFileSidebarat 32 content columns or more (the default 34-column pane width)The tree projection walks files in authoritative review order and emits directory rows from the longest shared path prefix. It intentionally repeats a branch when interleaved review order returns to it instead of regrouping or sorting files.
Directories are static and always expanded. Collapse state, directory focus, sticky ancestors, and language-specific icons are intentionally out of scope.
Visual evidence
Real Hunk TUI, split mode, GitHub dark default, Linux, 220×24:
Dragging the divider through the threshold is covered by real PTY integration tests, including a regression where the first motion replaces the row OpenTUI would otherwise capture.
Verification
bun run typecheckbun run lintbun run deps:checkoxfmt --checkbun run test— 2,055 passed, 10 skippedbun run test:integration— 136 passed, 1 platform skipbun run test:tty-smoke— 9 passedbun run install:binPlatform tested: Linux. macOS and Windows were not manually tested; the pure path projection includes absolute and UNC-style root coverage.
This PR description was generated by Pi using gpt-5.6-sol