summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKit Langton <[email protected]>2026-04-30 21:44:52 -0400
committerGitHub <[email protected]>2026-04-30 21:44:52 -0400
commitce3b0988c416d4505309dbad7e23e9439645aafa (patch)
tree9040dcf18976cc0ed407d63cd3c363ed296df8bc
parente8a194a2bb39515546b0340151d1a1631e537bff (diff)
downloadopencode-ce3b0988c416d4505309dbad7e23e9439645aafa.tar.gz
opencode-ce3b0988c416d4505309dbad7e23e9439645aafa.zip
refactor(project): yield instance context in bootstrap (#25204)
-rw-r--r--packages/opencode/src/project/bootstrap.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/opencode/src/project/bootstrap.ts b/packages/opencode/src/project/bootstrap.ts
index 2ea07bb8d..ae52ac550 100644
--- a/packages/opencode/src/project/bootstrap.ts
+++ b/packages/opencode/src/project/bootstrap.ts
@@ -7,7 +7,7 @@ import * as Project from "./project"
import * as Vcs from "./vcs"
import { Bus } from "../bus"
import { Command } from "../command"
-import { Instance } from "./instance"
+import { InstanceState } from "@/effect/instance-state"
import * as Log from "@opencode-ai/core/util/log"
import { FileWatcher } from "@/file/watcher"
import { ShareNext } from "@/share/share-next"
@@ -15,7 +15,8 @@ import * as Effect from "effect/Effect"
import { Config } from "@/config/config"
export const InstanceBootstrap = Effect.gen(function* () {
- Log.Default.info("bootstrapping", { directory: Instance.directory })
+ const ctx = yield* InstanceState.context
+ Log.Default.info("bootstrapping", { directory: ctx.directory })
// everything depends on config so eager load it for nice traces
yield* Config.Service.use((svc) => svc.get())
// Plugin can mutate config so it has to be initialized before anything else.
@@ -32,10 +33,11 @@ export const InstanceBootstrap = Effect.gen(function* () {
].map((s) => Effect.forkDetach(s.use((i) => i.init()))),
).pipe(Effect.withSpan("InstanceBootstrap.init"))
+ const projectID = ctx.project.id
yield* Bus.Service.use((svc) =>
svc.subscribeCallback(Command.Event.Executed, async (payload) => {
if (payload.properties.name === Command.Default.INIT) {
- Project.setInitialized(Instance.project.id)
+ Project.setInitialized(projectID)
}
}),
)