MCPcopy Index your code
hub / github.com/callstack/agent-device / detectAuthMode

Function detectAuthMode

src/cli/auth-session.ts:474–483  ·  view source on GitHub ↗
(
  env: EnvMap,
  io?: AuthIo,
)

Source from the content-addressed store, hash-verified

472}
473
474function detectAuthMode(
475 env: EnvMap,
476 io?: AuthIo,
477): 'local-browser' | 'device-code' | 'non-interactive' {
478 const stdinIsTTY = io?.stdinIsTTY ?? process.stdin.isTTY;
479 const stdoutIsTTY = io?.stdoutIsTTY ?? process.stdout.isTTY;
480 if (isCi(env) || !stdinIsTTY || !stdoutIsTTY) return 'non-interactive';
481 if (isRemoteShell(env)) return 'device-code';
482 return 'local-browser';
483}
484
485function isCi(env: EnvMap): boolean {
486 return env.CI === 'true' || env.GITHUB_ACTIONS === 'true' || env.BUILDKITE === 'true';

Callers 1

loginWithDeviceAuthFunction · 0.85

Calls 2

isCiFunction · 0.85
isRemoteShellFunction · 0.85

Tested by

no test coverage detected