diff --git a/client/src/launcher/mod.rs b/client/src/launcher/mod.rs index c155d36..5db7a99 100644 --- a/client/src/launcher/mod.rs +++ b/client/src/launcher/mod.rs @@ -25,7 +25,28 @@ fn should_run_launcher(args: &[String]) -> bool { if args.iter().any(|arg| arg == "--no-launcher") { return false; } - args.iter().any(|arg| arg == "--launcher") || args.is_empty() + if args.iter().any(|arg| arg == "--launcher") { + return true; + } + !has_direct_server_arg(args) +} + +/// Detects legacy positional direct-connect invocation (`lesavka-client `). +fn has_direct_server_arg(args: &[String]) -> bool { + let mut idx = 0usize; + while idx < args.len() { + let arg = &args[idx]; + if arg == "--server" { + idx = idx.saturating_add(2); + continue; + } + if arg.starts_with("--") { + idx += 1; + continue; + } + return true; + } + false } pub fn runtime_env_vars(state: &LauncherState) -> BTreeMap { @@ -146,4 +167,10 @@ mod tests { let args = vec!["http://server:50051".to_string()]; assert!(!should_run_launcher(&args)); } + + #[test] + fn should_run_launcher_with_server_flag() { + let args = vec!["--server".to_string(), "http://server:50051".to_string()]; + assert!(should_run_launcher(&args)); + } } diff --git a/scripts/ci/hygiene_gate_baseline.json b/scripts/ci/hygiene_gate_baseline.json index 028c386..4a8de86 100644 --- a/scripts/ci/hygiene_gate_baseline.json +++ b/scripts/ci/hygiene_gate_baseline.json @@ -63,7 +63,7 @@ "client/src/launcher/mod.rs": { "clippy_warnings": 4, "doc_debt": 4, - "loc": 149 + "loc": 176 }, "client/src/launcher/state.rs": { "clippy_warnings": 8, diff --git a/scripts/ci/quality_gate_baseline.json b/scripts/ci/quality_gate_baseline.json index 61b8842..8a15bb7 100644 --- a/scripts/ci/quality_gate_baseline.json +++ b/scripts/ci/quality_gate_baseline.json @@ -46,7 +46,7 @@ }, "client/src/launcher/mod.rs": { "line_percent": 96.15384615384616, - "loc": 149 + "loc": 176 }, "client/src/launcher/state.rs": { "line_percent": 99.32432432432432,