Skip to content

Commit 7c2896a

Browse files
committed
feat: Allow providing GitHub token via command line argument
1 parent 121e624 commit 7c2896a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/main.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface RunServerOptions {
1919
manual: boolean
2020
rateLimit: number | undefined
2121
rateLimitWait: boolean
22+
githubToken?: string
2223
}
2324

2425
export async function runServer(options: RunServerOptions): Promise<void> {
@@ -38,7 +39,14 @@ export async function runServer(options: RunServerOptions): Promise<void> {
3839

3940
await ensurePaths()
4041
await cacheVSCodeVersion()
41-
await setupGitHubToken()
42+
43+
if (options.githubToken) {
44+
state.githubToken = options.githubToken
45+
consola.info("Using provided GitHub token")
46+
} else {
47+
await setupGitHubToken()
48+
}
49+
4250
await setupCopilotToken()
4351
await cacheModels()
4452

@@ -93,6 +101,12 @@ const main = defineCommand({
93101
description:
94102
"Wait instead of error when rate limit is hit. Has no effect if rate limit is not set",
95103
},
104+
"github-token": {
105+
alias: "g",
106+
type: "string",
107+
description:
108+
"Provide GitHub token directly instead of using stored token",
109+
},
96110
},
97111
run({ args }) {
98112
const rateLimitRaw = args["rate-limit"]
@@ -109,6 +123,7 @@ const main = defineCommand({
109123
manual: args.manual,
110124
rateLimit,
111125
rateLimitWait: Boolean(args.wait),
126+
githubToken: args["github-token"],
112127
})
113128
},
114129
})

0 commit comments

Comments
 (0)