Merge pull request #43 from kaitranntt/kai/fix/windows-cliproxy-auth

fix(cliproxy): resolve windows auth browser not opening
This commit is contained in:
Kai (Tam Nhu) Tran authored and GitHub committed 2025-12-02 21:18:41 -05:00
commit cf577a5b40
3 files changed
+28 -11

No files matched your search

+4 -2
View File
@@ -94,8 +94,10 @@ function isHeadlessEnvironment(): boolean {
return true;
}
// Non-interactive (piped stdin)
if (!process.stdin.isTTY) {
// Non-interactive (piped stdin) - skip on Windows
// Windows npm wrappers don't set isTTY correctly (returns undefined, not true)
// Windows desktop environments always have browser capability
if (process.platform !== 'win32' && !process.stdin.isTTY) {
return true;
}
+6 -2
View File
@@ -1,7 +1,11 @@
import * as fs from 'fs';
import * as path from 'path';
import { initUI, box, color, dim, sectionHeader, subheader } from '../utils/ui';
// Version is read from VERSION file during build
const VERSION = '5.3.0';
// Get version from package.json (same as version-command.ts)
const VERSION = JSON.parse(
fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf8')
).version;
/**
* Print a major section with ═══ borders (only for 3 main sections)
+18 -7
View File
@@ -6,7 +6,8 @@ import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import { spawn } from 'child_process';
import { detectClaudeCli } from '../utils/claude-detector';
import { getClaudeCliInfo } from '../utils/claude-detector';
import { escapeShellArg } from '../utils/shell-executor';
import { initUI, header, box, table, color, ok, fail, warn, info } from '../utils/ui';
import packageJson from '../../package.json';
import {
@@ -180,9 +181,9 @@ class Doctor {
private async checkClaudeCli(): Promise<void> {
const spinner = ora('Checking Claude CLI').start();
const claudeCli = detectClaudeCli();
const cliInfo = getClaudeCliInfo();
if (!claudeCli) {
if (!cliInfo) {
spinner.fail();
console.log(` ${fail('Claude CLI'.padEnd(22))} Not found in PATH`);
this.results.addCheck(
@@ -195,13 +196,23 @@ class Doctor {
return;
}
const { path: claudeCli, needsShell } = cliInfo;
// Try to execute claude --version
try {
const result = await new Promise<string>((resolve, reject) => {
const child = spawn(claudeCli, ['--version'], {
stdio: 'pipe',
timeout: 5000,
});
// When shell is needed (Windows .cmd/.bat files), concatenate into string
// to avoid DEP0190 warning about passing args with shell: true
const child = needsShell
? spawn([claudeCli, '--version'].map(escapeShellArg).join(' '), {
stdio: 'pipe',
timeout: 5000,
shell: true,
})
: spawn(claudeCli, ['--version'], {
stdio: 'pipe',
timeout: 5000,
});
let output = '';
child.stdout?.on('data', (data: Buffer) => (output += data));