Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

fix(tui): run gcloud.cmd for the ADC login on Windows

Jack Rudenkoe6ee327b0b39
diff --git a/packages/cli/src/tui/index.gcloud-command.test.ts b/packages/cli/src/tui/index.gcloud-command.test.ts
new file mode 100644
index 00000000..4df98bc9
--- /dev/null
+++ b/packages/cli/src/tui/index.gcloud-command.test.ts
@@ -0,0 +1,14 @@
+// REGRESSION: The ADC login could not launch the Cloud SDK's gcloud.cmd on Windows — /dev:fix session dev-fix-20261020-235500-vtx01
+import { describe, expect, test } from "bun:test";
+import { gcloudCommand } from "./index.js";
+
+describe("gcloudCommand", () => {
+ test("uses the Cloud SDK command script on Windows", () => {
+ expect(gcloudCommand("win32")).toBe("gcloud.cmd");
+ });
+
+ test("keeps the gcloud executable on macOS and Linux", () => {
+ expect(gcloudCommand("darwin")).toBe("gcloud");
+ expect(gcloudCommand("linux")).toBe("gcloud");
+ });
+});
diff --git a/packages/cli/src/tui/index.tsx b/packages/cli/src/tui/index.tsx
index 8744ef14..77ccc745 100644
--- a/packages/cli/src/tui/index.tsx
+++ b/packages/cli/src/tui/index.tsx
@@ -17,6 +17,10 @@ import { App } from "./App.js";
import { invalidateProbeProxyHandlers, shutdownProbeProxy } from "./probe-proxy.js";
import type { ProviderLoginAction } from "./providers.js";
+export function gcloudCommand(platform: NodeJS.Platform): string {
+ return platform === "win32" ? "gcloud.cmd" : "gcloud";
+}
+
/**
* Start the config TUI. Re-entrant: if App requests a login,
* we tear down the renderer, spawn the login command as a CHILD
@@ -95,7 +99,11 @@ export async function startConfigTui(): Promise<void> {
// and the OAuth callback server work normally.
const result =
action.kind === "gcloud-adc"
- ? spawnSync("gcloud", ["auth", "application-default", "login"], { stdio: "inherit" })
+ ? spawnSync(gcloudCommand(process.platform), ["auth", "application-default", "login"], {
+ stdio: "inherit",
+ // Windows .cmd scripts require a shell to execute.
+ shell: process.platform === "win32",
+ })
: spawnSync(process.argv[0], [process.argv[1], "login", action.slug], { stdio: "inherit" });
if (result.error) {
if (