Skip to main content

Mountain/Binary/Main/
mod.rs

1#![allow(non_snake_case)]
2
3//! # Binary::Main
4//!
5//! Application orchestration layer providing entry point, IPC command
6//! handlers, lifecycle management, and tray integration for the Mountain
7//! desktop application.
8//!
9//! ## Module Layout
10//!
11//! ```text
12//! main.rs --> Binary::Main::Entry::Fn()
13//!                      |
14//!                      +-> Entry       (Tokio runtime creation, Tauri builder)
15//!                      +-> IPCCommands (all #[tauri::command] handlers)
16//!                      +-> AppLifecycle(setup hook: tray, IPC server, window)
17//!                      +-> Tray        (SwitchTrayIcon Tauri command)
18//! ```
19//!
20//! ## Error Handling
21//!
22//! - `Entry::Fn` panics on fatal errors (Tokio runtime failure, Tauri build).
23//! - IPC commands return `Result<serde_json::Value, String>`.
24//! - Lifecycle setup returns `Result<(), Box<dyn std::error::Error>>`.
25//! - Non-critical failures are logged but do not prevent operation.
26//!
27//! ## Logging
28//!
29//! Log prefixes used throughout: `[Boot]`, `[Lifecycle]`, `[IPC]`, `[UI]`.
30//!
31//! No `pub use` re-exports - callers use the full path
32//! `Binary::Main::Entry::Fn()` directly.
33//!
34//! ## Planned Work
35//!
36//! - Comprehensive error recovery mechanism
37//! - Startup progress indicator
38//! - Graceful degradation for service failures
39//! - Performance metrics collection
40
41/// Main application entry point.
42///
43/// Exports `Fn()` which creates the Tokio runtime, initializes application
44/// state, constructs the Tauri builder, and runs the event loop.
45pub mod Entry;
46
47/// IPC command handlers.
48///
49/// All `#[tauri::command]` functions providing the frontend-to-backend
50/// invoke bridge: workbench configuration, IPC messaging, Wind desktop
51/// integration, configuration management, status reporting, performance
52/// monitoring, collaboration, and document synchronization.
53pub mod IPCCommands;
54
55/// Application lifecycle management.
56///
57/// Exports `AppLifecycleSetup()` which runs inside the Tauri setup hook:
58/// tray initialization, command registration, IPC server setup, window
59/// creation, environment configuration, and async service startup.
60pub mod AppLifecycle;
61
62/// System tray commands.
63///
64/// Exports the `SwitchTrayIcon()` Tauri command for switching the system
65/// tray icon based on the active theme (light or dark mode).
66pub mod Tray;