From af4d6cff89395a74e2eaf56551d3f56b95e0a6ce Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Tue, 2 Dec 2025 21:10:38 -0500 Subject: [PATCH 1/2] fix(cliproxy): resolve windows auth browser not opening - skip TTY check on Windows (process.stdin.isTTY returns undefined) - Windows desktop environments always have browser capability - also fix help-command version to read from package.json Closes #42 --- src/cliproxy/auth-handler.ts | 6 ++++-- src/commands/help-command.ts | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cliproxy/auth-handler.ts b/src/cliproxy/auth-handler.ts index eb027268..4a192c33 100644 --- a/src/cliproxy/auth-handler.ts +++ b/src/cliproxy/auth-handler.ts @@ -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; } diff --git a/src/commands/help-command.ts b/src/commands/help-command.ts index edac032a..8c065226 100644 --- a/src/commands/help-command.ts +++ b/src/commands/help-command.ts @@ -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) From cfe9ba05a4351302fbb330ca00b6025cb65a8f20 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Tue, 2 Dec 2025 21:16:45 -0500 Subject: [PATCH 2/2] fix(doctor): resolve windows claude cli detection failure Windows .cmd/.bat wrapper scripts require shell: true in spawn options. Uses same pattern as other files (ccs.ts, cliproxy-executor.ts, shell-executor.ts): - getClaudeCliInfo() returns needsShell flag - Concatenate command string when shell needed to avoid DEP0190 warning Closes #41 --- src/management/doctor.ts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/management/doctor.ts b/src/management/doctor.ts index ae9a98d4..51e9f5c8 100644 --- a/src/management/doctor.ts +++ b/src/management/doctor.ts @@ -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 { 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((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));