From f3c2d1b6c23f50aae9e60a61f283ac9eaf5bccb6 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Sun, 5 Oct 2025 07:00:29 -0400 Subject: 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 --- script/publish.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'script') diff --git a/script/publish.ts b/script/publish.ts index 142981171..6d162d66f 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -1,12 +1,12 @@ #!/usr/bin/env bun import { $ } from "bun" -import { createOpencodeClient, createOpencodeServer } from "@opencode-ai/sdk" +import { createOpencode } from "@opencode-ai/sdk" if (process.versions.bun !== "1.2.21") { throw new Error("This script requires bun@1.2.21") } -let notes = [] +const notes = [] as string[] console.log("=== publishing ===\n") @@ -35,11 +35,10 @@ if (!snapshot) { }) .then((data) => data.tag_name) - const server = await createOpencodeServer() - const client = createOpencodeClient({ baseUrl: server.url }) - const session = await client.session.create() + const opencode = await createOpencode() + const session = await opencode.client.session.create() console.log("generating changelog since " + previous) - const raw = await client.session + const raw = await opencode.client.session .prompt({ path: { id: session.data!.id, @@ -85,7 +84,7 @@ if (!snapshot) { } } console.log(notes) - server.close() + opencode.server.close() } const pkgjsons = await Array.fromAsync( -- cgit v1.2.3