sdk: simplify getting started with single createOpencode function

Makes it easier for developers to get started by providing a single function that creates both server and client, removing the need to manually coordinate separate server and client creation
This commit is contained in:
Dax Raad
2025-10-05 07:00:29 -04:00
parent 71a7e8ef36
commit f3c2d1b6c2
3 changed files with 47 additions and 34 deletions

View File

@@ -1,2 +1,20 @@
export * from "./client.js"
export * from "./server.js"
import { createOpencodeClient } from "./client.js"
import { createOpencodeServer, ServerOptions } from "./server.js"
export async function createOpencode(options?: ServerOptions) {
const server = await createOpencodeServer({
...options,
})
const client = createOpencodeClient({
baseUrl: server.url,
})
return {
client,
server,
}
}