Skip to content

feat(app): add workspace browser bootstrap#4

Merged
andrewmelchor merged 2 commits intomainfrom
feat(app)/tui-bootstrap-browser
Jan 21, 2026
Merged

feat(app): add workspace browser bootstrap#4
andrewmelchor merged 2 commits intomainfrom
feat(app)/tui-bootstrap-browser

Conversation

@andrewmelchor
Copy link
Copy Markdown
Member

Summary

  • Add treq tui command and OpenTUI/Solid bootstrap runtime
  • Implement workspace SDK + store-derived file tree (expand/collapse, selection, scroll-to-selection)
  • Add theme + header/footer layout
  • Add request panel with per-file loading + stable keyed rendering (prevents stale/stacked rows)
  • Introduce context providers (SDKProvider, StoreProvider, ExitProvider) and graceful exit handling
  • Fix app build pipeline: use OpenTUI Solid Bun plugin; default to single-platform builds for dev/test; keep full-matrix build for publish (build:all)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring
  • Chore (dependency update, build script changes, etc.)

How Has This Been Tested?

  • Unit tests
  • E2E tests
  • Manual testing (please describe)

Checklist

  • I have followed the contributing guidelines
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

* Add treq tui command and OpenTUI/Solid bootstrap runtime
* Implement workspace SDK + store-derived file tree (expand/collapse, selection, scroll-to-selection)
* Add theme + header/footer layout
* Add request panel with per-file loading + stable keyed rendering (prevents stale/stacked rows)
* Introduce context providers (SDKProvider, StoreProvider, ExitProvider) and graceful exit handling
* Fix app build pipeline: use OpenTUI Solid Bun plugin; default to single-platform builds for dev/test; keep full-matrix build for publish (build:all)
@andrewmelchor
Copy link
Copy Markdown
Member Author

@greptile

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Jan 21, 2026

Greptile Summary

This PR implements a comprehensive TUI (Terminal User Interface) for the t-req workspace browser using OpenTUI and SolidJS. The implementation introduces a new treq tui command that provides an interactive file tree browser with request viewing capabilities.

Key Changes:

  • Added complete TUI runtime with OpenTUI/Solid bootstrap and reactive state management
  • Implemented workspace SDK client for HTTP-based file and request listing (enforces server-only data access)
  • Created context providers for SDK, store, exit handling, keybinds, dialogs, and logging
  • Built file tree component with vim-style navigation (hjkl), expand/collapse, and auto-scroll to selection
  • Implemented request panel with debounced loading (50ms) and per-file caching to prevent duplicate fetches
  • Added command palette (Ctrl+P) and debug console (Ctrl+`) dialogs with fuzzy search
  • Configured graceful exit handling with proper terminal state restoration
  • Updated build pipeline to default to single-platform builds for dev/test efficiency (--single flag), with build:all for full cross-platform matrix

Architecture Highlights:

  • Clean separation of concerns with context providers for cross-cutting concerns
  • Reactive store using SolidJS signals with derived state (tree flattening, selection)
  • Proper keybind normalization and event capture for debugging
  • Stable keyed rendering prevents stale/stacked rows in file tree
  • Background data fetching with immediate UI render in "connecting" state

Confidence Score: 4/5

  • This PR is safe to merge with minor considerations around the intentional never-resolving Promise pattern
  • The implementation is well-structured with proper error handling, clean architecture, and good separation of concerns. The code follows SolidJS best practices with proper reactive primitives and effects. The build pipeline changes are sensible and well-implemented. Score is 4/5 rather than 5/5 due to the intentional never-resolving Promise in index.tsx:86 which, while functionally correct for keeping the process alive, could be more explicitly documented
  • No files require special attention - the implementation is solid throughout

Important Files Changed

Filename Overview
packages/app/src/tui/index.tsx Implements TUI entry point with proper context providers, graceful exit handling, and background data fetching with immediate UI render
packages/app/src/tui/app.tsx Main TUI app component with keyboard navigation, file selection, and debounced request loading; includes dialog and exit handling
packages/app/src/tui/store.ts Well-structured reactive store with tree building, flattening, and selection management; proper signal usage and derived state
packages/app/src/tui/sdk.ts Clean HTTP client with proper error handling, type safety, and URL encoding; follows architecture constraint of server-only data access
packages/app/script/build.ts Build script with single-platform flag for dev/test, cross-platform support, and proper OpenTUI Solid plugin integration

Sequence Diagram

sequenceDiagram
    participant CLI as CLI (tui.ts)
    participant Entry as TUI Entry (index.tsx)
    participant SDK as SDK Client
    participant Store as Reactive Store
    participant App as App Component
    participant Tree as FileTree Component
    participant Requests as RequestList Component
    participant Server as HTTP Server

    CLI->>Entry: startTui(config)
    Entry->>SDK: createSDK(serverUrl, token)
    Entry->>Store: createStore()
    
    Note over Entry: Setup signal handlers (SIGINT, SIGTERM)
    
    Entry->>Server: sdk.listWorkspaceFiles()
    activate Server
    
    Note over Entry,App: Render immediately in 'connecting' state
    Entry->>App: render() with providers
    App->>Tree: render with empty state
    App->>Requests: render placeholder
    
    Server-->>Entry: {files, workspaceRoot}
    deactivate Server
    Entry->>Store: setWorkspaceRoot(root)
    Entry->>Store: setFiles(files)
    Entry->>Store: setConnectionStatus('connected')
    
    Note over Store: Build tree structure from files
    Store->>Store: buildTree(files)
    Store->>Store: flattenTree(tree, expandedDirs)
    
    Note over App,Requests: Reactive updates trigger re-render
    App->>Tree: render with file tree
    
    User->>App: Press 'j' or 'down'
    App->>Store: selectNext()
    Store-->>App: selectedNode updated
    
    Note over App: Debounce 50ms
    
    App->>Server: sdk.listWorkspaceRequests(path)
    activate Server
    Server-->>App: {requests}
    deactivate Server
    App->>Store: setRequestsForPath(path, requests)
    Store-->>Requests: selectedFileRequests updated
    Requests->>Requests: render requests
    
    User->>App: Press Ctrl+P
    App->>App: dialog.replace(CommandDialog)
    
    User->>App: Press Ctrl+C
    App->>Entry: exit()
    Entry->>Entry: renderer.destroy()
    Entry->>Entry: process.exit(0)
Loading

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Jan 21, 2026

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

* Dialog context with stack-based modal management
* Command palette (ctrl+p) with fuzzy search using fuzzysort
* Debug console (ctrl+`) for viewing application logs
* Keybind context for configurable keyboard shortcuts
* Log context for structured application logging
* Debounced file loading (50ms) during rapid navigation
* Improved file tree scroll behavior
* Increased render FPS from 30 to 60
* Simplified footer with status display
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jan 21, 2026

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 97dfb41
Status: ✅  Deploy successful!
Preview URL: https://c6724da8.docs-6vq.pages.dev
Branch Preview URL: https://feat-app--tui-bootstrap-brow.docs-6vq.pages.dev

View logs

@andrewmelchor andrewmelchor marked this pull request as ready for review January 21, 2026 22:10
@andrewmelchor andrewmelchor merged commit 6f2b4a9 into main Jan 21, 2026
3 checks passed
@andrewmelchor andrewmelchor deleted the feat(app)/tui-bootstrap-browser branch January 21, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant