feat(profile): --profile auto + stop steering users into temp-profile launches
Addresses the footgun raised in issue #1 follow-up: plain `--launch` silently uses a temporary EMPTY profile (no cookies/login), and the connect-failure error even recommended it — trapping agents into thinking they reused the logged-in browser when they didn't. - `--profile auto`: resolves to the Chrome profile last used (from Local State `profile.last_used`), falling back to "Default", then the first profile. So `--launch --profile auto open <url>` reuses real login state without naming the profile. (--profile <name>/Default already worked.) - connect-failure error now recommends `--launch --profile auto` and states plainly that bare `--launch` is a temporary EMPTY profile — no cookies/login. - bare `--launch` (no --profile, not CI) now prints a warning to that effect. - README: fix Setup (relaunch with --remote-debugging-port, not chrome://inspect) and split Standalone mode into throwaway vs. keep-your-login (`--profile auto`). Tests: resolve_chrome_profile("auto") prefers last_used, falls back to Default.
This commit is contained in:
@@ -531,6 +531,18 @@ fn main() {
|
||||
let mut flags = parse_flags(&args);
|
||||
let clean = clean_args(&args);
|
||||
|
||||
// Loudly warn when launching a fresh browser with no profile: it gets a
|
||||
// temporary EMPTY profile (no cookies / no login). For logged-in sites the
|
||||
// user almost always wants --profile auto (their real Chrome profile).
|
||||
// Skipped under CI (force_launch is implicit there and login isn't expected).
|
||||
if flags.force_launch && flags.profile.is_none() && env::var("CI").is_err() {
|
||||
eprintln!(
|
||||
"⚠ --launch uses a temporary EMPTY browser profile (no cookies, no login). \
|
||||
For logged-in sites, add `--profile auto` (or `--profile Default`) to reuse \
|
||||
your real Chrome session."
|
||||
);
|
||||
}
|
||||
|
||||
let has_help = args.iter().any(|a| a == "--help" || a == "-h");
|
||||
let has_version = args.iter().any(|a| a == "--version" || a == "-V");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user