Skip to content

Commit b1db69f

Browse files
committed
fix other commands
1 parent 031766e commit b1db69f

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

packages/opencode/src/cli/cmd/serve.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Server } from "../../server/server"
22
import { cmd } from "./cmd"
33
import { withNetworkOptions, resolveNetworkOptions } from "../network"
44
import { Flag } from "../../flag/flag"
5+
import { bootstrap } from "../bootstrap"
56

67
export 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

packages/opencode/src/cli/cmd/web.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { withNetworkOptions, resolveNetworkOptions } from "../network"
55
import { Flag } from "../../flag/flag"
66
import open from "open"
77
import { networkInterfaces } from "os"
8+
import { bootstrap } from "../bootstrap"
89

910
function 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(" "))

packages/opencode/src/project/bootstrap.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,29 @@ import * as Vcs from "./vcs"
77
import { Bus } from "../bus"
88
import { Command } from "../command"
99
import { Instance } from "./instance"
10+
import { Plugin } from "../plugin"
1011
import { Log } from "@/util"
1112
import { FileWatcher } from "@/file/watcher"
1213
import { ShareNext } from "@/share"
1314
import * as Effect from "effect/Effect"
15+
import { Config } from "@/config"
1416

1517
export 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) =>

0 commit comments

Comments
 (0)