Mountain/Environment/mod.rs
1//! # Environment Module
2//!
3//! ## RESPONSIBILITIES
4//! Dependency Injection (DI) container that provides thread-safe access to
5//! all Mountain providers through trait-based lookups using the Requires trait.
6//!
7//! ## ARCHITECTURAL ROLE
8//!
9//! The Environment module is the central dependency injection system for
10//! Mountain:
11//!
12//! ```text
13//! Component ──► Requires<T> ──► MountainEnvironment ──► Arc<dyn T>
14//! ```
15//!
16//! ### Position in Mountain
17//! - Implements Common crate's `Environment` and `Requires` traits
18//! - All providers accessed through capability-based lookups
19//! - Created early in startup and shared via `Arc<MountainEnvironment>`
20//!
21//! ### Key Components
22//! - `MountainEnvironment`: Main DI container struct
23//! - `ProviderTraitImplMacro`: Macro for generating trait implementations
24//! - Provider modules: Individual implementations for each provider trait
25//!
26//! ### Provider Traits Implemented (25+)
27//! - CommandExecutor, ConfigurationProvider, CustomEditorProvider
28//! - DebugService, DiagnosticManager, DocumentProvider
29//! - FileSystemReader/Writer, IPCProvider, KeybindingProvider
30//! - LanguageFeatureProviderRegistry, OutputChannelManager
31//! - SecretProvider, SourceControlManagementProvider
32//! - StatusBarProvider, StorageProvider, SynchronizationProvider
33//! - TerminalProvider, TestController, TreeViewProvider
34//! - UserInterfaceProvider, WebviewProvider
35//! - WorkspaceProvider, WorkspaceEditApplier
36//! - ExtensionManagementService, SearchProvider
37//!
38//! ## ERROR HANDLING
39//! Providers use CommonError for error reporting. The DI container handles
40//! trait resolution at compile time, ensuring type safety.
41//!
42//! ## PERFORMANCE CONSIDERATIONS
43//! - Thread-safe access via `Arc<T>`
44//! - Lazy initialization through trait-based lookups
45//! - Zero-cost abstractions - macro-generated code is identical to hand-written
46//!
47//! ## TODO
48//! - [ ] Consider async initialization for providers
49//! - [ ] Add provider health checking
50//! - [ ] Implement provider dependency validation on initialization
51
52// --- Main Environment Modules ---
53
54/// Main DI container struct.
55pub mod MountainEnvironment;
56
57/// Macro for generating trait implementations.
58pub mod ProviderTraitImplMacro;
59
60// --- Provider Trait Implementations (organized by domain) ---
61pub mod CommandProvider;
62
63pub mod ConfigurationProvider;
64
65pub mod CustomEditorProvider;
66
67pub mod DebugProvider;
68
69pub mod DiagnosticProvider;
70
71pub mod DocumentProvider;
72
73pub mod FileSystemProvider;
74
75pub mod IPCProvider;
76
77pub mod KeybindingProvider;
78
79pub mod LanguageFeatureProvider;
80
81pub mod OutputProvider;
82
83pub mod SearchProvider;
84
85pub mod SecretProvider;
86
87pub mod SourceControlManagementProvider;
88
89pub mod StatusBarProvider;
90
91pub mod StorageProvider;
92
93pub mod SynchronizationProvider;
94
95pub mod TerminalProvider;
96
97pub mod TestProvider;
98
99pub mod TreeViewProvider;
100
101pub mod UserInterfaceProvider;
102
103// Re-export UserInterface and DTO for convenience
104pub use CommonLibrary::UserInterface;
105
106pub mod WebviewProvider;
107
108pub mod WorkspaceProvider;
109
110// --- Internal Utilities ---
111// Shared helpers for provider implementations.
112pub mod Utility;