Skip to content

Commit 8cba79c

Browse files
refactor(Mountain): Decompose Utilities module into explicit submodules
Split the monolithic Utilities.rs into 7 domain-specific modules under WindServiceHandlers/Utilities/: ApplicationRoot, ChannelPriority, JsonValueHelpers, MetadataEncoding, PathExtraction, RecentlyOpened, and UserdataDir. Update all call sites in FileSystem/Native handlers, Scheme.rs, WindowBuild.rs, and AppLifecycle.rs to use explicit module paths (e.g., `Utilities::PathExtraction::extract_path_from_arg`) instead of flat imports. This continues the module decomposition pattern from recent commits, replacing the catch-all Utilities module with granular domain-specific handlers. The explicit reverse-hierarchical paths make dependency relationships clear at every call site, consistent with CLAUDE.md requirements. Also reverts binary/lib names in Cargo.toml and tauri.conf.json to the verbose development profile format, matching the pre-simplification state.
1 parent 70c3174 commit 8cba79c

27 files changed

Lines changed: 757 additions & 403 deletions

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[bin]]
2-
name = "Mountain"
2+
name = "DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_Mountain"
33
path = "Source/Library.rs"
44

55
[build-dependencies]
@@ -148,7 +148,7 @@ TierOpenExternalLayer4 = []
148148
TierExtensionScanParallel = []
149149

150150
[lib]
151-
name = "Mountain"
151+
name = "DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_Mountain"
152152
path = "Source/Library.rs"
153153
crate-type = ["lib", "staticlib"]
154154

@@ -158,11 +158,11 @@ autobenches = false
158158
autobins = false
159159
autoexamples = false
160160
autotests = false
161-
default-run = "Mountain"
161+
default-run = "DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_Mountain"
162162
description = "Mountain ⛰️"
163163
edition = "2021"
164164
license-file = "LICENSE"
165-
name = "Mountain"
165+
name = "DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_Mountain"
166166
publish = false
167167
include = [
168168
"build.rs",

Cargo.toml.Backup

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
[[bin]]
2+
name = "Mountain"
3+
path = "Source/Library.rs"
4+
5+
[build-dependencies]
6+
json5 = { workspace = true }
7+
toml_edit = { workspace = true }
8+
serde = { workspace = true, features = ["derive"] }
9+
serde_json = { workspace = true }
10+
tauri-build = { workspace = true, features = [] }
11+
toml = { workspace = true }
12+
tonic-build = { workspace = true, features = ["transport"] }
13+
tonic-prost-build = { workspace = true }
14+
15+
[dev-dependencies]
16+
tokio-test = { workspace = true }
17+
futures = { workspace = true }
18+
19+
[dependencies]
20+
tauri = { workspace = true, features = [
21+
"compression",
22+
"devtools",
23+
"image-png",
24+
"rustls-tls",
25+
"tray-icon",
26+
"wry",
27+
], default-features = false }
28+
29+
tauri-plugin-dialog = { workspace = true }
30+
tauri-plugin-fs = { workspace = true }
31+
tauri-plugin-localhost = { workspace = true }
32+
tauri-plugin-log = { workspace = true }
33+
34+
async-trait = { workspace = true }
35+
anyhow = { workspace = true } # TODO: Added for error handling in CertificateManager
36+
arboard = { workspace = true }
37+
base64 = { workspace = true }
38+
chrono = { workspace = true, features = ["serde"] }
39+
colored = { workspace = true }
40+
Common = { workspace = true }
41+
dirs = { workspace = true }
42+
Echo = { workspace = true }
43+
Air = { workspace = true, optional = true }
44+
Mist = { workspace = true }
45+
env_logger = { workspace = true }
46+
futures-util = { workspace = true, features = ["sink", "std"] }
47+
globset = { workspace = true }
48+
grep-regex = { workspace = true }
49+
grep-searcher = { workspace = true }
50+
http = { workspace = true }
51+
ignore = { workspace = true }
52+
keyring = { workspace = true }
53+
lazy_static = { workspace = true }
54+
log = { workspace = true }
55+
md5 = { workspace = true }
56+
notify = { workspace = true }
57+
num_cpus = { workspace = true }
58+
once_cell = { workspace = true }
59+
open = { workspace = true }
60+
parking_lot = { workspace = true }
61+
portable-pty = { workspace = true }
62+
portpicker = { workspace = true }
63+
prost = { workspace = true }
64+
rand = { workspace = true }
65+
regex = { workspace = true }
66+
serde = { workspace = true }
67+
serde_json = { workspace = true }
68+
sha2 = { workspace = true }
69+
sysinfo = { workspace = true }
70+
hostname = { workspace = true }
71+
thiserror = { workspace = true }
72+
tokio = { workspace = true, features = ["full"] }
73+
tokio-tungstenite = { workspace = true, features = ["rustls-tls-native-roots"] }
74+
tokio-util = { workspace = true, features = ["full"] }
75+
pem = { workspace = true }
76+
rcgen = { workspace = true }
77+
p256 = { workspace = true }
78+
x509-parser = { workspace = true }
79+
rustls-pki-types = { workspace = true }
80+
rustls = { workspace = true } # TODO: Added for TLS configuration in CertificateManager
81+
toml = { workspace = true }
82+
tonic = { workspace = true }
83+
tonic-prost = { workspace = true }
84+
url = { workspace = true, features = ["serde"] }
85+
uuid = { workspace = true, features = ["v4", "serde"] }
86+
flate2 = { workspace = true }
87+
ring = { workspace = true }
88+
bincode = { workspace = true }
89+
brotli = { workspace = true }
90+
hex = { workspace = true }
91+
opentelemetry = { workspace = true, features = ["trace"] }
92+
posthog-rs = { workspace = true }
93+
zip = { workspace = true }
94+
95+
[features]
96+
default = ["ExtensionHostCocoon", "MistNative", "AirIntegration"]
97+
98+
ExtensionHostCocoon = []
99+
100+
MistNative = []
101+
102+
Debug = []
103+
104+
AirIntegration = ["Air"]
105+
106+
# Feature flags for conditional compilation
107+
grove = []
108+
cocoon = []
109+
terminals = []
110+
debug-protocol = []
111+
scm-support = []
112+
child-processes = []
113+
Telemetry = []
114+
Development = []
115+
Test = []
116+
117+
# ===========================================================================
118+
# Tier-gating (Plan A §Rust feature flags). Every name here is mirrored by
119+
# `build.rs::IsDeclaredTierFeature`. Adding a new tier requires editing
120+
# BOTH places so typos in `.env.Land` fail loud.
121+
# ===========================================================================
122+
123+
# Tier:RemoteProcedureCall:SharedMemory 🟣 Experimental
124+
TierRemoteProcedureCallSharedMemory = []
125+
# Tier:HTTPProxy:Hyper 🟣 Experimental
126+
TierHTTPProxyHyper = []
127+
# Tier:Logger:Ring 🟣 Experimental
128+
TierLoggerRing = []
129+
# Tier:FileSystem:Layer4 🟣 Experimental
130+
TierFileSystemLayer4 = []
131+
# Tier:FindFiles:Layer4 🟣 Experimental
132+
TierFindFilesLayer4 = []
133+
# Tier:Glob:Native 🟣 Experimental - globset-compiled patterns
134+
TierGlobNative = []
135+
# Tier:FileWatcher:Layer4 🟣 Experimental - notify-rs FS events (dep is already on the crate)
136+
TierFileWatcherLayer4 = []
137+
# Tier:SchemeAssets:Hybrid 🟣 Experimental
138+
TierSchemeAssetsHybrid = []
139+
# Tier:Configuration:Eager 🟣 Experimental
140+
TierConfigurationEager = []
141+
# Tier:Diagnostics:Delta 🟣 Experimental
142+
TierDiagnosticsDelta = []
143+
# Tier:Clipboard:Layer4 🟣 Experimental - arboard crate is on the crate unconditionally
144+
TierClipboardLayer4 = []
145+
# Tier:OpenExternal:Layer4 🟣 Experimental - `open` crate is on the crate unconditionally
146+
TierOpenExternalLayer4 = []
147+
# Tier:ExtensionScan:Parallel 🟣 Experimental
148+
TierExtensionScanParallel = []
149+
150+
[lib]
151+
name = "Mountain"
152+
path = "Source/Library.rs"
153+
crate-type = ["lib", "staticlib"]
154+
155+
[package]
156+
authors = ["Source 🖋️ Open 👐🏻 <Source/Open@Editor.Land>"]
157+
autobenches = false
158+
autobins = false
159+
autoexamples = false
160+
autotests = false
161+
default-run = "Mountain"
162+
description = "Mountain ⛰️"
163+
edition = "2021"
164+
license-file = "LICENSE"
165+
name = "Mountain"
166+
publish = false
167+
include = [
168+
"build.rs",
169+
"capabilities/**/*",
170+
"Cargo.toml",
171+
"CHANGELOG.md",
172+
"gen/**/*",
173+
"icons/**/*",
174+
"LICENSE",
175+
"Mountain.key.pub",
176+
"Proto/**/*",
177+
"README.md",
178+
"Source/**/*",
179+
"tauri.conf.json",
180+
"Test/**/*",
181+
]
182+
version = "0.0.1"
183+
184+
[package.metadata.docs.rs]
185+
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
186+
all-features = true
187+
default-target = "x86_64-unknown-linux-gnu"
188+
targets = [
189+
"x86_64-unknown-linux-gnu",
190+
"x86_64-apple-darwin",
191+
"aarch64-apple-darwin",
192+
]

Source/Binary/Build/Scheme.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ pub fn VscodeFileSchemeHandler<R:tauri::Runtime>(
888888
}
889889

890890
// Fallback: read from filesystem (dev mode where assets aren't embedded)
891-
let StaticRoot = crate::IPC::WindServiceHandlers::Utilities::get_static_application_root();
891+
let StaticRoot = crate::IPC::WindServiceHandlers::Utilities::ApplicationRoot::get_static_application_root();
892892

893893
if let Some(Root) = StaticRoot {
894894
let FilesystemPath = std::path::Path::new(&Root).join(&CleanPath);

Source/Binary/Build/WindowBuild.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use tauri::{App, WebviewUrl, WebviewWindowBuilder, Wry};
66

7-
use crate::IPC::WindServiceHandlers::Utilities::ReadRecentlyOpened;
7+
use crate::IPC::WindServiceHandlers::Utilities::RecentlyOpened::ReadRecentlyOpened;
88

99
/// Creates and configures the main application window.
1010
///

Source/Binary/Main/AppLifecycle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub fn AppLifecycleSetup(
185185

186186
// Set the canonical userdata base so WindServiceHandlers resolves
187187
// /User/... paths to the real Tauri app_data_dir (not hardcoded "Land").
188-
crate::IPC::WindServiceHandlers::Utilities::set_userdata_base_dir(AppDataDir.to_string_lossy().to_string());
188+
crate::IPC::WindServiceHandlers::Utilities::UserdataDir::set_userdata_base_dir(AppDataDir.to_string_lossy().to_string());
189189

190190
// Set the real filesystem root for /Static/Application/ path mapping.
191191
// In dev mode, Tauri serves from ../Sky/Target relative to Mountain.
@@ -209,7 +209,7 @@ pub fn AppLifecycleSetup(
209209
std::path::PathBuf::new()
210210
}
211211
});
212-
crate::IPC::WindServiceHandlers::Utilities::set_static_application_root(SkyTargetDir.to_string_lossy().to_string());
212+
crate::IPC::WindServiceHandlers::Utilities::ApplicationRoot::set_static_application_root(SkyTargetDir.to_string_lossy().to_string());
213213
dev_log!(
214214
"lifecycle",
215215
"[Lifecycle] [Dirs] Static application root: {}",

Source/IPC/WindServiceHandlers/FileSystem/Native/FileCloneNative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
use serde_json::Value;
88

9-
use crate::IPC::WindServiceHandlers::Utilities::extract_path_from_arg;
9+
use crate::IPC::WindServiceHandlers::Utilities::PathExtraction::extract_path_from_arg;
1010

1111
pub async fn handle_file_clone_native(args:Vec<Value>) -> Result<Value, String> {
1212
let Source = extract_path_from_arg(args.get(0).ok_or("Missing source path")?)?;

Source/IPC/WindServiceHandlers/FileSystem/Native/FileDeleteNative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
use serde_json::Value;
88

9-
use crate::IPC::WindServiceHandlers::Utilities::extract_path_from_arg;
9+
use crate::IPC::WindServiceHandlers::Utilities::PathExtraction::extract_path_from_arg;
1010

1111
pub async fn handle_file_delete_native(args:Vec<Value>) -> Result<Value, String> {
1212
let Path = extract_path_from_arg(args.get(0).ok_or("Missing file path")?)?;

Source/IPC/WindServiceHandlers/FileSystem/Native/FileExistsNative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use serde_json::{Value, json};
66

7-
use crate::IPC::WindServiceHandlers::Utilities::extract_path_from_arg;
7+
use crate::IPC::WindServiceHandlers::Utilities::PathExtraction::extract_path_from_arg;
88

99
pub async fn handle_file_exists_native(args:Vec<Value>) -> Result<Value, String> {
1010
let Path = extract_path_from_arg(args.get(0).ok_or("Missing file path")?)?;

Source/IPC/WindServiceHandlers/FileSystem/Native/FileMkdirNative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use serde_json::Value;
77

8-
use crate::IPC::WindServiceHandlers::Utilities::extract_path_from_arg;
8+
use crate::IPC::WindServiceHandlers::Utilities::PathExtraction::extract_path_from_arg;
99

1010
pub async fn handle_file_mkdir_native(args:Vec<Value>) -> Result<Value, String> {
1111
let Path = extract_path_from_arg(args.get(0).ok_or("Missing directory path")?)?;

Source/IPC/WindServiceHandlers/FileSystem/Native/FileReadNative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
use serde_json::{Value, json};
1212

13-
use crate::{IPC::WindServiceHandlers::Utilities::extract_path_from_arg, dev_log};
13+
use crate::{IPC::WindServiceHandlers::Utilities::PathExtraction::extract_path_from_arg, dev_log};
1414

1515
pub async fn handle_file_read_native(args:Vec<Value>) -> Result<Value, String> {
1616
let Path = extract_path_from_arg(args.get(0).ok_or("Missing file path")?)?;

0 commit comments

Comments
 (0)