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