File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { CopilotClient , approveAll , type SessionEvent } from "@github/copilot-sdk" ;
12import * as readline from "node:readline" ;
23
3- // Normally these should be imported from @github /copilot-sdk, but within this repo
4- // we import from source to enable debugging into the SDK code.
5- import { CopilotClient , approveAll , type SessionEvent } from "../src/index.js" ;
6-
74async function main ( ) {
85 const client = new CopilotClient ( ) ;
96 const session = await client . createSession ( {
Original file line number Diff line number Diff line change @@ -308,10 +308,11 @@ export class CopilotClient {
308308 this . onListModels = options . onListModels ;
309309 this . onGetTraceContext = options . onGetTraceContext ;
310310
311+ const effectiveEnv = options . env ?? process . env ;
311312 this . options = {
312313 cliPath : options . cliUrl
313314 ? undefined
314- : options . cliPath || process . env . COPILOT_CLI_PATH || getBundledCliPath ( ) ,
315+ : options . cliPath || effectiveEnv . COPILOT_CLI_PATH || getBundledCliPath ( ) ,
315316 cliArgs : options . cliArgs ?? [ ] ,
316317 cwd : options . cwd ?? process . cwd ( ) ,
317318 port : options . port || 0 ,
@@ -322,7 +323,7 @@ export class CopilotClient {
322323 autoStart : options . autoStart ?? true ,
323324 autoRestart : false ,
324325
325- env : options . env ?? process . env ,
326+ env : effectiveEnv ,
326327 githubToken : options . githubToken ,
327328 // Default useLoggedInUser to false when githubToken is provided, otherwise true
328329 useLoggedInUser : options . useLoggedInUser ?? ( options . githubToken ? false : true ) ,
You can’t perform that action at this time.
0 commit comments