File tree Expand file tree Collapse file tree 3 files changed +19
-10
lines changed
Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { Server } from "../../server/server"
22import { cmd } from "./cmd"
33import { withNetworkOptions , resolveNetworkOptions } from "../network"
44import { Flag } from "../../flag/flag"
5+ import { bootstrap } from "../bootstrap"
56
67export const ServeCommand = cmd ( {
78 command : "serve" ,
@@ -11,7 +12,8 @@ export const ServeCommand = cmd({
1112 if ( ! Flag . OPENCODE_SERVER_PASSWORD ) {
1213 console . log ( "Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured." )
1314 }
14- const opts = await resolveNetworkOptions ( args )
15+
16+ const opts = await bootstrap ( process . cwd ( ) , ( ) => resolveNetworkOptions ( args ) )
1517 const server = await Server . listen ( opts )
1618 console . log ( `opencode server listening on http://${ server . hostname } :${ server . port } ` )
1719
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { withNetworkOptions, resolveNetworkOptions } from "../network"
55import { Flag } from "../../flag/flag"
66import open from "open"
77import { networkInterfaces } from "os"
8+ import { bootstrap } from "../bootstrap"
89
910function getNetworkIPs ( ) {
1011 const nets = networkInterfaces ( )
@@ -36,7 +37,7 @@ export const WebCommand = cmd({
3637 if ( ! Flag . OPENCODE_SERVER_PASSWORD ) {
3738 UI . println ( UI . Style . TEXT_WARNING_BOLD + "! OPENCODE_SERVER_PASSWORD is not set; server is unsecured." )
3839 }
39- const opts = await resolveNetworkOptions ( args )
40+ const opts = await bootstrap ( process . cwd ( ) , ( ) => resolveNetworkOptions ( args ) )
4041 const server = await Server . listen ( opts )
4142 UI . empty ( )
4243 UI . println ( UI . logo ( " " ) )
Original file line number Diff line number Diff line change @@ -7,23 +7,29 @@ import * as Vcs from "./vcs"
77import { Bus } from "../bus"
88import { Command } from "../command"
99import { Instance } from "./instance"
10+ import { Plugin } from "../plugin"
1011import { Log } from "@/util"
1112import { FileWatcher } from "@/file/watcher"
1213import { ShareNext } from "@/share"
1314import * as Effect from "effect/Effect"
15+ import { Config } from "@/config"
1416
1517export const InstanceBootstrap = Effect . gen ( function * ( ) {
1618 Log . Default . info ( "bootstrapping" , { directory : Instance . directory } )
1719 yield * Effect . all (
1820 [
19- LSP . Service ,
20- ShareNext . Service ,
21- Format . Service ,
22- File . Service ,
23- FileWatcher . Service ,
24- Vcs . Service ,
25- Snapshot . Service ,
26- ] . map ( ( s ) => Effect . forkDetach ( s . use ( ( i ) => i . init ( ) ) ) ) ,
21+ Config . Service . use ( ( i ) => i . get ( ) ) ,
22+ ...[
23+ Plugin . Service ,
24+ LSP . Service ,
25+ ShareNext . Service ,
26+ Format . Service ,
27+ File . Service ,
28+ FileWatcher . Service ,
29+ Vcs . Service ,
30+ Snapshot . Service ,
31+ ] . map ( ( s ) => s . use ( ( i ) => i . init ( ) ) ) ,
32+ ] . map ( ( e ) => Effect . forkDetach ( e ) ) ,
2733 ) . pipe ( Effect . withSpan ( "InstanceBootstrap.init" ) )
2834
2935 yield * Bus . Service . use ( ( svc ) =>
You can’t perform that action at this time.
0 commit comments