Files
ClosedCode/packages/opencode/src/cli/bootstrap.ts
T
2025-08-31 02:16:43 -04:00

20 lines
532 B
TypeScript

import { Format } from "../format"
import { LSP } from "../lsp"
import { Plugin } from "../plugin"
import { Instance } from "../project/instance"
import { Share } from "../share/share"
import { Snapshot } from "../snapshot"
export async function bootstrap<T>(directory: string, cb: () => Promise<T>) {
return Instance.provide(directory, async () => {
await Plugin.init()
Share.init()
Format.init()
LSP.init()
Snapshot.init()
const result = await cb()
await Instance.dispose()
return result
})
}