|
1 | 1 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] |
2 | 2 | #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] |
3 | 3 |
|
4 | | -//! # Common Crate |
| 4 | +//! # Common: Abstract Core Library for Code Editor Land |
5 | 5 | //! |
6 | | -//! Defines the abstract architectural core for the entire application |
7 | | -//! ecosystem. It provides the foundational traits, services, and data transfer |
8 | | -//! objects (DTOs) that constitute the application's public API contract. |
| 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 | 9 | //! |
10 | | -//! This crate enforces a clean separation of concerns by defining "what" an |
11 | | -//! operation does (the service trait, e.g., `FileSystemReader`) separately |
12 | | -//! from "how" it is implemented (the concrete implementation in the `Mountain` |
13 | | -//! crate). This declarative, effects-based architecture ensures that |
14 | | -//! application logic is composable, testable, and maintainable. |
| 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, |
| 26 | +//! Tauri 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> |
15 | 49 |
|
16 | 50 | // --- Core Architecture --- |
17 | 51 | pub mod Effect; |
|
0 commit comments