Expand description
§Bootstrap (Command)
Registers all native, Rust-implemented commands and providers into the application’s state at startup. This module ensures all core functionality is available as soon as the application initializes.
§RESPONSIBILITIES
§1. Command Registration
- Register all Tauri command handlers from
Command::module - Register core IPC command handlers from
Track::module - Build the complete
invoke_handlervector for Tauri builder - Ensure all commands are available before UI starts
§2. Tree View Provider Registration
- Register native tree view providers (FileExplorer, etc.)
- Create provider instances and store in
ApplicationState::ActiveTreeViews - Associate view identifiers with provider implementations
§3. Provider Registration
- Initialize Environment providers that need early setup
- Register command executors and configuration providers
- Set up document and workspace providers
§ARCHITECTURAL ROLE
Bootstrap is the registration orchestrator for Mountain’s startup:
Binary::Main ──► Bootstrap::RegisterAll ──► Tauri Builder ──► App Ready
│
├─► Command Handlers Registered
├─► Tree View Providers Registered
└─► ApplicationState Populated§Position in Mountain
Commandmodule: Command system initialization- Called from
Binary::Main::Fnduring Tauri builder setup - Must complete before
.run()is called on Tauri app
§Key Functions
RegisterAll: Main entry point that registers everythingRegisterCommands: Adds all Tauri command handlersRegisterTreeViewProviders: Registers native tree view providers
§REGISTRATION PROCESS
- Commands: All command functions are added to Tauri’s
invoke_handlerviatauri::generate_handler![]macro - Tree Views: Native providers are instantiated and stored in state
- Error Handling: Registration failures are logged but don’t stop startup
§COMMAND REGISTRATION
The following command modules are registered:
Command::TreeView::GetTreeViewChildrenCommand::LanguageFeature::MountainProvideHoverCommand::LanguageFeature::MountainProvideCompletionsCommand::LanguageFeature::MountainProvideDefinitionCommand::LanguageFeature::MountainProvideReferencesCommand::SourceControlManagement::GetAllSourceControlManagementStateCommand::Keybinding::GetResolvedKeybindingTrack::DispatchLogic::DispatchFrontendCommandTrack::DispatchLogic::ResolveUIRequestIPC::TauriIPCServer::mountain_ipc_receive_messageIPC::TauriIPCServer::mountain_ipc_get_statusBinary::Main::SwitchTrayIconBinary::Main::MountainGetWorkbenchConfiguration- (and more…)
§TREE VIEW PROVIDERS
Currently registered native providers:
FileExplorerViewProvider: File system tree view- View ID:
"fileExplorer" - Provides workspace folders and file listings
- View ID:
§PERFORMANCE
- Registration is synchronous and fast (no async allowed in registration)
- All commands are registered up-front; no lazy loading
- Tree view providers are created once at startup
§ERROR HANDLING
- Command registration errors are logged as errors
- Tree view provider errors are logged as warnings
- Registration continues even if some components fail
§TODO
- Add command registration metrics (count, duplicates detection)
- Implement command dependency ordering
- Add command validation (duplicate names, signature checking)
- Support dynamic command registration after startup
- Add command unregistration for hot-reload scenarios
- Implement command permission system
§MODULE CONTENTS
RegisterAll: Main registration function called from Binary::MainRegisterCommands: Internal function to register all command handlersRegisterTreeViewProviders: Internal function to register tree view providers
Functions§
- Command
Close 🔒Document - A native command for closing the current document.
- Command
Format 🔒Document - A native command that orchestrates the “Format Document” action.
- Command
Hello 🔒World - A simple native command that logs a message.
- Command
Open 🔒File - A native command that orchestrates the “Open File” dialog flow.
- Command
Reload 🔒Window - A native command for reloading the window.
- Command
Save 🔒Document - A native command for saving the current document.
- Register
Native Commands - Registers all native commands and providers with the application state.
- Validate
Command 🔒Parameters - Validates command parameters before execution.