@@ -39,15 +39,18 @@ export async function generateWithCLI(
3939 progressCallback ( `Using ${ model } model...` ) ;
4040 }
4141
42- const command =
43- process . platform === "win32"
44- ? `type "${ promptFile } " | ${ escapedCliPath } -p --model ${ model } `
45- : `cat "${ promptFile } " | ${ escapedCliPath } -p --model ${ model } ` ;
42+ const baseCommand = process . platform === "win32"
43+ ? `type "${ promptFile } " | ${ escapedCliPath } -p --model ${ model } `
44+ : `cat "${ promptFile } " | ${ escapedCliPath } -p --model ${ model } ` ;
45+
46+ // Use login shell to load user's environment variables (e.g., from .bashrc, .profile)
47+ const command = process . platform === "win32"
48+ ? baseCommand
49+ : `/bin/bash -l -c ${ JSON . stringify ( baseCommand ) } ` ;
4650
4751 logCommand ( command ) ;
4852
4953 const { stdout, stderr } = await execAsync ( command , {
50- shell : process . platform === "win32" ? "cmd.exe" : "/bin/bash" ,
5154 maxBuffer : 10 * 1024 * 1024 ,
5255 timeout : 120000 ,
5356 } ) ;
@@ -163,15 +166,18 @@ export async function generateWithCLIManaged(
163166 progressCallback ( "Using haiku model (managed mode)..." ) ;
164167 }
165168
166- const command =
167- process . platform === "win32"
168- ? `type "${ promptFile } " | ${ escapedCliPath } -p --model haiku`
169- : `cat "${ promptFile } " | ${ escapedCliPath } -p --model haiku` ;
169+ const baseCommand = process . platform === "win32"
170+ ? `type "${ promptFile } " | ${ escapedCliPath } -p --model haiku`
171+ : `cat "${ promptFile } " | ${ escapedCliPath } -p --model haiku` ;
172+
173+ // Use login shell to load user's environment variables (e.g., from .bashrc, .profile)
174+ const command = process . platform === "win32"
175+ ? baseCommand
176+ : `/bin/bash -l -c ${ JSON . stringify ( baseCommand ) } ` ;
170177
171178 logCommand ( command ) ;
172179
173180 const { stdout, stderr } = await execAsync ( command , {
174- shell : process . platform === "win32" ? "cmd.exe" : "/bin/bash" ,
175181 maxBuffer : 10 * 1024 * 1024 ,
176182 timeout : 120000 ,
177183 cwd : repoPath ,
0 commit comments