.roo/rules/overview.md
Wave Terminal is an open-source AI-native terminal built for seamless workflows. It's an Electron application that serves as a command line terminal host (it hosts CLI applications rather than running inside a CLI). The application combines a React frontend with a Go backend server to provide a modern terminal experience with advanced features.
waveterm/
├── emain/ # Electron main process code
├── frontend/ # React application (renderer process)
├── cmd/ # Go command-line applications
├── pkg/ # Go packages/modules
├── db/ # Database migrations
├── docs/ # Documentation (Docusaurus)
├── build/ # Build configuration and assets
├── assets/ # Application assets (icons, images)
├── public/ # Static public assets
├── tests/ # Test files
├── .github/ # GitHub workflows and configuration
└── Configuration files (package.json, tsconfig.json, etc.)
emain/)The Electron main process handles the native desktop application layer:
Key Files:
emain.ts - Main entry point, application lifecycle managementemain-window.ts - Window management (WaveBrowserWindow class)emain-tabview.ts - Tab view management (WaveTabView class)emain-wavesrv.ts - Go backend server integrationemain-wsh.ts - WSH (Wave Shell) client integrationemain-ipc.ts - IPC handlers for frontend ↔ main process communicationemain-menu.ts - Application menu systemupdater.ts - Auto-update functionalitypreload.ts - Preload script for renderer securitypreload-webview.ts - Webview preload scriptfrontend/)The React application runs in the Electron renderer process:
Structure:
frontend/
├── app/ # Main application code
│ ├── app.tsx # Root App component
│ ├── aipanel/ # AI panel UI
│ ├── block/ # Block-based UI components
│ ├── element/ # Reusable UI elements
│ ├── hook/ # Custom React hooks
│ ├── modals/ # Modal components
│ ├── store/ # State management (Jotai)
│ ├── tab/ # Tab components
│ ├── view/ # Different view types
│ │ ├── codeeditor/ # Code editor (Monaco)
│ │ ├── preview/ # File preview
│ │ ├── sysinfo/ # System info view
│ │ ├── term/ # Terminal view
│ │ ├── tsunami/ # Tsunami builder view
│ │ ├── vdom/ # Virtual DOM view
│ │ ├── waveai/ # AI chat integration
│ │ ├── waveconfig/ # Config editor view
│ │ └── webview/ # Web view
│ └── workspace/ # Workspace management
├── builder/ # Builder app entry
├── layout/ # Layout system
├── preview/ # Standalone preview renderer
├── types/ # TypeScript type definitions
└── util/ # Utility functions
Key Technologies:
cmd/server/)The Go backend server handles all heavy lifting operations:
Entry Point: main-server.go
pkg/)The Go codebase is organized into modular packages:
Key Packages:
wstore/ - Database and storage layerwconfig/ - Configuration managementwcore/ - Core business logicwshrpc/ - RPC communication systemwshutil/ - WSH (Wave Shell) utilitiesblockcontroller/ - Block execution managementremote/ - Remote connection handlingfilestore/ - File storage systemweb/ - Web server and WebSocket handlingtelemetry/ - Usage analytics and telemetrywaveobj/ - Core data objectsservice/ - Service layerwps/ - Wave PubSub event systemwaveai/ - AI functionalityshellexec/ - Shell executionutil/ - Common utilitiescmd/)Key Go command-line utilities:
wsh/ - Wave Shell command-line toolserver/ - Main backend servergeneratego/ - Code generationgenerateschema/ - Schema generationgeneratets/ - TypeScript generationThe core communication system is built around the WSH RPC (Wave Shell RPC) system, which provides a unified interface for all inter-process communication: frontend ↔ Go backend, Electron main process ↔ backend, and backend ↔ remote systems (SSH, WSL).
pkg/wshrpc/)The WSH RPC system is the backbone of Wave Terminal's communication architecture:
Key Components:
wshrpctypes.go - Core RPC interface and type definitions (source of truth for all RPC commands)wshserver/ - Server-side RPC implementationwshremote/ - Remote connection handlingwshclient.go - Go client for making RPC callsfrontend/app/store/wshclientapi.ts - Generated TypeScript RPC clientRouting: Callers address RPC calls using routes (e.g. a block ID, connection name, or "waveapp") rather than caring about the underlying transport. The RPC layer resolves the route to the correct transport (WebSocket, Unix socket, SSH tunnel, stdio) automatically. This means the same RPC interface works whether the target is local or a remote SSH connection.
task (Taskfile.yml) for all build, generate, and packaging commandstask generate after modifying Go types in pkg/wshrpc/wshrpctypes.go, pkg/wconfig/settingsconfig.go, or pkg/waveobj/wtypemeta.gogo test for Go packagesdb/migrations-wstore/ and db/migrations-filestore/docs/