cloudaxe-opencode/packages/opencode/src/cli/bootstrap.ts

10 lines
294 B
TypeScript

import { InstanceRuntime } from "../project/instance-runtime"
export async function bootstrap<T>(directory: string, cb: () => Promise<T>) {
const ctx = await InstanceRuntime.load({ directory })
try {
return await cb()
} finally {
await InstanceRuntime.disposeInstance(ctx)
}
}