Skip to content

Commit 065ee6b

Browse files
docs: benefit-focused crate-level rustdoc in Library.rs
Replace technical spec copy with developer-facing value propositions. Remove 50-level analysis checklist where present. Generated-By: PostHog Code Task-Id: 556dae83-2866-4359-85ea-c7d0d818cb34
1 parent 23b0d9a commit 065ee6b

1 file changed

Lines changed: 65 additions & 173 deletions

File tree

Source/Library.rs

Lines changed: 65 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,75 @@
11
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
22
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
33

4-
// ============================================================================
5-
// Element: Mountain - 50-Level Deep Analysis
6-
// ============================================================================
7-
//
8-
// Overview
9-
// --------
10-
// Mountain is the main Tauri-based desktop application in the Land monorepo.
11-
//
12-
// Level 1-10: Basic Structure
13-
// ---------------------------
14-
// | Level | Task | Status |
15-
// |-------|-----------------------------|--------|
16-
// | 1 | Verify Cargo.toml exists | ✅ |
17-
// | 2 | Check Source/ directory structure | ✅ |
18-
// | 3 | Identify main modules | ✅ |
19-
// | 4 | Check for build.rs | ✅ |
20-
// | 5 | Verify .gitattributes (LFS) | ✅ |
21-
// | 6 | Check .github/workflows | ✅ |
22-
// | 7 | Identify Dependencies | ✅ |
23-
// | 8 | Check Binary/ directory | ✅ |
24-
// | 9 | Verify documentation | ✅ |
25-
// | 10 | Check Target/ directory | ⬜ |
26-
//
27-
// Level 11-20: Module Analysis
28-
// ----------------------------
29-
// | Level | Task | Status |
30-
// |-------|-------------------------------|--------|
31-
// | 11 | Analyze ApplicationState module | ⬜ |
32-
// | 12 | Analyze Binary module | ⬜ |
33-
// | 13 | Analyze Command module | ⬜ |
34-
// | 14 | Analyze Environment module | ⬜ |
35-
// | 15 | Analyze Error module | ⬜ |
36-
// | 16 | Analyze ExtensionManagement module | ⬜ |
37-
// | 17 | Analyze FileSystem module | ⬜ |
38-
// | 18 | Analyze IPC module | ⬜ |
39-
// | 19 | Analyze ProcessManagement module | ⬜ |
40-
// | 20 | Analyze RPC module | ⬜ |
41-
//
42-
// Level 21-30: Code Quality Checks (TODOs: 265)
43-
// ----------------------------------------------
44-
// | Level | Task | Status |
45-
// |-------|-----------------------------|----------------|
46-
// | 21 | Check for unused imports | ✅ From f2cc266 |
47-
// | 22 | Check for dead code | ⬜ |
48-
// | 23 | Check TODO comments (265!) | 🔴 Priority |
49-
// | 24 | Verify naming conventions | ⬜ |
50-
// | 25 | Check error handling in RPC | ⬜ |
51-
// | 26 | Verify logging patterns | ⬜ |
52-
// | 27 | Check for magic numbers | ⬜ |
53-
// | 28 | Verify async patterns | ⬜ |
54-
// | 29 | Check thread safety | ✅ From 78ebab1, f2cc266 |
55-
// | 30 | Verify test coverage | ⬜ |
56-
//
57-
// Level 31-40: Convention Verification
58-
// -------------------------------------
59-
// | Level | Task | Status |
60-
// |-------|----------------------------|-----------|
61-
// | 31 | Verify PascalCase | ✅ Verified |
62-
// | 32 | Verify snake_case files | ⬜ |
63-
// | 33 | Check module organization | ✅ |
64-
// | 34 | Verify struct naming | ⬜ |
65-
// | 35 | Verify enum naming | ⬜ |
66-
// | 36 | Check function naming | ⬜ |
67-
// | 37 | Verify trait naming | ⬜ |
68-
// | 38 | Check constant naming | ⬜ |
69-
// | 39 | Verify type aliases | ⬜ |
70-
// | 40 | Check visibility modifiers | ⬜ |
71-
//
72-
// Level 41-50: Refactoring Priorities
73-
// ------------------------------------
74-
// | Level | Task | Status |
75-
// |-------|------------------------------|--------------|
76-
// | 41 | Address RPC/CocoonService TODOs | 🔴 20+ TODOs |
77-
// | 42 | Check for code duplication | ⬜ |
78-
// | 43 | Verify DRY principles | ⬜ |
79-
// | 44 | Check SOLID principles | ⬜ |
80-
// | 45 | Identify performance issues | ⬜ |
81-
// | 46 | Check security considerations| ⬜ |
82-
// | 47 | Verify error messages | ⬜ |
83-
// | 48 | Check documentation completeness | ⬜ |
84-
// | 49 | Final Mountain-specific audit | ⬜ |
85-
// | 50 | Complete Mountain analysis | ⬜ |
86-
//
87-
// TODO Breakdown for Mountain
88-
// ----------------------------
89-
// - **RPC/CocoonService.rs**: ~30+ TODOs (provider registrations)
90-
// - **Other files**: ~235+ TODOs
91-
// - **Priority**: High - language server features
92-
//
93-
// Summary for Mountain
94-
// --------------------
95-
// - **Type**: Rust/Tauri Desktop Application
96-
// - **TODOs**: 265 found 🔴
97-
// - **Key Changes**: Thread safety (RwLock), naming consistency, LFS
98-
// - **Last Commit Changes**: NC-09, NC-10, NC-11, TS-01, TS-02, ARCH-31, ARCH-32
99-
//
100-
// Last Updated: 2026-03-03
101-
// ============================================================================
102-
103-
//! # Library
104-
//!
105-
//! Library root module for the Mountain application, declaring all subsystem
106-
//! modules and providing the main entry point for the Tauri desktop framework.
107-
//!
108-
//! ## RESPONSIBILITIES
109-
//!
110-
//! ### Module Organization
111-
//! - Declare and export all Mountain subsystem modules
112-
//! - Provide clean module boundaries and visibility rules
113-
//! - Enable dependency management between components
114-
//! - Support both library and binary builds
115-
//!
116-
//! ### Entry Point
117-
//! - Provide mobile build entry point required by Tauri
118-
//! - Delegate to Binary module for main application logic
119-
//!
120-
//! ## ARCHITECTURAL ROLE
121-
//!
122-
//! ### Position in Mountain
123-
//! - Library root for the Mountain crate
124-
//! - Central module declaration point
125-
//! - Provides module visibility control
126-
//!
127-
//! ### Dependencies
128-
//! - Common: Shared infrastructure
129-
//! - Tauri: Desktop framework integration
130-
//!
131-
//! ### Dependents
132-
//! - Binary: Uses all modules for application initialization
133-
//!
134-
//! ## MODULE STRUCTURE
4+
//! # Mountain: Native Backend for Code Editor Land
5+
//!
6+
//! Mountain replaces Electron with Rust and Tauri. It manages windows, file
7+
//! systems, processes, and extensions at native speed. Where Electron takes
8+
//! milliseconds, Mountain responds in microseconds.
9+
//!
10+
//! ## What Mountain Does
11+
//!
12+
//! - **Hosts the editor UI** via Tauri webview (no Chromium process overhead)
13+
//! - **Runs VS Code extensions** by managing the Cocoon sidecar over gRPC
14+
//! - **Handles file I/O** through native async Rust (tokio), not Node.js `fs`
15+
//! - **Manages terminals** via native PTY (`portable-pty`), not shell wrappers
16+
//! - **Stores secrets** in the OS keychain (`keyring` crate), not plaintext
17+
//!
18+
//! ## Architecture
19+
//!
20+
//! Mountain uses a declarative effect system defined in `Common`. Business
21+
//! logic is expressed as `ActionEffect`s executed by the `ApplicationRunTime`.
22+
//! All state lives in a single thread-safe `ApplicationState` managed by Tauri.
23+
//!
24+
//! ```text
25+
//! Wind/Sky (UI) ──Tauri commands──> Mountain ──gRPC──> Cocoon (extensions)
26+
//! │
27+
//! ├── Environment providers (file, process, terminal)
28+
//! ├── ApplicationRunTime (effect executor)
29+
//! └── ApplicationState (shared state)
30+
//! ```
31+
//!
32+
//! ## Module Layout
13533
//!
13634
//! ### Core Infrastructure
137-
//! - ApplicationState: Centralized state management
138-
//! - Environment: Capability provider and dependency injection
139-
//! - RunTime: Effect execution engine
35+
//! - [`ApplicationState`]: Centralized, thread-safe state for the entire app
36+
//! - [`Environment`]: Capability providers (file system, processes, extensions)
37+
//! - [`RunTime`]: Effect execution engine that runs `ActionEffect` pipelines
14038
//!
14139
//! ### Communication
142-
//! - IPC: Inter-process communication
143-
//! - Air: AI/integration service client
144-
//! - Vine: gRPC inter-service communication
40+
//! - [`IPC`]: Inter-process communication primitives
41+
//! - [`Air`]: Client for the background daemon (updates, crypto signing)
42+
//! - [`Vine`]: gRPC server/client for Cocoon extension host communication
43+
//! - [`RPC`]: Remote procedure call service implementations
14544
//!
146-
//! ### Service Management
147-
//! - ProcessManagement: Sidecar process lifecycle
148-
//! - FileSystem: File system operations
149-
//! - ExtensionManagement: Extension discovery
45+
//! ### Services
46+
//! - [`ProcessManagement`]: Sidecar process lifecycle (launch, monitor, restart)
47+
//! - [`FileSystem`]: Native TreeView provider for the File Explorer
48+
//! - [`ExtensionManagement`]: Extension discovery, scanning, and activation
15049
//!
151-
//! ### Commands & Features
152-
//! - Command: Native command implementations
153-
//! - Track: Command tracking and dispatch
154-
//! - Workspace: Workspace file parsing
50+
//! ### Commands
51+
//! - [`Command`]: Native command handlers (file, edit, view, terminal)
52+
//! - [`Track`]: Central command dispatcher routing UI requests to providers
53+
//! - [`Workspace`]: `.code-workspace` file parsing and multi-root support
15554
//!
156-
//! ### Entry Point
157-
//! - Binary: Main application entry point
158-
159-
// ============================================================================
160-
// Core Infrastructure Modules
161-
// ============================================================================
55+
//! ## Related Crates
56+
//!
57+
//! | Crate | Role |
58+
//! |---|---|
59+
//! | `Common` | Abstract traits and DTOs that Mountain implements |
60+
//! | `Echo` | Work-stealing task scheduler used by Mountain's runtime |
61+
//! | `Air` | Background daemon that Mountain communicates with |
62+
//!
63+
//! ## Getting Started
64+
//!
65+
//! Mountain builds as part of the Land monorepo:
66+
//! ```bash
67+
//! cargo build -p Mountain
68+
//! ```
69+
//!
70+
//! Full setup: <https://github.com/CodeEditorLand/Land>
16271
72+
// Core Infrastructure
16373
/// Centralized error handling system
16474
pub mod Error;
16575

@@ -169,10 +79,7 @@ pub mod Environment;
16979

17080
pub mod RunTime;
17181

172-
// ============================================================================
173-
// Communication Modules
174-
// ============================================================================
175-
82+
// Communication
17683
pub mod IPC;
17784

17885
pub mod Air;
@@ -181,39 +88,24 @@ pub mod Vine;
18188

18289
pub mod RPC;
18390

184-
// ============================================================================
185-
// Service Management Modules
186-
// ============================================================================
187-
91+
// Services
18892
pub mod ProcessManagement;
18993

19094
pub mod FileSystem;
19195

19296
pub mod ExtensionManagement;
19397

194-
// ============================================================================
195-
// Command And Feature Modules
196-
// ============================================================================
197-
98+
// Commands
19899
pub mod Command;
199100

200101
pub mod Track;
201102

202103
pub mod Workspace;
203104

204-
// ============================================================================
205-
// Entry Point Module
206-
// ============================================================================
207-
105+
// Entry Point
208106
pub mod Binary;
209107

210-
// ============================================================================
211-
// Mobile Build Entry Point
212-
// ============================================================================
213-
214108
/// Main entry point for both mobile and desktop builds.
215-
/// - On mobile: marked as Tauri mobile entry point
216-
/// - On desktop: serves as the standard binary entry point
217109
/// Delegates to the primary binary logic in the Binary module.
218110
#[cfg_attr(mobile, tauri::mobile_entry_point)]
219111
fn main() { Binary::Main::Main(); }

0 commit comments

Comments
 (0)