mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 06:45:22 +00:00
refactor(file): effectify FileService as scoped service
Convert File namespace functions (init, status, read, list, search) to FileService class extending ServiceMap.Service with Effect.fn methods. File cache uses lazy initialization via init() matching original Instance.state semantics. Legacy promise facade preserved.
This commit is contained in:
@@ -8,6 +8,7 @@ import { FileWatcherService } from "@/file/watcher"
|
||||
import { VcsService } from "@/project/vcs"
|
||||
import { FileTimeService } from "@/file/time"
|
||||
import { FormatService } from "@/format"
|
||||
import { FileService } from "@/file"
|
||||
import { Instance } from "@/project/instance"
|
||||
|
||||
export { InstanceContext } from "./instance-context"
|
||||
@@ -20,6 +21,7 @@ export type InstanceServices =
|
||||
| VcsService
|
||||
| FileTimeService
|
||||
| FormatService
|
||||
| FileService
|
||||
|
||||
function lookup(directory: string) {
|
||||
const project = Instance.project
|
||||
@@ -32,6 +34,7 @@ function lookup(directory: string) {
|
||||
Layer.fresh(VcsService.layer),
|
||||
Layer.fresh(FileTimeService.layer).pipe(Layer.orDie),
|
||||
Layer.fresh(FormatService.layer),
|
||||
Layer.fresh(FileService.layer),
|
||||
).pipe(Layer.provide(ctx))
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user