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