File tree Expand file tree Collapse file tree 3 files changed +21
-10
lines changed
Expand file tree Collapse file tree 3 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,8 @@ export async function runAuth(options: RunAuthOptions): Promise<void> {
1616 consola . info ( "Verbose logging enabled" )
1717 }
1818
19- await setupGitHubToken ( )
19+ await setupGitHubToken ( { force : true } )
2020 consola . success ( "GitHub token written to" , PATHS . GITHUB_TOKEN_PATH )
21-
22- process . exit ( 0 )
2321}
2422
2523export const auth = defineCommand ( {
Original file line number Diff line number Diff line change @@ -33,11 +33,17 @@ export const setupCopilotToken = async () => {
3333 } , refreshInterval )
3434}
3535
36- export async function setupGitHubToken ( ) : Promise < void > {
36+ interface SetupGitHubTokenOptions {
37+ force ?: boolean
38+ }
39+
40+ export async function setupGitHubToken (
41+ options ?: SetupGitHubTokenOptions ,
42+ ) : Promise < void > {
3743 try {
3844 const githubToken = await readGithubToken ( )
3945
40- if ( githubToken ) {
46+ if ( githubToken && ! options ?. force ) {
4147 state . githubToken = githubToken
4248 await logUser ( )
4349
Original file line number Diff line number Diff line change @@ -59,13 +59,11 @@ export async function runServer(options: RunServerOptions): Promise<void> {
5959 } )
6060}
6161
62- const main = defineCommand ( {
62+ const start = defineCommand ( {
6363 meta : {
64- name : "copilot-api" ,
65- description :
66- "A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools." ,
64+ name : "start" ,
65+ description : "Start the Copilot API server" ,
6766 } ,
68- subCommands : { auth } ,
6967 args : {
7068 port : {
7169 alias : "p" ,
@@ -128,4 +126,13 @@ const main = defineCommand({
128126 } ,
129127} )
130128
129+ const main = defineCommand ( {
130+ meta : {
131+ name : "copilot-api" ,
132+ description :
133+ "A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools." ,
134+ } ,
135+ subCommands : { auth, start } ,
136+ } )
137+
131138await runMain ( main )
You can’t perform that action at this time.
0 commit comments