diff --git a/src/cli/doctor/checks/tools-gh.test.ts b/src/cli/doctor/checks/tools-gh.test.ts
new file mode 100644
index 000000000..46eec87e5
--- /dev/null
+++ b/src/cli/doctor/checks/tools-gh.test.ts
@@ -0,0 +1,35 @@
+///
+
+import { afterEach, describe, expect, it, mock } from "bun:test"
+
+const originalWhich = Bun.which
+
+afterEach(() => {
+ Bun.which = originalWhich
+ mock.restore()
+})
+
+describe("getGhCliInfo", () => {
+ it("falls back to gh --version when Bun.which cannot find gh", async () => {
+ // given
+ Bun.which = mock(() => null)
+ mock.module("../spawn-with-timeout", () => ({
+ spawnWithTimeout: mock((command: string[]) => {
+ if (command.join(" ") === "gh --version") {
+ return Promise.resolve({ stdout: "gh version 2.82.1\n", stderr: "", exitCode: 0, timedOut: false })
+ }
+
+ return Promise.resolve({ stdout: "", stderr: "not logged in", exitCode: 1, timedOut: false })
+ }),
+ }))
+ const { getGhCliInfo } = await import("./tools-gh")
+
+ // when
+ const info = await getGhCliInfo()
+
+ // then
+ expect(info.installed).toBe(true)
+ expect(info.version).toBe("2.82.1")
+ expect(info.path).toBe(null)
+ })
+})
diff --git a/src/cli/doctor/checks/tools-gh.ts b/src/cli/doctor/checks/tools-gh.ts
index 71a539d1e..6839a71fc 100644
--- a/src/cli/doctor/checks/tools-gh.ts
+++ b/src/cli/doctor/checks/tools-gh.ts
@@ -80,6 +80,20 @@ async function getGhAuthStatus(): Promise<{
export async function getGhCliInfo(): Promise {
const binaryStatus = await checkBinaryExists("gh")
if (!binaryStatus.exists) {
+ const version = await getGhVersion()
+ if (version) {
+ const authStatus = await getGhAuthStatus()
+ return {
+ installed: true,
+ version,
+ path: null,
+ authenticated: authStatus.authenticated,
+ username: authStatus.username,
+ scopes: authStatus.scopes,
+ error: authStatus.error,
+ }
+ }
+
return {
installed: false,
version: null,