mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-09 00:24:34 +00:00
fix(cliproxy): use os.homedir() for cross-platform path expansion
Replace process.env.HOME with os.homedir() when expanding custom settings paths. On Windows, process.env.HOME is undefined, causing tilde expansion to produce invalid Unix-style paths like '/.ccs/variant.settings.json'. Closes #445
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
import { spawn, ChildProcess } from 'child_process';
|
import { spawn, ChildProcess } from 'child_process';
|
||||||
import * as net from 'net';
|
import * as net from 'net';
|
||||||
|
import * as os from 'os';
|
||||||
import { ProgressIndicator } from '../utils/progress-indicator';
|
import { ProgressIndicator } from '../utils/progress-indicator';
|
||||||
import { ok, fail, info, warn } from '../utils/ui';
|
import { ok, fail, info, warn } from '../utils/ui';
|
||||||
import { escapeShellArg } from '../utils/shell-executor';
|
import { escapeShellArg } from '../utils/shell-executor';
|
||||||
@@ -925,9 +926,7 @@ export async function execClaudeWithCLIProxy(
|
|||||||
upstreamBaseUrl: postSanitizationBaseUrl,
|
upstreamBaseUrl: postSanitizationBaseUrl,
|
||||||
verbose,
|
verbose,
|
||||||
defaultEffort: 'medium',
|
defaultEffort: 'medium',
|
||||||
traceFilePath: traceEnabled
|
traceFilePath: traceEnabled ? `${os.homedir()}/.ccs/codex-reasoning-proxy.log` : '',
|
||||||
? `${process.env.HOME || process.cwd()}/.ccs/codex-reasoning-proxy.log`
|
|
||||||
: '',
|
|
||||||
modelMap: {
|
modelMap: {
|
||||||
defaultModel: envVars.ANTHROPIC_MODEL,
|
defaultModel: envVars.ANTHROPIC_MODEL,
|
||||||
opusModel: envVars.ANTHROPIC_DEFAULT_OPUS_MODEL,
|
opusModel: envVars.ANTHROPIC_DEFAULT_OPUS_MODEL,
|
||||||
@@ -1028,7 +1027,7 @@ export async function execClaudeWithCLIProxy(
|
|||||||
// Get profile settings path for hooks (WebSearch, etc.)
|
// Get profile settings path for hooks (WebSearch, etc.)
|
||||||
// Use custom settings path for CLIProxy variants, otherwise use default provider path
|
// Use custom settings path for CLIProxy variants, otherwise use default provider path
|
||||||
const settingsPath = cfg.customSettingsPath
|
const settingsPath = cfg.customSettingsPath
|
||||||
? cfg.customSettingsPath.replace(/^~/, process.env.HOME || '')
|
? cfg.customSettingsPath.replace(/^~/, os.homedir())
|
||||||
: getProviderSettingsPath(provider);
|
: getProviderSettingsPath(provider);
|
||||||
|
|
||||||
let claude: ChildProcess;
|
let claude: ChildProcess;
|
||||||
|
|||||||
Reference in New Issue
Block a user