Skip to main content

Grove/Binary/Main/
mod.rs

1//! Main Module (Binary)
2//!
3//! Entry point for the standalone Grove binary.
4//! Provides CLI argument parsing and initialization.
5
6pub mod Entry;
7
8/// Main entry result
9pub type MainResult<T> = anyhow::Result<T>;
10
11/// CLI arguments wrapper
12#[derive(Debug, Clone)]
13pub struct CliArgs {
14	/// Mode of operation
15	pub mode:String,
16
17	/// Extension path
18	pub extension:Option<String>,
19
20	/// Transport type
21	pub transport:String,
22
23	/// gRPC address
24	pub grpc_address:String,
25
26	/// Mountain address (for service mode)
27	pub mountain_address:String,
28
29	/// Enable WASI
30	pub wasi:bool,
31
32	/// Memory limit in MB
33	pub memory_limit_mb:u64,
34
35	/// Max execution time in ms
36	pub max_execution_time_ms:u64,
37
38	/// Enable verbose logging
39	pub verbose:bool,
40}
41
42impl Default for CliArgs {
43	fn default() -> Self {
44		Self {
45			mode:"standalone".to_string(),
46
47			extension:None,
48
49			transport:"wasm".to_string(),
50
51			grpc_address:"127.0.0.1:50051".to_string(),
52
53			mountain_address:"127.0.0.1:50050".to_string(),
54
55			wasi:true,
56
57			memory_limit_mb:512,
58
59			max_execution_time_ms:30000,
60
61			verbose:false,
62		}
63	}
64}
65
66#[cfg(test)]
67mod tests {
68
69	use super::*;
70
71	#[test]
72	fn test_cli_args_default() {
73		let args = CliArgs::default();
74
75		assert_eq!(args.mode, "standalone");
76
77		assert_eq!(args.transport, "wasm");
78
79		assert!(args.wasi);
80
81		assert_eq!(args.memory_limit_mb, 512);
82	}
83}