Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_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/// Local error taxonomy (superseded; zero callers - see
84/// `CommonLibrary::Error::CommonError`).
85pub mod Error;
86
87/// Centralized, thread-safe application state managed by Tauri.
88pub mod ApplicationState;
89
90/// Capability providers: file system, process, terminal, and extension host.
91pub mod Environment;
92
93/// Effect execution engine that drives `ActionEffect` pipelines.
94pub mod RunTime;
95
96// Communication
97
98/// Inter-process communication primitives.
99pub mod IPC;
100
101/// Client for the Air background daemon (updates and crypto signing).
102pub mod Air;
103
104/// gRPC server and client for Cocoon extension host communication.
105pub mod Vine;
106
107/// Remote procedure call service implementations.
108pub mod RPC;
109
110/// MemoryMap asset cache, path-canonicalisation cache, and future entries.
111/// See `Cache` module index for the full entry list.
112pub mod Cache;
113
114// Services
115
116/// Sidecar process lifecycle: launch, monitor, and restart.
117pub mod ProcessManagement;
118
119/// Native TreeView provider for the File Explorer.
120pub mod FileSystem;
121
122/// Extension discovery, scanning, and activation.
123pub mod ExtensionManagement;
124
125// Commands
126
127/// Native command handlers for file, edit, view, and terminal operations.
128pub mod Command;
129
130/// Central command dispatcher routing UI requests to the correct provider.
131pub mod Track;
132
133/// `.code-workspace` file parsing and multi-root workspace support.
134pub mod Workspace;
135
136/// Emits a single ISO-timestamped boot banner listing all compiled-in tier
137/// values.
138pub mod LandFixTier;
139
140/// Binary entry points for desktop and mobile builds.
141pub mod Binary;
142
143/// Main entry point for both mobile and desktop builds.
144#[allow(unexpected_cfgs)]
145#[cfg_attr(mobile, tauri::mobile_entry_point)]
146pub fn main() { Binary::Main::Entry::Fn(); }