Skip to content

Commit 51489eb

Browse files
committed
Merge remote-tracking branch 'origin/main' into sawka/block-indicators
2 parents 4c6fd13 + 4ec09cb commit 51489eb

File tree

166 files changed

+5586
-3195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+5586
-3195
lines changed

.github/copilot-instructions.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Wave Terminal — Copilot Instructions
2+
3+
## Project Rules
4+
5+
Read and follow all guidelines in [`.roo/rules/rules.md`](./.roo/rules/rules.md).
6+
7+
---
8+
9+
## Skill Guides
10+
11+
This project uses a set of "skill" guides — focused how-to documents for common implementation tasks. When your task matches one of the descriptions below, **read the linked SKILL.md file before proceeding** and follow its instructions precisely.
12+
13+
| Skill | Description |
14+
|-------|-------------|
15+
| [add-config](./.kilocode/skills/add-config/SKILL.md) | Guide for adding new configuration settings to Wave Terminal. Use when adding a new setting to the configuration system, implementing a new config key, or adding user-customizable settings. |
16+
| [add-rpc](./.kilocode/skills/add-rpc/SKILL.md) | Guide for adding new RPC calls to Wave Terminal. Use when implementing new RPC commands, adding server-client communication methods, or extending the RPC interface with new functionality. |
17+
| [add-wshcmd](./.kilocode/skills/add-wshcmd/SKILL.md) | Guide for adding new wsh commands to Wave Terminal. Use when implementing new CLI commands, adding command-line functionality, or extending the wsh command interface. |
18+
| [context-menu](./.kilocode/skills/context-menu/SKILL.md) | Guide for creating and displaying context menus in Wave Terminal. Use when implementing right-click menus, adding context menu items, creating submenus, or handling menu interactions with checkboxes and separators. |
19+
| [create-view](./.kilocode/skills/create-view/SKILL.md) | Guide for implementing a new view type in Wave Terminal. Use when creating a new view component, implementing the ViewModel interface, registering a new view type in BlockRegistry, or adding a new content type to display within blocks. |
20+
| [electron-api](./.kilocode/skills/electron-api/SKILL.md) | Guide for adding new Electron APIs to Wave Terminal. Use when implementing new frontend-to-electron communications via preload/IPC. |
21+
| [wps-events](./.kilocode/skills/wps-events/SKILL.md) | Guide for working with Wave Terminal's WPS (Wave PubSub) event system. Use when implementing new event types, publishing events, subscribing to events, or adding asynchronous communication between components. |
22+
23+
> **How skills work:** Each skill is a self-contained guide covering the exact files to edit, patterns to follow, and steps to take for a specific type of task in this codebase. If your task matches a skill's description, open that SKILL.md and treat it as your primary reference for the implementation.

.github/workflows/copilot-setup-steps.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77
pull_request:
88
paths: [.github/workflows/copilot-setup-steps.yml]
99

10-
env:
11-
GO_VERSION: "1.25.6"
12-
NODE_VERSION: 22
10+
# Note: global env vars are NOT used here — they are not reliable in all
11+
# GitHub Actions contexts (e.g. Copilot setup steps). Values are inlined
12+
# directly into each step that needs them.
1313

1414
jobs:
1515
copilot-setup-steps:
@@ -23,12 +23,12 @@ jobs:
2323
# Go + Node versions match your helper
2424
- uses: actions/setup-go@v6
2525
with:
26-
go-version: ${{ env.GO_VERSION }}
26+
go-version: "1.25.6"
2727
cache-dependency-path: go.sum
2828

2929
- uses: actions/setup-node@v6
3030
with:
31-
node-version: ${{ env.NODE_VERSION }}
31+
node-version: 22
3232
cache: npm
3333
cache-dependency-path: package-lock.json
3434

@@ -60,4 +60,8 @@ jobs:
6060
GIT_TERMINAL_PROMPT: "0"
6161

6262
- name: Pre-fetch Go modules
63-
run: go mod download
63+
env:
64+
GOTOOLCHAIN: auto
65+
run: |
66+
go version
67+
go mod download

.kilocode/rules/overview.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Wave Terminal - High Level Architecture Overview
2+
3+
## Project Description
4+
5+
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.
6+
7+
## Top-Level Directory Structure
8+
9+
```
10+
waveterm/
11+
├── emain/ # Electron main process code
12+
├── frontend/ # React application (renderer process)
13+
├── cmd/ # Go command-line applications
14+
├── pkg/ # Go packages/modules
15+
├── db/ # Database migrations
16+
├── docs/ # Documentation (Docusaurus)
17+
├── build/ # Build configuration and assets
18+
├── assets/ # Application assets (icons, images)
19+
├── public/ # Static public assets
20+
├── tests/ # Test files
21+
├── .github/ # GitHub workflows and configuration
22+
└── Configuration files (package.json, tsconfig.json, etc.)
23+
```
24+
25+
## Architecture Components
26+
27+
### 1. Electron Main Process (`emain/`)
28+
29+
The Electron main process handles the native desktop application layer:
30+
31+
**Key Files:**
32+
33+
- [`emain.ts`](emain/emain.ts) - Main entry point, application lifecycle management
34+
- [`emain-window.ts`](emain/emain-window.ts) - Window management (`WaveBrowserWindow` class)
35+
- [`emain-tabview.ts`](emain/emain-tabview.ts) - Tab view management (`WaveTabView` class)
36+
- [`emain-wavesrv.ts`](emain/emain-wavesrv.ts) - Go backend server integration
37+
- [`emain-wsh.ts`](emain/emain-wsh.ts) - WSH (Wave Shell) client integration
38+
- [`emain-ipc.ts`](emain/emain-ipc.ts) - IPC handlers for frontend ↔ main process communication
39+
- [`emain-menu.ts`](emain/emain-menu.ts) - Application menu system
40+
- [`updater.ts`](emain/updater.ts) - Auto-update functionality
41+
- [`preload.ts`](emain/preload.ts) - Preload script for renderer security
42+
- [`preload-webview.ts`](emain/preload-webview.ts) - Webview preload script
43+
44+
### 2. Frontend React Application (`frontend/`)
45+
46+
The React application runs in the Electron renderer process:
47+
48+
**Structure:**
49+
50+
```
51+
frontend/
52+
├── app/ # Main application code
53+
│ ├── app.tsx # Root App component
54+
│ ├── aipanel/ # AI panel UI
55+
│ ├── block/ # Block-based UI components
56+
│ ├── element/ # Reusable UI elements
57+
│ ├── hook/ # Custom React hooks
58+
│ ├── modals/ # Modal components
59+
│ ├── store/ # State management (Jotai)
60+
│ ├── tab/ # Tab components
61+
│ ├── view/ # Different view types
62+
│ │ ├── codeeditor/ # Code editor (Monaco)
63+
│ │ ├── preview/ # File preview
64+
│ │ ├── sysinfo/ # System info view
65+
│ │ ├── term/ # Terminal view
66+
│ │ ├── tsunami/ # Tsunami builder view
67+
│ │ ├── vdom/ # Virtual DOM view
68+
│ │ ├── waveai/ # AI chat integration
69+
│ │ ├── waveconfig/ # Config editor view
70+
│ │ └── webview/ # Web view
71+
│ └── workspace/ # Workspace management
72+
├── builder/ # Builder app entry
73+
├── layout/ # Layout system
74+
├── preview/ # Standalone preview renderer
75+
├── types/ # TypeScript type definitions
76+
└── util/ # Utility functions
77+
```
78+
79+
**Key Technologies:**
80+
81+
- Electron (desktop application shell)
82+
- React 19 with TypeScript
83+
- Jotai for state management
84+
- Monaco Editor for code editing
85+
- XTerm.js for terminal emulation
86+
- Tailwind CSS v4 for styling
87+
- SCSS for additional styling (deprecated, new components should use Tailwind)
88+
- Vite / electron-vite for bundling
89+
- Task (Taskfile.yml) for build and code generation commands
90+
91+
### 3. Go Backend Server (`cmd/server/`)
92+
93+
The Go backend server handles all heavy lifting operations:
94+
95+
**Entry Point:** [`main-server.go`](cmd/server/main-server.go)
96+
97+
### 4. Go Packages (`pkg/`)
98+
99+
The Go codebase is organized into modular packages:
100+
101+
**Key Packages:**
102+
103+
- `wstore/` - Database and storage layer
104+
- `wconfig/` - Configuration management
105+
- `wcore/` - Core business logic
106+
- `wshrpc/` - RPC communication system
107+
- `wshutil/` - WSH (Wave Shell) utilities
108+
- `blockcontroller/` - Block execution management
109+
- `remote/` - Remote connection handling
110+
- `filestore/` - File storage system
111+
- `web/` - Web server and WebSocket handling
112+
- `telemetry/` - Usage analytics and telemetry
113+
- `waveobj/` - Core data objects
114+
- `service/` - Service layer
115+
- `wps/` - Wave PubSub event system
116+
- `waveai/` - AI functionality
117+
- `shellexec/` - Shell execution
118+
- `util/` - Common utilities
119+
120+
### 5. Command Line Tools (`cmd/`)
121+
122+
Key Go command-line utilities:
123+
124+
- `wsh/` - Wave Shell command-line tool
125+
- `server/` - Main backend server
126+
- `generatego/` - Code generation
127+
- `generateschema/` - Schema generation
128+
- `generatets/` - TypeScript generation
129+
130+
## Communication Architecture
131+
132+
The 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).
133+
134+
### WSH RPC System (`pkg/wshrpc/`)
135+
136+
The WSH RPC system is the backbone of Wave Terminal's communication architecture:
137+
138+
**Key Components:**
139+
140+
- [`wshrpctypes.go`](pkg/wshrpc/wshrpctypes.go) - Core RPC interface and type definitions (source of truth for all RPC commands)
141+
- [`wshserver/`](pkg/wshrpc/wshserver/) - Server-side RPC implementation
142+
- [`wshremote/`](pkg/wshrpc/wshremote/) - Remote connection handling
143+
- [`wshclient.go`](pkg/wshrpc/wshclient.go) - Go client for making RPC calls
144+
- [`frontend/app/store/wshclientapi.ts`](frontend/app/store/wshclientapi.ts) - Generated TypeScript RPC client
145+
146+
**Routing:** 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.
147+
148+
## Development Notes
149+
150+
- **Build commands** - Use `task` (Taskfile.yml) for all build, generate, and packaging commands
151+
- **Code generation** - Run `task generate` after modifying Go types in `pkg/wshrpc/wshrpctypes.go`, `pkg/wconfig/settingsconfig.go`, or `pkg/waveobj/wtypemeta.go`
152+
- **Testing** - Vitest for frontend unit tests; standard `go test` for Go packages
153+
- **Database migrations** - SQL migration files in `db/migrations-wstore/` and `db/migrations-filestore/`
154+
- **Documentation** - Docusaurus site in `docs/`

0 commit comments

Comments
 (0)