Mountain/Library.rs
1#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
2#![allow(
3 non_snake_case,
4 non_camel_case_types,
5 non_upper_case_globals,
6 dead_code,
7 unused_imports,
8 unused_variables,
9 unused_assignments
10)]
11
12//! # Mountain: Native Backend for Code Editor Land
13//!
14//! Mountain replaces Electron with Rust and Tauri. It manages windows, file
15//! systems, processes, and extensions at native speed. Where Electron takes
16//! milliseconds, Mountain responds in microseconds.
17//!
18//! ## What Mountain Does
19//!
20//! - **Hosts the editor UI** via Tauri webview (no Chromium process overhead)
21//! - **Runs VS Code extensions** by managing the Cocoon sidecar over gRPC
22//! - **Handles file I/O** through native async Rust (tokio), not Node.js `fs`
23//! - **Manages terminals** via native PTY (`portable-pty`), not shell wrappers
24//! - **Stores secrets** in the OS keychain (`keyring` crate), not plaintext
25//!
26//! ## Architecture
27//!
28//! Mountain uses a declarative effect system defined in `Common`. Business
29//! logic is expressed as `ActionEffect`s executed by the `ApplicationRunTime`.
30//! All state lives in a single thread-safe `ApplicationState` managed by Tauri.
31//!
32//! ```text
33//! Wind/Sky (UI) ──Tauri commands──> Mountain ──gRPC──> Cocoon (extensions)
34//! │
35//! ├── Environment providers (file, process, terminal)
36//! ├── ApplicationRunTime (effect executor)
37//! └── ApplicationState (shared state)
38//! ```
39//!
40//! ## Module Layout
41//!
42//! ### Core Infrastructure
43//! - [`ApplicationState`]: Centralized, thread-safe state for the entire app
44//! - [`Environment`]: Capability providers (file system, processes, extensions)
45//! - [`RunTime`]: Effect execution engine that runs `ActionEffect` pipelines
46//!
47//! ### Communication
48//! - [`IPC`]: Inter-process communication primitives
49//! - [`Air`]: Client for the background daemon (updates, crypto signing)
50//! - [`Vine`]: gRPC server/client for Cocoon extension host communication
51//! - [`RPC`]: Remote procedure call service implementations
52//!
53//! ### Services
54//! - [`ProcessManagement`]: Sidecar process lifecycle (launch, monitor,
55//! restart)
56//! - [`FileSystem`]: Native TreeView provider for the File Explorer
57//! - [`ExtensionManagement`]: Extension discovery, scanning, and activation
58//!
59//! ### Commands
60//! - [`Command`]: Native command handlers (file, edit, view, terminal)
61//! - [`Track`]: Central command dispatcher routing UI requests to providers
62//! - [`Workspace`]: `.code-workspace` file parsing and multi-root support
63//!
64//! ## Related Crates
65//!
66//! | Crate | Role |
67//! |---|---|
68//! | `Common` | Abstract traits and DTOs that Mountain implements |
69//! | `Echo` | Work-stealing task scheduler used by Mountain's runtime |
70//! | `Air` | Background daemon that Mountain communicates with |
71//!
72//! ## Getting Started
73//!
74//! Mountain builds as part of the Land monorepo:
75//! ```bash
76//! cargo build -p Mountain
77//! ```
78//!
79//! Full setup: <https://github.com/CodeEditorLand/Land>
80
81// Core Infrastructure
82
83/// Centralized, thread-safe application state managed by Tauri.
84pub mod ApplicationState;
85
86/// Capability providers: file system, process, terminal, and extension host.
87pub mod Environment;
88
89/// Effect execution engine that drives `ActionEffect` pipelines.
90pub mod RunTime;
91
92// Communication
93
94/// Inter-process communication primitives.
95pub mod IPC;
96
97/// gRPC server and client for Cocoon extension host communication.
98pub mod Vine;
99
100/// Remote procedure call service implementations.
101pub mod RPC;
102
103// Services
104
105/// Sidecar process lifecycle: launch, monitor, and restart.
106pub mod ProcessManagement;
107
108/// Native TreeView provider for the File Explorer.
109pub mod FileSystem;
110
111/// Extension discovery, scanning, and activation.
112pub mod ExtensionManagement;
113
114// Commands
115
116/// Native command handlers for file, edit, view, and terminal operations.
117pub mod Command;
118
119/// Central command dispatcher routing UI requests to the correct provider.
120pub mod Track;
121
122/// `.code-workspace` file parsing and multi-root workspace support.
123pub mod Workspace;
124
125/// Emits a single ISO-timestamped boot banner listing all compiled-in tier
126/// values.
127pub mod LandFixTier;
128
129/// Binary entry points for desktop and mobile builds.
130pub mod Binary;
131
132/// Main entry point for both mobile and desktop builds.
133#[allow(unexpected_cfgs)]
134#[cfg_attr(mobile, tauri::mobile_entry_point)]
135pub fn main() { Binary::Main::Entry::Fn(); }