|
53 | 53 |
|
54 | 54 | --- |
55 | 55 |
|
56 | | -# **Mountain** ⛰️ |
| 56 | +# **Mountain** ⛰️ |
57 | 57 |
|
58 | | -The Bedrock of Land: Native Backend & Service Host |
| 58 | +> **The RAM tax is not optional.** VS Code with a medium project: 500 MB to |
| 59 | +> 1.5 GB of RAM. Three open windows means three Chromium renderer processes, |
| 60 | +> each carrying a full heap. Every OS interaction crosses a serialized JSON IPC |
| 61 | +> pipe. |
59 | 62 |
|
60 | | -[](https://github.com/CodeEditorLand/Mountain/tree/Current/LICENSE) |
61 | | -[](https://www.rust-lang.org/) |
62 | | -[](https://tauri.app/) |
63 | | -[](https://github.com/hyperium/tonic) |
64 | | - |
65 | | -Mountain is the native process manager that replaces Electron. Built with Rust |
66 | | -and Tauri, it handles windows, files, processes, and extensions at native speed. |
67 | | -Where Electron takes milliseconds, Mountain responds in microseconds. |
68 | | - |
69 | | -Your editor starts faster, uses less RAM, and stays responsive with hundreds of |
70 | | -files open. |
| 63 | +_"Where Electron takes 200 ms to open a dialog, Mountain takes 2."_ |
71 | 64 |
|
72 | | -**What Mountain gives you:** |
| 65 | +[](https://github.com/CodeEditorLand/Mountain/tree/Current/LICENSE) |
| 66 | +[<img src="https://cdn.simpleicons.org/rust" width="14" alt="Rust" />](https://www.rust-lang.org/) [](https://www.rust-lang.org/) |
| 67 | +[<img src="https://cdn.simpleicons.org/tauri/24C8D8" width="14" alt="Tauri" />](https://tauri.app/) [](https://tauri.app/) |
| 68 | +[<img src="https://cdn.simpleicons.org/grpc" width="14" alt="gRPC" />](https://grpc.io/) [](https://github.com/hyperium/tonic) |
73 | 69 |
|
74 | | -1. **No Electron overhead.** Tauri's webview is lightweight. No separate Chromium |
75 | | - process, no 300 MB base memory footprint. |
76 | | -2. **Native file I/O.** Async Rust (tokio) handles filesystem operations. File |
77 | | - trees load instantly even on large monorepos. |
78 | | -3. **Your VS Code extensions work.** Mountain manages the Cocoon sidecar over |
79 | | - gRPC. Extensions run unchanged in Node.js with sub-millisecond IPC. |
80 | | -4. **Secrets stay in the OS keychain.** Authentication tokens are stored via the |
81 | | - native keychain (`keyring` crate), not in plaintext config files. |
| 70 | +Mountain replaces Electron's main process entirely with a Rust binary using |
| 71 | +Tauri. The OS's own WebView renders the UI: WKWebView on macOS, WebView2 on |
| 72 | +Windows, WebKitGTK on Linux. No bundled Chromium. No Node.js in the host |
| 73 | +process. Window management, file system access, process lifecycle, and auth |
| 74 | +tokens all happen in Rust with zero IPC overhead. Cold start in under 200 ms. |
| 75 | +RAM footprint 60-80% smaller per window. |
82 | 76 |
|
83 | 77 | 📖 **[Rust API Documentation](https://Rust.Documentation.Mountain.Editor.Land/)** |
84 | 78 |
|
85 | 79 | --- |
86 | 80 |
|
87 | | -## Key Features 🔐 |
88 | | - |
89 | | -- **Composable business logic.** Operations are expressed as declarative |
90 | | - `ActionEffect`s executed by a central runtime. Testable, composable, no |
91 | | - spaghetti callbacks. |
92 | | -- **Type-safe extension IPC.** Extensions talk to Mountain over gRPC (tonic). |
93 | | - Sub-millisecond round trips, no JSON serialization overhead, full type safety. |
94 | | -- **One source of truth.** A single thread-safe `ApplicationState` holds the |
95 | | - entire app state. No stale caches, no out-of-sync views. |
96 | | -- **Real terminal, not a wrapper.** Native PTY management via `portable-pty`. |
97 | | - Shell autocompletion, cursor movement, and colors work exactly as expected. |
98 | | -- **OS keychain for secrets.** Tokens stored via `keyring`, not in plaintext |
99 | | - JSON files that any process can read. |
| 81 | +## What It Does 🔐 |
| 82 | + |
| 83 | +- **No Electron overhead.** Tauri's WebView replaces three Chromium renderer |
| 84 | + processes. No 300 MB base memory footprint. |
| 85 | +- **Native file I/O.** Async Rust (tokio) handles filesystem operations. File |
| 86 | + trees load instantly even on large monorepos. |
| 87 | +- **Your VS Code extensions work.** Mountain manages the Cocoon sidecar over |
| 88 | + gRPC. Extensions run unchanged with sub-millisecond IPC. |
| 89 | +- **Secrets stay in the OS keychain.** Authentication tokens stored via |
| 90 | + `keyring`, not in plaintext config files. |
| 91 | +- **Composable business logic.** Operations expressed as declarative |
| 92 | + `ActionEffect`s. Testable, composable, no spaghetti callbacks. |
100 | 93 | - **Instant command dispatch.** A central `Track` dispatcher routes every UI |
101 | | - action to the right provider. Native commands run directly. Extension commands |
102 | | - proxy over gRPC. The UI never waits. |
103 | | - |
104 | | ---- |
105 | | - |
106 | | -## Core Architecture Principles 🏗️ |
107 | | - |
108 | | -| Principle | Description | Key Components Involved | |
109 | | -| :------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------- | |
110 | | -| **Implementation of Contracts** | Faithfully implement the abstract service `trait`s defined in the `Common` crate, providing the concrete logic for the application's architecture. | `Environment/*` providers | |
111 | | -| **Separation of Concerns** | Isolate service logic into distinct `Environment` provider modules, each responsible for a specific domain (e.g., FileSystem, Documents). | `Environment/*`, `Command/*` | |
112 | | -| **Declarative Logic** | Express complex operations as `ActionEffect`s, which are executed by the `ApplicationRunTime`. This makes logic composable, testable, and robust. | `RunTime/*`, `Track/EffectCreation.rs`, `Common` | |
113 | | -| **Centralized State** | Maintain a single, thread-safe `ApplicationState` struct managed by Tauri to ensure data consistency across the entire application. | `ApplicationState/*` | |
114 | | -| **Secure & Performant IPC** | Utilize gRPC for all communication with the `Cocoon` sidecar, ensuring a well-defined and high-performance API boundary. | `Vine/*` | |
115 | | -| **User Interface-Backend Decoupling** | Interact with the `Wind` frontend exclusively through asynchronous Tauri commands and events, ensuring the backend is User Interface-agnostic. | `Binary.rs` (invoke handler), `Command/*` | |
| 94 | + action to the right provider. The UI never waits. |
116 | 95 |
|
117 | 96 | --- |
118 | 97 |
|
119 | | -## Deep Dive & Component Breakdown 🔬 |
| 98 | +## Architecture 🏗️ |
120 | 99 |
|
121 | | -To understand how `Mountain`'s internal components are structured and how they |
122 | | -implement the application's core logic, please refer to the detailed technical |
123 | | -breakdown in |
124 | | -[`Documentation/GitHub/DeepDive.md`](https://github.com/CodeEditorLand/Mountain/tree/Current/Documentation/GitHub/DeepDive.md). |
| 100 | +| Principle | Description | Key Components | |
| 101 | +| :--- | :--- | :--- | |
| 102 | +| Implementation of Contracts | Implements abstract service traits from Common | `Environment/*` providers | |
| 103 | +| Separation of Concerns | Each domain isolated in its own provider module | `Environment/*`, `Command/*` | |
| 104 | +| Declarative Logic | Operations as `ActionEffect`s executed by the runtime | `RunTime/*`, `Track/EffectCreation.rs` | |
| 105 | +| Centralized State | Single thread-safe `ApplicationState` | `ApplicationState/*` | |
| 106 | +| Typed IPC | gRPC for all Cocoon communication | `Vine/*` | |
| 107 | +| UI-Backend Decoupling | Tauri commands and events, backend is UI-agnostic | `Binary.rs`, `Command/*` | |
125 | 108 |
|
126 | | -This document explains the roles of the `ApplicationRunTime`, |
127 | | -`ApplicationState`, `Handler`, `Environment`, and the `Vine` gRPC layer. |
| 109 | +[Deep Dive](https://github.com/CodeEditorLand/Mountain/tree/Current/Documentation/GitHub/DeepDive.md) |
128 | 110 |
|
129 | 111 | --- |
130 | 112 |
|
131 | | -## `Mountain` in the Land Ecosystem ⛰️ + 🏞️ |
132 | | - |
133 | | -This diagram illustrates `Mountain`'s central role as the native orchestrator |
134 | | -for the entire Land application. |
| 113 | +## In the Ecosystem ⛰️ + 🏞️ |
135 | 114 |
|
136 | 115 | ```mermaid |
137 | 116 | graph LR |
138 | | - classDef Mountain fill:#f9f,stroke:#333,stroke-width:2px; |
139 | | - classDef Cocoon fill:#ccf,stroke:#333,stroke-width:2px; |
140 | | - classDef Wind fill:#9cf,stroke:#333,stroke-width:2px; |
141 | | - classDef Common fill:#cfc,stroke:#333,stroke-width:1px; |
142 | | - classDef IPC fill:#ff9,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5; |
143 | | -
|
144 | | - subgraph "Mountain (Native Rust/Tauri Backend)" |
145 | | - TauriRuntime[Tauri App & Window]:::Mountain |
146 | | - ApplicationRunTime[ApplicationRunTime Engine]:::Mountain |
147 | | - ApplicationState["ApplicationState (Shared State)"]:::Mountain |
| 117 | + classDef Mountain fill:#f9f,stroke:#333,stroke-width:2px |
| 118 | + classDef Cocoon fill:#ccf,stroke:#333,stroke-width:2px |
| 119 | + classDef Wind fill:#9cf,stroke:#333,stroke-width:2px |
| 120 | + classDef Common fill:#cfc,stroke:#333,stroke-width:1px |
| 121 | + classDef IPC fill:#ff9,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5 |
| 122 | +
|
| 123 | + subgraph "Mountain (Rust/Tauri Backend)" |
| 124 | + TauriRuntime[Tauri App]:::Mountain |
| 125 | + ApplicationRunTime[ApplicationRunTime]:::Mountain |
| 126 | + ApplicationState[ApplicationState]:::Mountain |
148 | 127 | TrackDispatcher[Track Dispatcher]:::Mountain |
149 | 128 | VinegRPC[Vine gRPC Server]:::IPC |
150 | 129 | EnvironmentProviders[Environment Providers]:::Mountain |
151 | | - CommonCrate["Common Crate (Traits & DTOs)"]:::Common |
152 | | -
|
153 | | - TauriRuntime -- Manages --> ApplicationState |
154 | | - TauriRuntime -- Manages --> ApplicationRunTime |
155 | | - ApplicationRunTime -- Executes effects via --> EnvironmentProviders |
156 | | - TrackDispatcher -- Routes requests to --> ApplicationRunTime |
157 | 130 | end |
158 | 131 |
|
159 | 132 | subgraph "Clients" |
160 | | - WindUI["Wind/Sky User Interface (Webview)"]:::Wind |
161 | | - CocoonSideCar["Cocoon Extension Host (Node.js)"]:::Cocoon |
| 133 | + WindUI[Wind/Sky UI]:::Wind |
| 134 | + CocoonSideCar[Cocoon Extension Host]:::Cocoon |
162 | 135 | end |
163 | 136 |
|
| 137 | + TauriRuntime -- Manages --> ApplicationState |
| 138 | + TauriRuntime -- Manages --> ApplicationRunTime |
| 139 | + ApplicationRunTime -- Executes --> EnvironmentProviders |
| 140 | + TrackDispatcher -- Routes --> ApplicationRunTime |
164 | 141 | TauriRuntime -- Hosts --> WindUI |
165 | 142 | WindUI -- Tauri Command --> TrackDispatcher |
166 | 143 | TrackDispatcher -- Tauri Events --> WindUI |
167 | | -
|
168 | | - VinegRPC -- gRPC Protocol <--> CocoonSideCar; class VinegRPC,CocoonSideCar IPC |
169 | | - VinegRPC -- Forwards requests to --> TrackDispatcher |
170 | | -
|
171 | | - EnvironmentProviders -- Implements traits from --> CommonCrate |
| 144 | + VinegRPC -- gRPC --> CocoonSideCar |
| 145 | + VinegRPC -- Forwards --> TrackDispatcher |
172 | 146 | ``` |
173 | 147 |
|
174 | 148 | --- |
175 | 149 |
|
176 | | -## Project Structure Overview 🗺️ |
177 | | - |
178 | | -The `Mountain` repository is organized to clearly separate concerns, following |
179 | | -the architectural patterns defined in `Common`. |
| 150 | +## Project Structure 🗺️ |
180 | 151 |
|
181 | 152 | ``` |
182 | 153 | Mountain/ |
183 | 154 | ├── Source/ |
184 | | -│ ├── Binary.rs # Tauri application entry point and setup. |
185 | | -│ ├── ApplicationState/ # Central, thread-safe state store and its DTOs. |
186 | | -│ ├── Command/ # Tauri command handlers for UI-specific requests. |
187 | | -│ ├── Environment/ # Concrete implementations of the `Common` provider traits. |
188 | | -│ ├── ExtensionManagement/ # Logic for scanning and parsing extensions. |
189 | | -│ ├── FileSystem/ # Native TreeView provider for the File Explorer. |
190 | | -│ ├── ProcessManagement/ # Logic for managing the `Cocoon` sidecar process. |
191 | | -│ ├── RunTime/ # The `ApplicationRunTime` engine that executes effects. |
192 | | -│ ├── Track/ # The central request dispatcher (`EffectCreation`). |
193 | | -│ ├── Update/ # Application self-updating logic. |
194 | | -│ ├── Vine/ # The gRPC server and client implementation (`tonic`). |
195 | | -│ └── Workspace/ # Logic for handling `.code-workspace` files. |
| 155 | +│ ├── Binary.rs # Tauri entry point |
| 156 | +│ ├── ApplicationState/ # Thread-safe state store |
| 157 | +│ ├── Command/ # Tauri command handlers |
| 158 | +│ ├── Environment/ # Common trait implementations |
| 159 | +│ ├── ExtensionManagement/ # Extension scanning and parsing |
| 160 | +│ ├── FileSystem/ # Native TreeView provider |
| 161 | +│ ├── ProcessManagement/ # Cocoon sidecar lifecycle |
| 162 | +│ ├── RunTime/ # Effect execution engine |
| 163 | +│ ├── Track/ # Central request dispatcher |
| 164 | +│ ├── Update/ # Self-updating logic |
| 165 | +│ ├── Vine/ # gRPC server/client (tonic) |
| 166 | +│ └── Workspace/ # .code-workspace handling |
196 | 167 | ├── Proto/ |
197 | | -│ └── Vine.proto # The gRPC contract definition file. |
198 | | -└── build.rs # Build script to compile the .proto file into Rust code. |
| 168 | +│ └── Vine.proto # gRPC contract definition |
| 169 | +└── build.rs # Proto compilation |
199 | 170 | ``` |
200 | 171 |
|
201 | 172 | --- |
202 | 173 |
|
203 | | -## Development Setup 🛠️ |
204 | | - |
205 | | -`Mountain` is a Rust crate and a core component of the main `Land` repository. |
206 | | -It is not intended to be built or run standalone. Please follow the instructions |
207 | | -in the main [Land Repository README](https://github.com/CodeEditorLand/Land) to |
208 | | -set up, build, and run the entire application. |
209 | | - |
210 | | -**Key Dependencies:** |
| 174 | +## Development 🛠️ |
211 | 175 |
|
212 | | -- `Common` (local path dependency). |
213 | | -- `Echo` (local path dependency). |
214 | | -- `keyring`: For secure secret storage. |
215 | | -- `log` & `env_logger`: For logging. |
216 | | -- `portable-pty`: For the integrated terminal feature. |
217 | | -- `serde` & `serde_json`: For serialization. |
218 | | -- `tauri`: `^2.x` |
219 | | -- `tokio`: For the asynchronous RunTime. |
220 | | -- `tonic`: For the gRPC server implementation. |
| 176 | +Mountain is a Rust crate within the Land workspace. Follow the |
| 177 | +[Land Repository](https://github.com/CodeEditorLand/Land) instructions to |
| 178 | +build and run. |
221 | 179 |
|
222 | 180 | --- |
223 | 181 |
|
224 | | -## License ⚖️ |
| 182 | +## License ⚖️ |
225 | 183 |
|
226 | | -This project is released into the public domain under the **Creative Commons CC0 |
227 | | -Universal** license. |
228 | | - |
229 | | -You are free to use, modify, distribute, and build upon this work for any |
230 | | -purpose, without any restrictions. For the full legal text, see the |
231 | | -[`LICENSE`](https://github.com/CodeEditorLand/Mountain/tree/Current/) file. |
| 184 | +CC0 1.0 Universal. Public domain. No restrictions. |
| 185 | +[LICENSE](https://github.com/CodeEditorLand/Mountain/tree/Current/LICENSE) |
232 | 186 |
|
233 | 187 | --- |
234 | 188 |
|
235 | | -## Changelog 📜 |
236 | | - |
237 | | -Stay updated with our progress! See |
238 | | -[`CHANGELOG.md`](https://github.com/CodeEditorLand/Mountain/tree/Current/) for a |
239 | | -history of changes specific to **Mountain**. |
240 | | - |
241 | | ---- |
242 | | - |
243 | | - |
244 | 189 | ## See Also |
245 | 190 |
|
| 191 | +- [Mountain Documentation](https://editor.land/Doc/mountain) |
246 | 192 | - [Architecture Overview](https://editor.land/Doc/architecture) |
| 193 | +- [Why Rust](https://editor.land/Doc/why-rust) |
| 194 | +- [Why Tauri](https://editor.land/Doc/why-tauri) |
247 | 195 | - [Cocoon](https://github.com/CodeEditorLand/Cocoon) |
248 | | -- [Air](https://github.com/CodeEditorLand/Air) |
249 | 196 | - [Vine](https://github.com/CodeEditorLand/Vine) |
250 | 197 | - [Echo](https://github.com/CodeEditorLand/Echo) |
| 198 | +- [Air](https://github.com/CodeEditorLand/Air) |
251 | 199 |
|
252 | | -## Funding & Acknowledgements 🙏🏻 |
| 200 | +## Funding & Acknowledgements 🙏🏻 |
253 | 201 |
|
254 | 202 | **Mountain** is a core element of the **Land** ecosystem. This project is funded |
255 | 203 | through [NGI0 Commons Fund](https://NLnet.NL/Commonsfund), a fund established by |
|
0 commit comments