You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(Common): Expand README with comprehensive documentation
Restore detailed documentation to the Common crate README, reversing the prior condensation. Adds back the following sections:
- Welcome section with "Architectural Core of Land" overview and VS Code comparison blockquote
- Key Features & Concepts with 5 bullet points covering abstraction, declarative effects, trait-based DI, async services, DTOs, and CommonError
- Core Architecture Principles table (Abstraction, Declarativism, Composability, Contract-First, Purity)
- ActionEffect System Explained with side-by-side code examples comparing imperative vs declarative approaches
- Project Structure Overview with directory tree
- Deep Dive section linking to Documentation/GitHub/DeepDive.md for technical details
- How Common Fits into the Land Ecosystem with mermaid diagram showing traits, effects, DTOs, Mountain, and test relationships
- Getting Started guide with installation (Cargo.toml) and usage (implement trait, create/execute effect) code samples
- License section with CC0 explanation
- Changelog section pointing to CHANGELOG.md
The README now balances quick onboarding with links to detailed technical documentation.
> **VS Code's codebase imports concrete implementations directly. Testing a single component means mocking entire subsystems. There is no dependency injection at the architecture level.**
14
+
The Architectural Core of Land
15
+
16
+
> **VS Code's codebase imports concrete implementations directly. Testing a
17
+
> single component means mocking entire subsystems. There is no dependency
18
+
> injection at the architecture level.**
16
19
17
-
_"Mock any service and test any element in isolation, no running editor required."_
20
+
_"Mock any service and test any element in isolation, no running editor
Common defines pure abstract traits with zero concrete implementations. Every element builds on Common's typed effects and composable building blocks. The Rust compiler enforces contracts at build time. If an element changes its signature, every consumer fails to compile immediately. Tests run in milliseconds because you can mock any trait and test any element without launching a window, a WebView, or a sidecar.
24
-
25
27
📖 **[Rust API Documentation](https://Rust.Documentation.Editor.Land/Common/)**
26
28
29
+
Welcome to **Common**! This crate is the architectural heart of the Land Code
30
+
Editor's native backend. It provides a pure, abstract foundation for building
31
+
application logic using a declarative, effects-based system. It contains **no
32
+
concrete implementations**; instead, it defines the "language" of the
33
+
application through a set of powerful, composable building blocks.
34
+
35
+
The entire `Mountain` backend and any future native components are built by
36
+
implementing the traits and consuming the effects defined in this crate.
37
+
38
+
**`Common`** is engineered to:
39
+
40
+
1.**Enforce Architectural Boundaries:** By defining all application
41
+
capabilities as abstract `trait`s, it ensures a clean separation between the
42
+
definition of an operation and its execution.
43
+
2.**Provide a Declarative Effect System:** Introduces the `ActionEffect` type,
44
+
which describes an asynchronous operation as a value, allowing logic to be
45
+
composed, tested, and executed in a controlled `ApplicationRunTime`.
46
+
3.**Standardize Data Contracts:** Defines all Data Transfer Objects (DTOs) and
47
+
a universal `CommonError` enum, ensuring consistent data structures and error
48
+
handling across the entire native ecosystem.
49
+
4.**Maximize Testability and Reusability:** Because this crate is pure and
50
+
abstract, any component that depends on it can be tested with mock
51
+
implementations of its traits, leading to fast and reliable unit tests.
52
+
53
+
---
54
+
55
+
## Key Features & Concepts 🔐
56
+
57
+
-**Declarative `ActionEffect` System:** Operations are not executed immediately
58
+
— they are described as `ActionEffect` data structures and then passed to a
59
+
runtime for execution.
60
+
-**Trait-Based Dependency Injection:** A clean, compile-time DI system using
61
+
the `Environment` and `Requires` traits, allowing components to declare their
62
+
dependencies without being tied to a specific implementation.
63
+
-**Asynchronous Service Traits:** All core application services (e.g.,
64
+
`FileSystemReader`, `UserInterfaceProvider`, `CommandExecutor`) are defined as
65
+
`async trait`s, providing a fully asynchronous-first architecture.
66
+
-**Comprehensive DTO Library:** Contains definitions for all data structures
67
+
used for IPC communication with `Cocoon` and internal state management in
68
+
`Mountain`. All types are `serde`-compatible.
69
+
-**Universal `CommonError` Enum:** A single, exhaustive `enum` for all possible
70
+
failures, enabling robust and predictable error handling across the entire
71
+
application.
72
+
27
73
---
28
74
29
-
## What It Does 🔐
75
+
## Core Architecture Principles 🏗️
30
76
31
-
-**Pure abstract traits.** Zero concrete implementations. Every cross-element boundary is a typed contract.
32
-
-**Compile-time enforcement.** Change a trait signature and every consumer fails to compile immediately.
33
-
-**Millisecond tests.** Mock any trait and test any element without launching a window or WebView.
34
-
-**ActionEffect system.** Declarative effects that are composable, testable, and type-safe.
|**Abstraction**| Define every application capability as an abstract `async trait`. Never include concrete implementation logic. | All `*Provider.rs` and `*Manager.rs` files |
80
+
|**Declarativism**| Represent every operation as an `ActionEffect` value. The crate provides constructor functions for these effects. |`Effect/*`, all effect constructor files |
81
+
|**Composability**| The `ActionEffect` system and trait-based DI are designed to be composed, allowing complex workflows to be built from simple, reusable pieces. |`Environment/*`, `Effect/*`|
82
+
|**Contract-First**| Define all data structures (`DTO/*`) and error types (`Error/*`) first. These form the stable contract for all other components. |`DTO/`, `Error/`|
83
+
|**Purity**| This crate has minimal dependencies and is completely independent of Tauri, gRPC, or any specific application logic. |`Cargo.toml`|
0 commit comments