Skip to content

Commit 16a121c

Browse files
Cleanup
1 parent c839f0a commit 16a121c

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

nodejs/samples/chat.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1+
import { CopilotClient, approveAll, type SessionEvent } from "@github/copilot-sdk";
12
import * 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-
74
async function main() {
85
const client = new CopilotClient();
96
const session = await client.createSession({

nodejs/src/client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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),

0 commit comments

Comments
 (0)