feat(env): add debug logging for global env injection

- log injected global env var names in debug mode (CCS_DEBUG)

- log when telemetry/reporting env vars are applied in CLIProxy
This commit is contained in:
kaitranntt
2025-12-19 07:58:19 -05:00
parent c76a4dd825
commit 68eab562ce
2 changed files with 10 additions and 0 deletions
+6
View File
@@ -499,6 +499,12 @@ async function main(): Promise<void> {
const globalEnvConfig = getGlobalEnvConfig();
const globalEnv = globalEnvConfig.enabled ? globalEnvConfig.env : {};
// Log global env injection for visibility (debug mode only)
if (globalEnvConfig.enabled && Object.keys(globalEnv).length > 0 && process.env.CCS_DEBUG) {
const envNames = Object.keys(globalEnv).join(', ');
console.error(`[i] Global env: ${envNames}`);
}
// CRITICAL: Load settings and explicitly set ANTHROPIC_* env vars
// to prevent inheriting stale values from previous CLIProxy sessions.
// Environment variables take precedence over --settings file values,
+4
View File
@@ -530,6 +530,10 @@ export async function execClaudeWithCLIProxy(
if (Object.keys(webSearchEnv).length > 0) {
log(`Claude env: WebSearch config=${JSON.stringify(webSearchEnv)}`);
}
// Log global env vars for visibility
if (envVars.DISABLE_TELEMETRY || envVars.DISABLE_ERROR_REPORTING || envVars.DISABLE_BUG_COMMAND) {
log(`Claude env: Global env applied (telemetry/reporting disabled)`);
}
// Filter out CCS-specific flags before passing to Claude CLI
// Note: Proxy flags (--proxy-host, etc.) already stripped by resolveProxyConfig()