feat: add --auto-connect flag to discover and connect to running Chrome (#432)

This commit is contained in:
Chris Tate
2026-02-12 18:37:37 -06:00
committed by GitHub
parent 9c20979bfe
commit 9a01e8b3b5
12 changed files with 283 additions and 5 deletions
+4
View File
@@ -20,6 +20,7 @@ pub struct Flags {
pub ignore_https_errors: bool,
pub allow_file_access: bool,
pub device: Option<String>,
pub auto_connect: bool,
// Track which launch-time options were explicitly passed via CLI
// (as opposed to being set only via environment variables)
@@ -65,6 +66,7 @@ pub fn parse_flags(args: &[String]) -> Flags {
ignore_https_errors: false,
allow_file_access: env::var("AGENT_BROWSER_ALLOW_FILE_ACCESS").is_ok(),
device: env::var("AGENT_BROWSER_IOS_DEVICE").ok(),
auto_connect: env::var("AGENT_BROWSER_AUTO_CONNECT").is_ok(),
// Track CLI-passed flags (default false, set to true when flag is passed)
cli_executable_path: false,
cli_extensions: false,
@@ -175,6 +177,7 @@ pub fn parse_flags(args: &[String]) -> Flags {
i += 1;
}
}
"--auto-connect" => flags.auto_connect = true,
_ => {}
}
i += 1;
@@ -194,6 +197,7 @@ pub fn clean_args(args: &[String]) -> Vec<String> {
"--debug",
"--ignore-https-errors",
"--allow-file-access",
"--auto-connect",
];
// Global flags that take a value (need to skip the next arg too)
const GLOBAL_FLAGS_WITH_VALUE: &[&str] = &[