Shell App
Features & Capabilities
Shell App - Features & Capabilities Report
Template Version: 1.0.0 Generated: 2026-01-22 Package:
@epicdm/flowstate-app-shellApp ID:shell
Table of Contents
- Overview
- App Identity
- Feature Categories
- Capabilities
- Data Models
- User Workflows
- Integration Points
- Commands & Keybindings
- Architecture Summary
- Quality & Compliance
Overview
Purpose
The Shell App is a terminal application for FlowState that provides a full-featured terminal experience with session persistence, context-aware sessions, and seamless integration with the FlowState ecosystem. It enables developers and power users to execute shell commands within FlowState while maintaining context association with projects, milestones, and tasks.
Target Users
| User Type | Description | Primary Use Cases |
|---|---|---|
| Developers | Software engineers writing code | Run build commands, view logs, execute tests |
| DevOps Engineers | Infrastructure and deployment specialists | Server administration, deployment automation |
| System Administrators | IT system managers | System monitoring, configuration management |
| Power Users | Advanced FlowState users | Command-line operations, scripting |
Value Proposition
- Integrated Terminal: Full xterm.js terminal within FlowState
- Session Persistence: Sessions survive browser refreshes and reconnections
- Context Awareness: Link terminal sessions to projects, milestones, and tasks
- Multi-Session: Run multiple terminals simultaneously
- Bottom Panel Integration: Use as embedded panel in other apps
- Cross-Platform: Works in web browser and Electron desktop app
App Identity
| Property | Value |
|---|---|
| ID | shell |
| Display Name | Terminal Shell |
| Package Name | @epicdm/flowstate-app-shell |
| Version | 1.0.0 |
| Category | technical |
| Icon | Terminal |
| Color | #10b981 (emerald-500) |
| Base Path | /shell |
| Permissions | database, notifications |
Entry Points
| Entry Point | Path | Description |
|---|---|---|
| Main Export | src/index.ts | Primary package export |
| Standalone | src/standalone.tsx | Standalone app entry |
| App Component | src/ShellApp.tsx | Main React component with routing |
| Plugin | src/plugin.ts | FlowState plugin registration |
Feature Categories
Category 1: Terminal Emulation
Core terminal functionality powered by xterm.js
Feature: xterm.js Terminal
| Property | Details |
|---|---|
| ID | terminal-emulation |
| Status | Implemented |
| Priority | High |
Description: Full-featured terminal emulator using xterm.js with proper cursor handling, ANSI color support, and bidirectional I/O through WebSocket adapters.
User Story: As a developer, I want a real terminal in FlowState so that I can run commands without leaving the application.
Acceptance Criteria:
- [x] Full xterm.js terminal rendering
- [x] ANSI color and formatting support
- [x] Cursor positioning and movement
- [x] Input handling with proper key translation
- [x] Resize handling with terminal dimensions
Implementation:
| Component | Path | Purpose |
|---|---|---|
| IntegratedTerminalTab | src/components/IntegratedTerminalTab.tsx | Main terminal component |
| TerminalPanelRenderer | src/components/TerminalPanelRenderer.tsx | Bottom panel integration |
| createShellServerAdapter | src/components/IntegratedTerminalTab.tsx | Terminal adapter bridge |
Routes:
/terminal- Full page terminal view
Category 2: Session Management
Create, manage, and persist terminal sessions
Feature: Session CRUD Operations
| Property | Details |
|---|---|
| ID | session-crud |
| Status | Implemented |
| Priority | High |
Description: Full session lifecycle management including creation with context, renaming, closing, and deletion with optional database removal.
User Story: As a user, I want to manage multiple terminal sessions so that I can organize my work by context.
Acceptance Criteria:
- [x] Create new sessions with display name
- [x] Associate sessions with org/workspace/project/milestone/task
- [x] Rename existing sessions
- [x] Close sessions (keep history for reconnection)
- [x] Delete sessions (remove from server and optionally database)
- [x] Session list with selection
Implementation:
| Component | Path | Purpose |
|---|---|---|
| SessionForm | src/components/SessionForm.tsx | Session create/edit form |
| IntegratedTerminalTab | src/components/IntegratedTerminalTab.tsx | Session list UI |
| useTerminalSessions | src/hooks/useTerminalSessions.ts | Session state management |
Feature: Session Persistence
| Property | Details |
|---|---|
| ID | session-persistence |
| Status | Implemented |
| Priority | High |
Description: Sessions are persisted to RxDB with full context metadata, enabling recovery after disconnection and cross-device access through replication.
User Story: As a user, I want my sessions to persist so that I can reconnect to them after refreshing or closing the browser.
Acceptance Criteria:
- [x] Save sessions to RxDB on creation
- [x] Load sessions from RxDB on startup
- [x] Sync sessions with shell server state
- [x] Update session metadata (rename, context) in database
- [x] Handle reconnection to existing sessions
Implementation:
| Component | Path | Purpose |
|---|---|---|
| useTerminalSessions | src/hooks/useTerminalSessions.ts | RxDB persistence logic |
| syncSessionsWithRxDB | src/hooks/useTerminalSessions.ts | Server-to-RxDB sync |
Feature: Context-Aware Sessions
| Property | Details |
|---|---|
| ID | context-sessions |
| Status | Implemented |
| Priority | Medium |
Description: Sessions can be linked to the FlowState entity hierarchy (Org > Workspace > Project > Milestone > Task) for organization and filtering.
User Story: As a project manager, I want to associate terminal sessions with tasks so that I can track what commands were run for each piece of work.
Acceptance Criteria:
- [x] Select workspace when creating session
- [x] Optionally select project, milestone, task
- [x] Display context breadcrumb in session form
- [x] Cascade-clear child selections when parent changes
- [x] Store context in both shell server and RxDB
Implementation:
| Component | Path | Purpose |
|---|---|---|
| SessionForm | src/components/SessionForm.tsx | Context selection UI |
| CollectionSelectField | Framework | Dropdown for entity selection |
Category 3: WebSocket Communication
Real-time bidirectional communication with shell server
Feature: Shell Server Connection
| Property | Details |
|---|---|
| ID | shell-server-connection |
| Status | Implemented |
| Priority | High |
Description: WebSocket connection management with auto-connect, auto-reconnect, and connection status tracking.
User Story: As a user, I want reliable connection to the shell server so that my terminal sessions work consistently.
Acceptance Criteria:
- [x] Connect to shell server via WebSocket
- [x] Auto-connect on component mount
- [x] Auto-reconnect on disconnection
- [x] Display connection status
- [x] Manual connect/disconnect controls
- [x] Error handling and display
Implementation:
| Component | Path | Purpose |
|---|---|---|
| useShellServer | src/hooks/useShellServer.ts | WebSocket connection hook |
| ShellHeader | src/components/ShellHeader.tsx | Connection status display |
Feature: Message Protocol
| Property | Details |
|---|---|
| ID | message-protocol |
| Status | Implemented |
| Priority | High |
Description: JSON-based message protocol for all shell operations including session management, data transfer, and session updates.
User Story: As a developer, I want a clear API for shell operations so that the terminal works reliably.
Acceptance Criteria:
- [x] Send: list, create, reconnect, data, resize, close, delete, rename, update
- [x] Receive: sessions, created, reconnected, data, exit, session_ended, renamed, session_deleted, session_updated, error
- [x] Handle all message types appropriately
- [x] Forward data to correct terminal instance
Implementation:
| Component | Path | Purpose |
|---|---|---|
| useShellServer | src/hooks/useShellServer.ts | Message send methods |
| handleServerMessage | src/hooks/useTerminalSessions.ts | Message receive handler |
Category 4: UI Components
User interface for terminal and session management
Feature: Session List Sidebar
| Property | Details |
|---|---|
| ID | session-list |
| Status | Implemented |
| Priority | Medium |
Description: Sidebar showing all terminal sessions with selection, status indicators, and context actions.
User Story: As a user, I want to see all my sessions so that I can switch between them easily.
Acceptance Criteria:
- [x] Display list of all sessions
- [x] Show session display name
- [x] Indicate selected session
- [x] Support session selection
- [x] Configurable sidebar width
- [x] Toggle sidebar visibility
Implementation:
| Component | Path | Purpose |
|---|---|---|
| IntegratedTerminalTab | src/components/IntegratedTerminalTab.tsx | Session list rendering |
| TerminalTab | Framework | Session list UI component |
Feature: Connection Status Display
| Property | Details |
|---|---|
| ID | connection-status |
| Status | Implemented |
| Priority | Low |
Description: Visual indicators for server connection status with color-coded badges and retry options.
User Story: As a user, I want to know if I'm connected so that I understand why my terminal might not be responding.
Acceptance Criteria:
- [x] Status indicator (connected, connecting, disconnected, error)
- [x] Color-coded status (green, yellow, gray, red)
- [x] Connect button when disconnected
- [x] Retry button on error
- [x] Loading spinner during connection
Implementation:
| Component | Path | Purpose |
|---|---|---|
| ShellHeader | src/components/ShellHeader.tsx | Header with status |
| IntegratedTerminalTab | src/components/IntegratedTerminalTab.tsx | Status overlay |
Category 5: Plugin System
FlowState plugin integration
Feature: App Plugin Registration
| Property | Details |
|---|---|
| ID | plugin-registration |
| Status | Implemented |
| Priority | Medium |
Description: Plugin definition for registration with FlowState's HostContainer system, enabling lazy loading and lifecycle hooks.
User Story: As a FlowState developer, I want the shell app to integrate with the plugin system so that it loads efficiently.
Acceptance Criteria:
- [x] Plugin definition with id, name, version
- [x] Lazy component loading
- [x] Lifecycle hooks (onLoad, onUnload)
- [x] Route and basePath configuration
- [x] Icon and color metadata
Implementation:
| Component | Path | Purpose |
|---|---|---|
| shellPlugin | src/plugin.ts | Plugin definition |
Feature: Plugin Manifest
| Property | Details |
|---|---|
| ID | plugin-manifest |
| Status | Implemented |
| Priority | Medium |
Description: Plugin manifest with contributions for commands, keybindings, toolbar items, and settings tabs.
User Story: As a user, I want terminal shortcuts and toolbar buttons so that I can work efficiently.
Acceptance Criteria:
- [x] Register terminal commands
- [x] Define keyboard shortcuts
- [x] Add bottom panel toolbar items
- [x] Configure settings tab
Implementation:
| Component | Path | Purpose |
|---|---|---|
| shellManifest | src/manifest.ts | Plugin manifest |
Category 6: Bottom Panel Integration
Integration with FlowState's bottom panel system
Feature: Terminal Panel Renderer
| Property | Details |
|---|---|
| ID | bottom-panel |
| Status | Implemented |
| Priority | Medium |
Description: Panel renderer component for embedding terminal in FlowState's bottom panel, used by other apps like ElectronShell and NextShell.
User Story: As a user, I want the terminal in a bottom panel so that I can see it alongside my main work.
Acceptance Criteria:
- [x] Panel renderer component for BottomPanel
- [x] Export panelRenderers map
- [x] Support dark/light color modes
- [x] Configurable session list width
- [x] Tab-based panel identification
Implementation:
| Component | Path | Purpose |
|---|---|---|
| TerminalPanelRenderer | src/components/TerminalPanelRenderer.tsx | Panel renderer |
| bottomPanelRenderers | src/bottomPanelRenderers.ts | Renderer registry |
Capabilities
Core Capabilities
| Capability | Description | Implementation |
|---|---|---|
| Terminal Emulation | Full xterm.js terminal | Adapter pattern with Terminal component |
| Session Management | Create, rename, close, delete | useTerminalSessions hook |
| Session Persistence | RxDB storage with sync | Sessions collection integration |
| Context Association | Link to project hierarchy | SessionForm with CollectionSelectField |
| WebSocket Communication | Real-time bidirectional | useShellServer hook |
Technical Capabilities
| Capability | Status | Notes |
|---|---|---|
| CRUD Operations | Yes | Full session lifecycle |
| Real-time Updates | Yes | WebSocket messaging |
| Offline Support | Partial | Sessions persist, server required for terminal |
| Auto-Reconnect | Yes | Configurable reconnect with backoff |
| Multi-Session | Yes | Concurrent sessions with switching |
| History Recovery | Yes | Output history on reconnect |
Integration Capabilities
| Integration | Type | Description |
|---|---|---|
| FlowState Framework | internal | App container, auth, layout |
| Shell Server | internal | WebSocket terminal server |
| RxDB | internal | Session persistence |
| Electron | internal | Desktop app integration |
Data Models
Collections Used
| Collection | Description | Operations | Primary Hook |
|---|---|---|---|
sessions | Terminal session records | CRUD, Query | useTerminalSessions |
workspaces | Workspace lookup | Query | SessionForm |
projects | Project lookup | Query | SessionForm |
milestones | Milestone lookup | Query | SessionForm |
tasks | Task lookup | Query | SessionForm |
Entity Relationships
Session
|
+-- Org (belongsTo)
|
+-- Workspace (belongsTo)
|
+-- Project (belongsTo, optional)
| |
| +-- Milestone (belongsTo, optional)
| |
| +-- Task (belongsTo, optional)
|
+-- User (belongsTo)
|
+-- Codebase (belongsTo)
Session Model Fields
| Field | Type | Description |
|---|---|---|
id | string | Session identifier (matches shell server) |
orgId | string | Organization ID |
userId | string | User ID |
codebaseId | string | Codebase ID |
workspaceId | string | Workspace ID |
projectId | string? | Optional project ID |
milestoneId | string? | Optional milestone ID |
taskId | string? | Optional task ID |
sessionType | 'terminal' | Session type discriminator |
context | object | Display name, server URL, status |
archived | boolean | Soft delete flag |
createdAt | string | ISO timestamp |
updatedAt | string | ISO timestamp |
Key Data Flows
User Action --> Component --> Hook --> Shell Server --> Terminal Output
|
+--> RxDB (persistence)
|
+--> Replication --> Other Devices
User Workflows
Workflow 1: Create Terminal Session
Create a new terminal with project context
Trigger: Click "New Terminal" or press Ctrl+Shift+`
Steps:
| Step | Action | Component | Outcome |
|---|---|---|---|
| 1 | Open create form | IntegratedTerminalTab | Form displayed |
| 2 | Enter display name | SessionForm | Name set |
| 3 | Select workspace | CollectionSelectField | Workspace set |
| 4 | Select project (optional) | CollectionSelectField | Project set |
| 5 | Click Connect | SessionForm | Session created |
| 6 | Terminal opens | Terminal | Ready for input |
Success Outcome: New terminal session connected and ready Failure Handling: Connection error shown with retry option
Workflow 2: Reconnect to Session
Reconnect to a disconnected session
Trigger: Click on disconnected session in list
Steps:
| Step | Action | Component | Outcome |
|---|---|---|---|
| 1 | Select session | IntegratedTerminalTab | Session highlighted |
| 2 | Auto-reconnect | useTerminalSessions | Reconnect message sent |
| 3 | Receive history | handleServerMessage | History written to terminal |
| 4 | Session connected | Terminal | Ready for input |
Success Outcome: Session reconnected with history restored Failure Handling: If session not found, creates new session with same context
Workflow 3: Delete Session
Permanently delete a terminal session
Trigger: Delete action on session
Steps:
| Step | Action | Component | Outcome |
|---|---|---|---|
| 1 | Click delete | IntegratedTerminalTab | Confirmation shown |
| 2 | Confirm delete | Dialog | Delete initiated |
| 3 | Server notified | useShellServer | Session killed |
| 4 | RxDB updated | useTerminalSessions | Document removed |
| 5 | UI updated | setSessions | Session removed from list |
Success Outcome: Session completely removed Failure Handling: Conflict errors ignored (already deleted)
State Transitions
Connection Status States
┌──────────────┐ connect ┌────────────┐ open ┌───────────┐
│ disconnected │─────────────▶│ connecting │─────────▶│ connected │
└──────────────┘ └────────────┘ └───────────┘
▲ │ │
│ │ error │ close
│ ▼ │
│ ┌───────────┐ │
└──────────────────────│ error │◀────────────────┘
(auto-reconnect) └───────────┘
| From State | To State | Trigger | Side Effects |
|---|---|---|---|
| disconnected | connecting | connect() | WebSocket created |
| connecting | connected | onopen | Status updated, sessions listed |
| connecting | error | onerror | Error message set |
| connected | disconnected | onclose | Auto-reconnect scheduled |
| error | connecting | retry | Reconnect attempt |
Session Status States
┌───────────────┐ select ┌────────────┐ data ┌───────────┐
│ disconnected │───────────▶│ connecting │─────────▶│ connected │
└───────────────┘ └────────────┘ └───────────┘
▲ │
│ │ exit
└───────────────────────────────────────────────────┘
Integration Points
Internal Integrations
| Integration | Package | Purpose |
|---|---|---|
| FlowState Framework | @epicdm/flowstate-app-framework | App container, auth, layout |
| Shell Components | @epicdm/flowstate-shell | Terminal, TerminalProvider |
| Shell Core | @epicdm/flowstate-shell-core | Terminal adapter interface |
| Shell Server | @epicdm/flowstate-shell-server | WebSocket server types |
| RxDB React | @epicdm/flowstate-rxdb-react | Reactive data queries |
| Collections | @epicdm/flowstate-collections | Data model types |
External Integrations
| Integration | Type | Configuration |
|---|---|---|
| xterm.js | Library | Terminal rendering |
| WebSocket | API | Shell server communication |
| Electron API | API | Desktop shell server URL |
MCP Integration
| Tool | Purpose | Example Usage |
|---|---|---|
collection-query | Query sessions | {"collection": "sessions", "selector": {"sessionType": "terminal"}} |
collection-create | Create session | {"collection": "sessions", "data": {...}} |
collection-update | Update session | {"collection": "sessions", "id": "...", "data": {...}} |
Commands & Keybindings
Registered Commands
| Command ID | Title | Icon | Category |
|---|---|---|---|
shell.newTerminal | New Terminal | Plus | Terminal |
shell.closeTerminal | Close Terminal | X | Terminal |
shell.renameTerminal | Rename Terminal | Edit | Terminal |
shell.clearTerminal | Clear Terminal | Trash2 | Terminal |
shell.splitTerminal | Split Terminal | Columns | Terminal |
shell.openSettings | Terminal Settings | Settings | Terminal |
shell.focusTerminal | Focus Terminal | Terminal | Terminal |
Keybindings
| Command | Windows/Linux | macOS | Context |
|---|---|---|---|
| New Terminal | Ctrl+Shift+` | Cmd+Shift+` | Global |
| Clear Terminal | Ctrl+K | Cmd+K | terminalFocused |
| Focus Terminal | Ctrl+` | Cmd+` | Global |
Toolbar Items
| Item ID | Tab ID | Icon | Command | Priority |
|---|---|---|---|---|
shell.toolbar.new | core.terminal | Plus | shell.newTerminal | 10 |
shell.toolbar.split | core.terminal | Columns | shell.splitTerminal | 20 |
shell.toolbar.clear | core.terminal | Trash2 | shell.clearTerminal | 30 |
shell.toolbar.settings | core.terminal | Settings | shell.openSettings | 100 |
Architecture Summary
Directory Structure
src/
├── components/ # UI components
│ ├── IntegratedTerminalTab.tsx # Main terminal with sessions
│ ├── TerminalPanelRenderer.tsx # Bottom panel renderer
│ ├── SessionForm.tsx # Session create/edit form
│ ├── ShellSidebar.tsx # App navigation sidebar
│ └── ShellHeader.tsx # Connection status header
├── hooks/ # Custom React hooks
│ ├── index.ts # Hook exports
│ ├── useShellServer.ts # WebSocket connection
│ └── useTerminalSessions.ts # Session management
├── pages/ # Page components
│ ├── TerminalPage.tsx # Full page terminal
│ ├── SettingsPage.tsx # Settings page
│ └── AboutPage.tsx # About page
├── ShellApp.tsx # Main app component
├── plugin.ts # Plugin definition
├── manifest.ts # Plugin manifest
├── bottomPanelRenderers.ts # Panel renderer registry
├── index.ts # Package exports
└── standalone.tsx # Standalone entry
Key Architectural Patterns
| Pattern | Usage | Example |
|---|---|---|
| Adapter Pattern | Terminal I/O abstraction | ShellServerAdapter |
| State Management | React hooks + refs | useTerminalSessions |
| Message Passing | WebSocket JSON protocol | useShellServer |
| Plugin System | Lazy loading + manifest | shellPlugin |
| Provider Pattern | Terminal context | TerminalProvider |
Hooks Overview
| Hook | Purpose | Returns |
|---|---|---|
useShellServer | WebSocket connection | { status, connect, disconnect, send, onMessage } |
useTerminalSessions | Session management | { sessions, createSession, selectSession, ... } |
Component Overview
| Component | Responsibility | Key Props |
|---|---|---|
ShellApp | Main app with routing | config, serverUrl |
IntegratedTerminalTab | Terminal + session UI | tab, serverUrl, colorMode |
TerminalPanelRenderer | Bottom panel wrapper | tab |
SessionForm | Session create/edit | mode, onSubmit, onCancel |
ShellSidebar | Navigation links | None |
ShellHeader | Connection status | serverUrl, status |
Quality & Compliance
Test Coverage
| Test Type | Location | Coverage Target |
|---|---|---|
| Unit Tests | src/**/__tests__/ | >= 80% |
| Hook Tests | src/hooks/__tests__/ | >= 80% |
| Component Tests | src/components/__tests__/ | >= 80% |
Accessibility
| Requirement | Status | Notes |
|---|---|---|
| WCAG 2.1 AA | In Progress | Terminal inherits xterm.js a11y |
| Keyboard Navigation | Yes | Full keyboard control |
| Screen Reader Support | Partial | Limited by xterm.js |
| Focus Management | Yes | Auto-focus on session select |
Security Considerations
| Consideration | Implementation |
|---|---|
| WebSocket Security | WSS support for production |
| Input Validation | Server-side command validation |
| Session Isolation | Per-user session filtering |
| Context Isolation | Org/workspace scope enforcement |
FlowState Alignment
Spec-Driven Development
This app follows the FlowState Standard for spec-driven development:
- Requirements:
.flowstate/specs/{{feature-name}}/requirements.md - Design:
.flowstate/specs/{{feature-name}}/design.md - Wireframes:
.flowstate/specs/{{feature-name}}/wireframes.html - Tasks:
.flowstate/specs/{{feature-name}}/tasks.md
Quality Gates
| Gate | Requirement | Status |
|---|---|---|
| Test Coverage | >= 80% statements | In Progress |
| TypeScript Strict | No any without justification | Pass |
| Accessibility | WCAG 2.1 AA | In Progress |
| Documentation | 100% TSDoc on public APIs | In Progress |
| Security | No critical vulnerabilities | Pass |
Appendix
Related Documentation
| Document | Location | Purpose |
|---|---|---|
| FLOWSTATE.md | .flowstate/docs/FLOWSTATE.md | Development workflow |
| TDD.md | .flowstate/steering/TDD.md | Testing standards |
| QUALITY.md | .flowstate/steering/QUALITY.md | Code quality |
Version History
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0.0 | 2026-01-22 | Claude | Initial documentation |