CommonLibrary/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//! # Common: Abstract Core Library for Code Editor Land
13//!
14//! Every Element in Land depends on Common. It defines the traits, services,
15//! and data transfer objects that form the application's public API contract.
16//! Mountain implements these traits. Wind and Cocoon consume them.
17//!
18//! ## Why Common Exists
19//!
20//! Common enforces a clean separation between "what the app can do" (traits)
21//! and "how it does it" (Mountain's concrete implementations). This means:
22//!
23//! - You can test business logic without launching Tauri
24//! - New backends can implement the same traits
25//! - The TypeScript frontend only needs to know the DTO shapes
26//!
27//! ## Key Abstractions
28//!
29//! - **ActionEffect**: Declarative effect type executed by Mountain's runtime.
30//! Business logic is described as composable effects, not imperative calls.
31//! - **Service traits**: FileSystemService, ProcessService, ExtensionService,
32//! and 15 more domain-specific contracts.
33//! - **DTOs**: Type-safe data objects shared across IPC boundaries (gRPC, Tauri
34//! commands, WebSocket).
35//! - **Error types**: Structured errors with context for every service domain.
36//!
37//! ## Module Layout
38//!
39//! | Module | Contents |
40//! |---|---|
41//! | `Effect/` | ActionEffect enum, builders, and combinators |
42//! | `Environment/` | Capability provider trait (dependency injection) |
43//! | `Error/` | Domain-specific error types with context |
44//! | `Transport/` | Transport-agnostic communication (gRPC, IPC, WASM) |
45//! | `DTO/` | Re-exported data transfer objects from all services |
46//! | `Command/` .. `Workspace/` | Service trait definitions (20 domains) |
47//!
48//! ## Getting Started
49//!
50//! Common builds as part of the Land monorepo:
51//! ```bash
52//! cargo build -p Common
53//! cargo test -p Common
54//! ```
55//!
56//! Full setup: <https://github.com/CodeEditorLand/Land>
57
58pub mod Effect;
59
60pub mod Environment;
61
62pub mod Error;
63
64pub mod Utility;
65
66// --- Service Contracts (alphabetical) ---
67pub mod Command;
68
69pub mod Configuration;
70
71pub mod CustomEditor;
72
73pub mod Debug;
74
75pub mod Diagnostic;
76
77pub mod Document;
78
79pub mod ExtensionManagement;
80
81pub mod FileSystem;
82
83pub mod IPC;
84
85pub mod Keybinding;
86
87pub mod LanguageFeature;
88
89pub mod Output;
90
91pub mod Search;
92
93pub mod Secret;
94
95pub mod SourceControlManagement;
96
97pub mod StatusBar;
98
99pub mod Storage;
100
101pub mod Synchronization;
102
103pub mod Terminal;
104
105pub mod Testing;
106
107pub mod TreeView;
108
109pub mod UserInterface;
110
111pub mod Webview;
112
113pub mod Workspace;
114
115// --- Transport Layer ---
116// Provides transport-agnostic communication abstractions (gRPC, IPC, WASM)
117pub mod Transport;
118
119// --- Telemetry ---
120// Shared dual-pipe (PostHog + OTLP) emit module. Used by every Rust
121// sidecar (Air, Echo, Rest, Grove, Mist, SideCar). Mountain keeps its
122// own compile-time-baked plugin under `Binary/Build/PostHogPlugin/*`.
123pub mod Telemetry;
124
125// --- Global DTO Module ---
126//
127// A top-level module that re-exports all Data Transfer Objects (DTOs) from the
128// various service modules for convenient access across the application.
129pub mod DTO;