Skip to content

Commit d4ce66e

Browse files
committed
refactor(file): remove FileWatcher runtime facade
1 parent ccb0b32 commit d4ce66e

3 files changed

Lines changed: 5 additions & 10 deletions

File tree

packages/opencode/src/file/watcher.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import z from "zod"
88
import { Bus } from "@/bus"
99
import { BusEvent } from "@/bus/bus-event"
1010
import { InstanceState } from "@/effect/instance-state"
11-
import { makeRuntime } from "@/effect/run-service"
1211
import { Flag } from "@/flag/flag"
1312
import { Git } from "@/git"
1413
import { Instance } from "@/project/instance"
@@ -161,10 +160,4 @@ export namespace FileWatcher {
161160
)
162161

163162
export const defaultLayer = layer.pipe(Layer.provide(Config.defaultLayer), Layer.provide(Git.defaultLayer))
164-
165-
const { runPromise } = makeRuntime(Service, defaultLayer)
166-
167-
export function init() {
168-
return runPromise((svc) => svc.init())
169-
}
170163
}

packages/opencode/src/project/bootstrap.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import { Plugin } from "../plugin"
22
import { Format } from "../format"
33
import { LSP } from "../lsp"
44
import { File } from "../file"
5-
import { FileWatcher } from "../file/watcher"
65
import { Snapshot } from "../snapshot"
76
import { Project } from "./project"
87
import { Vcs } from "./vcs"
98
import { Bus } from "../bus"
109
import { Command } from "../command"
1110
import { Instance } from "./instance"
1211
import { Log } from "@/util/log"
12+
import { AppRuntime } from "@/effect/app-runtime"
1313
import { BootstrapRuntime } from "@/effect/bootstrap-runtime"
14+
import { FileWatcher } from "@/file/watcher"
1415
import { ShareNext } from "@/share/share-next"
1516

1617
export async function InstanceBootstrap() {
@@ -20,7 +21,7 @@ export async function InstanceBootstrap() {
2021
void BootstrapRuntime.runPromise(Format.Service.use((svc) => svc.init()))
2122
await LSP.init()
2223
File.init()
23-
FileWatcher.init()
24+
void AppRuntime.runPromise(FileWatcher.Service.use((svc) => svc.init()))
2425
Vcs.init()
2526
Snapshot.init()
2627

packages/opencode/test/project/vcs.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { afterEach, describe, expect, test } from "bun:test"
33
import fs from "fs/promises"
44
import path from "path"
55
import { tmpdir } from "../fixture/fixture"
6+
import { AppRuntime } from "../../src/effect/app-runtime"
67
import { FileWatcher } from "../../src/file/watcher"
78
import { Instance } from "../../src/project/instance"
89
import { GlobalBus } from "../../src/bus/global"
@@ -19,7 +20,7 @@ async function withVcs(directory: string, body: () => Promise<void>) {
1920
return Instance.provide({
2021
directory,
2122
fn: async () => {
22-
FileWatcher.init()
23+
void AppRuntime.runPromise(FileWatcher.Service.use((svc) => svc.init()))
2324
Vcs.init()
2425
await Bun.sleep(500)
2526
await body()

0 commit comments

Comments
 (0)