docs: add detailed comments explaining environment inheritance for Claude CLI auth

This commit is contained in:
Roo Code 2025-09-26 00:30:05 +00:00
parent f877670143
commit a4b0bc0229

View file

@ -191,9 +191,11 @@ function runProcess({
process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS ||
CLAUDE_CODE_DEFAULT_MAX_OUTPUT_TOKENS.toString(),
},
// Inherit the shell environment to ensure authentication tokens are available
// IMPORTANT: These options are critical for Claude CLI authentication
// extendEnv: true - Inherits parent process environment variables including ANTHROPIC_API_KEY
// shell: true - Ensures proper environment variable expansion for authentication tokens
// Without these, Claude CLI fails with "Invalid API key" even when properly authenticated
extendEnv: true,
// Use shell to ensure proper environment variable expansion
shell: true,
cwd,
maxBuffer: 1024 * 1024 * 1000,