-
Notifications
You must be signed in to change notification settings - Fork 0
TUI Implementation #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Introduced state management for detail expansion and pagination in the App component. - Updated the SessionsView to conditionally render either a preview or a full transcript based on the detailExpanded state. - Implemented a new function to handle the rendering of the full transcript with pagination support. - Enhanced the useSessionDetail hook to include fullLines for detailed session data.
- Updated README to include detailed descriptions of the interactive TUI dashboard and its features. - Added a new file to .gitignore for todo.md. - Improved session listing in the TUI by adding date grouping for better organization. - Enhanced the SessionsView layout for improved readability and navigation. - Added keyboard shortcuts and usage hints for a better user experience.
- Updated ActivityHeatmap to use double-width blocks for better visual representation of activity levels. - Adjusted layout in DashboardView to provide a more compact and informative header with inline stats. - Added calculation for activity streak and average sessions per active day in DashboardView. - Improved platform breakdown and recent sessions display for clearer insights.
- Enhanced search focus handling in the App component to switch views more intuitively. - Updated Sidebar component to include separators for better visual organization. - Improved navigation menu layout and shortcut display for clearer user guidance. - Compactified authentication status display for a cleaner look.
|
@owenmccadden, working on some design improvements.
Transcript:
I did fix the q issue too. |
- Changed Sidebar component to use minWidth for better responsiveness. - Reduced maxHeight in SessionsView's SessionList for a more compact display.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a comprehensive interactive TUI (Text User Interface) dashboard for SessionBase, enabling users to browse, search, filter, and manage AI coding sessions directly from the terminal. The implementation includes a full React-based interface using Ink, custom hooks for data management, and extensive keyboard navigation support.
Key changes:
- Interactive dashboard command with real-time session statistics, activity heatmaps, and platform breakdowns
- Sessions browser with search, filtering, sorting, and detailed session views
- Keyboard-first navigation system with shortcuts for all major operations
Reviewed changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 28 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tui/App.tsx | Main React application orchestrating state management, keyboard input handling, and view routing |
| src/tui/views/DashboardView.tsx | Dashboard statistics view with activity heatmap and platform breakdown |
| src/tui/views/SessionsView.tsx | Sessions browser with search, filters, and split-screen detail view |
| src/tui/components/SessionList.tsx | Session listing component with date grouping and rich metadata display |
| src/tui/components/SearchBar.tsx | Interactive search bar component with focus management |
| src/tui/components/Sidebar.tsx | Navigation sidebar with auth status and keyboard shortcuts reference |
| src/tui/components/ActivityHeatmap.tsx | Visual heatmap showing session activity over 28 days |
| src/tui/components/StatsCard.tsx | Reusable statistics card with number formatting |
| src/tui/components/Box.tsx | Bordered box wrapper component for consistent UI framing |
| src/tui/components/MainContent.tsx | Router component switching between dashboard and sessions views |
| src/tui/hooks/useSessionData.ts | Data fetching hook managing sessions, stats, and auth state |
| src/tui/hooks/useSessionDetail.ts | Session detail loading hook with caching and platform-specific parsing |
| src/tui/types.ts | TypeScript type definitions for TUI state and data structures |
| src/commands/dashboard.ts | CLI command implementation launching the Ink-based TUI |
| src/index.ts | CLI command registration for the new dashboard command |
| package.json | Dependencies added for React, Ink, date-fns, and related UI libraries |
| README.md | Comprehensive documentation of dashboard features and keyboard shortcuts |
| .gitignore | Added todo.md to ignored files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/tui/hooks/useSessionDetail.ts
Outdated
| // #region agent log | ||
| fetch('http://127.0.0.1:7242/ingest/2512feb5-b2b3-442f-865d-ae88255c8b60',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({sessionId:'debug-session',runId:'m-toggle',hypothesisId:'H3',location:'useSessionDetail',message:'detail-loaded',data:{filePath:session.filePath,previewCount:previewLines.length,fullCount:fullLines.length},timestamp:Date.now()})}).catch(()=>{}); | ||
| // #endregion | ||
| if (!cancelled) { | ||
| setDetail(data); | ||
| } | ||
| } catch (err: any) { | ||
| if (!cancelled) { | ||
| setError(err?.message || 'Failed to load session detail'); | ||
| // #region agent log | ||
| fetch('http://127.0.0.1:7242/ingest/2512feb5-b2b3-442f-865d-ae88255c8b60',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({sessionId:'debug-session',runId:'m-toggle',hypothesisId:'H3',location:'useSessionDetail',message:'detail-error',data:{filePath:session?.filePath || null,error:err?.message || 'unknown'},timestamp:Date.now()})}).catch(()=>{}); | ||
| // #endregion |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains hardcoded debugging/telemetry code that sends data to a localhost endpoint. These fetch calls appear to be agent logging for development purposes and should be removed before merging to production. The hardcoded endpoint and UUID will cause unnecessary network requests in production.
| // #region agent log | |
| fetch('http://127.0.0.1:7242/ingest/2512feb5-b2b3-442f-865d-ae88255c8b60',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({sessionId:'debug-session',runId:'m-toggle',hypothesisId:'H3',location:'useSessionDetail',message:'detail-loaded',data:{filePath:session.filePath,previewCount:previewLines.length,fullCount:fullLines.length},timestamp:Date.now()})}).catch(()=>{}); | |
| // #endregion | |
| if (!cancelled) { | |
| setDetail(data); | |
| } | |
| } catch (err: any) { | |
| if (!cancelled) { | |
| setError(err?.message || 'Failed to load session detail'); | |
| // #region agent log | |
| fetch('http://127.0.0.1:7242/ingest/2512feb5-b2b3-442f-865d-ae88255c8b60',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({sessionId:'debug-session',runId:'m-toggle',hypothesisId:'H3',location:'useSessionDetail',message:'detail-error',data:{filePath:session?.filePath || null,error:err?.message || 'unknown'},timestamp:Date.now()})}).catch(()=>{}); | |
| // #endregion | |
| if (!cancelled) { | |
| setDetail(data); | |
| } | |
| } catch (err: any) { | |
| if (!cancelled) { | |
| setError(err?.message || 'Failed to load session detail'); |
src/tui/views/SessionsView.tsx
Outdated
| const platforms = [ | ||
| { key: 'all', label: 'All', emoji: '📋' }, | ||
| { key: 'claude-code', label: 'Claude', emoji: '🟠' }, | ||
| { key: 'gemini-cli', label: 'Gemini', emoji: '🔷' }, | ||
| { key: 'qchat', label: 'Q Chat', emoji: '🤖' }, | ||
| { key: 'codex', label: 'Codex', emoji: '💜' }, | ||
| ]; |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The platform configuration array with keys, labels, and emojis is duplicated across multiple files (DashboardView.tsx, SessionList.tsx, and SessionsView.tsx). This should be extracted to a shared constants file to maintain consistency and make updates easier.
| detailOpen: boolean; | ||
| detailExpanded: boolean; | ||
| detailPage: number; | ||
| detail?: any; |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type 'any' is used for the 'detail' prop. Consider creating a proper interface or importing SessionDetailData from the useSessionDetail hook for better type safety.
| detailOpen: boolean; | ||
| detailExpanded: boolean; | ||
| detailPage: number; | ||
| detail?: any; |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type 'any' is used for the 'detail' prop. This should use the SessionDetailData type from the useSessionDetail hook for better type safety.
src/tui/components/Sidebar.tsx
Outdated
|
|
||
| {/* Separator */} | ||
| <Box marginBottom={1}> | ||
| <Text dimColor>{'─'.repeat(18)}</Text> |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 18 for separator width is hardcoded. This should match the minWidth property (20) minus padding, or be calculated dynamically to ensure the separator line properly fits within the sidebar.
| }, | ||
| "dependencies": { | ||
| "@modelcontextprotocol/sdk": "^1.17.1", | ||
| "@types/react": "^19.2.7", |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @types/react package is listed in dependencies rather than devDependencies. Type definitions are typically development dependencies as they are not needed at runtime. Consider moving this to devDependencies unless there's a specific reason it needs to be a runtime dependency.
src/tui/views/SessionsView.tsx
Outdated
| > | ||
| <Text bold color="cyan">Session Details</Text> | ||
| <Text dimColor> | ||
| m: more/less • [{`[`}/{`]`} or PageUp/PageDown]: page transcript • Esc: close detail |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The keyboard shortcut display uses escaped square brackets ('[[]' and '[]]') which may be confusing. Consider simplifying this to make it more readable, or add a comment explaining this escaping is necessary for the template literal.
| m: more/less • [{`[`}/{`]`} or PageUp/PageDown]: page transcript • Esc: close detail | |
| m: more/less • [ [ / ] or PageUp/PageDown ]: page transcript • Esc: close detail |
| height, | ||
| padding = 1, | ||
| }) => { | ||
| const colorFn = (chalk as any)[borderColor] || chalk.cyan; |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable colorFn.
| @@ -0,0 +1,100 @@ | |||
| import React from 'react'; | |||
| import { Box, Text } from 'ink'; | |||
| import { format, getDay } from 'date-fns'; | |||
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import format.
| import { format, getDay } from 'date-fns'; | |
| import { getDay } from 'date-fns'; |
| }; | ||
|
|
||
| // Count active days (days with at least one session) | ||
| const activeDays = last28Days.filter(d => d.count > 0).length; |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable activeDays.
| const activeDays = last28Days.filter(d => d.count > 0).length; |
…ed organization and responsiveness - Moved platform emoji and name functions to constants for better code reuse. - Updated Sidebar component to dynamically calculate separator width for consistent layout. - Replaced hardcoded platform data in SessionsView with a centralized PLATFORMS constant for easier maintenance. - Removed redundant platform functions from SessionList and DashboardView for cleaner code.






This pull request introduces a new interactive TUI (Text User Interface) dashboard for managing and browsing local sessions, along with the necessary CLI command and supporting UI components. The dashboard provides a user-friendly way to view session statistics, browse sessions, filter/search, and navigate using keyboard shortcuts. The implementation includes new React components, hooks, and updates to documentation and dependencies.
Major additions and changes:
1. Interactive Dashboard Feature
sessionbase dashboardto launch an interactive dashboard for session management, including keyboard navigation and platform filtering. (README.md,src/commands/dashboard.ts,src/index.ts) [1] [2] [3] [4]2. Dashboard UI Architecture
App.tsx) for the dashboard, handling state, keyboard shortcuts, view switching (dashboard/sessions), search, filtering, and session detail navigation.MainContentcomponent to switch between the dashboard view and sessions view based on user input.Sidebarand other supporting UI elements for navigation and context (not shown in the diff but referenced inApp.tsx).3. Session Browsing and Search
SessionListcomponent for listing sessions with platform icons, previews, and details, supporting navigation and paging.SearchBarcomponent for searching/filtering sessions interactively.4. Dashboard Statistics and Visualization
ActivityHeatmapcomponent to visualize session activity over the last 28 days, showing active days and intensity.BorderedBoxcomponent for consistent UI framing.5. Dependency and Documentation Updates
package.jsonto include new dependencies required for the TUI (e.g.,ink,react,date-fns, and related types).README.mdwith usage instructions, dashboard features, and keyboard shortcuts. [1] [2]These changes collectively provide a robust, interactive way for users to manage and explore their sessions directly from the terminal.