diff --git a/src/cli/commands/auth/login.ts b/src/cli/commands/auth/login.ts index cae9edaa..a92e4a30 100644 --- a/src/cli/commands/auth/login.ts +++ b/src/cli/commands/auth/login.ts @@ -1,6 +1,7 @@ import { Command } from "commander"; import { log } from "@clack/prompts"; import pWaitFor from "p-wait-for"; +import open from "open"; import { writeAuth, generateDeviceCode, @@ -30,9 +31,14 @@ async function generateAndDisplayDeviceCode(): Promise { log.info( `Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + - `\nPlease confirm this code at: ${deviceCodeResponse.verificationUri}` + `\nPlease confirm this code at: ${theme.colors.links(deviceCodeResponse.verificationUri)}` ); + // Auto-open browser in TTY environments + if (process.stdout.isTTY) { + await open(deviceCodeResponse.verificationUri); + } + return deviceCodeResponse; }