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

11 lines
294 B
TypeScript
Raw Normal View History

import { InstanceRuntime } from "../project/instance-runtime"
2025-06-27 15:29:20 +00:00
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)
}
2025-06-27 15:29:20 +00:00
}