async fn check_cli_auth(
cmd: CommandCheckCliAuthData,
) -> Result<CheckCliAuthResult, String>Expand description
checkcliauth.
Two-phase auth check for Claude; single-phase for other providers.
Phase 1 (fast, <1 ms): read the credentials file to determine whether tokens exist at all. If no file / no tokens → return unauthenticated immediately without spawning the CLI. This avoids a 10+ second cold-start stall when the user is definitely not logged in.
Phase 2 (CLI, 10 s timeout): only when tokens ARE present, run
claude auth status --json to validate them and obtain the real email.
This catches expired/revoked tokens — the false-positive that the old
file-only fast path missed.
Other providers skip Phase 1 and go straight to the CLI (they don’t have a predictable credentials file layout).
See SPEC_AUTH_CHECK_FALSE_POSITIVE_2026_04_15.md.