File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { FetchError } from "ofetch"
55import { ENV } from "~/config/env"
66import { getGitHubUser } from "~/services/github/get-user/service"
77
8+ import type { parseCli } from "./cli"
9+
810import { PATHS } from "../config/paths"
911import { TOKENS } from "../config/tokens"
1012import { getModels } from "../services/copilot/get-models/service"
@@ -103,6 +105,18 @@ async function logUser() {
103105 consola . info ( `Logged in as ${ JSON . stringify ( user . login ) } ` )
104106}
105107
108+ export async function initializeApp (
109+ options : Awaited < ReturnType < typeof parseCli > > ,
110+ ) {
111+ ENV . EMULATE_STREAMING = options [ "emulate-streaming" ]
112+
113+ await initialize ( )
114+
115+ return {
116+ port : parseInt ( options . port , 10 ) ,
117+ }
118+ }
119+
106120export async function initialize ( ) {
107121 for ( const step of initSteps ) {
108122 try {
Original file line number Diff line number Diff line change 11import type { Serve } from "bun"
22
3- import { ENV } from "./config/env"
43import { parseCli } from "./lib/cli"
5- import { initialize } from "./lib/initialization"
4+ import { initializeApp } from "./lib/initialization"
65import { server } from "./server"
76
87const options = await parseCli ( )
9- ENV . EMULATE_STREAMING = options [ "emulate-streaming" ]
108
11- await initialize ( )
9+ const { port } = await initializeApp ( options )
1210
1311export default {
1412 fetch : server . fetch ,
15- port : parseInt ( options . port , 10 ) ,
13+ port,
1614} satisfies Serve
You can’t perform that action at this time.
0 commit comments