11#!/usr/bin/env bun
22
33import { $ } from "bun"
4- import { createOpencode } from "@opencode-ai/sdk"
4+ import { createOpencode } from "@opencode-ai/sdk/v2 "
55import { parseArgs } from "util"
66
77export const team = [
@@ -153,9 +153,9 @@ async function summarizeCommit(opencode: Awaited<ReturnType<typeof createOpencod
153153 console . log ( "summarizing commit:" , message )
154154 const session = await opencode . client . session . create ( )
155155 const result = await opencode . client . session
156- . prompt ( {
157- path : { id : session . data ! . id } ,
158- body : {
156+ . prompt (
157+ {
158+ sessionID : session . data ! . id ,
159159 model : { providerID : "opencode" , modelID : "claude-sonnet-4-5" } ,
160160 tools : {
161161 "*" : false ,
@@ -169,8 +169,10 @@ Commit: ${message}`,
169169 } ,
170170 ] ,
171171 } ,
172- signal : AbortSignal . timeout ( 120_000 ) ,
173- } )
172+ {
173+ signal : AbortSignal . timeout ( 120_000 ) ,
174+ } ,
175+ )
174176 . then ( ( x ) => x . data ?. parts ?. find ( ( y ) => y . type === "text" ) ?. text ?? message )
175177 return result . trim ( )
176178}
@@ -238,7 +240,7 @@ export async function buildNotes(from: string, to: string) {
238240
239241 console . log ( "generating changelog since " + from )
240242
241- const opencode = await createOpencode ( { port : 5044 } )
243+ const opencode = await createOpencode ( { port : 0 } )
242244 const notes : string [ ] = [ ]
243245
244246 try {
@@ -258,8 +260,9 @@ export async function buildNotes(from: string, to: string) {
258260 throw error
259261 }
260262 } finally {
261- opencode . server . close ( )
263+ await opencode . server . close ( )
262264 }
265+ console . log ( "changelog generation complete" )
263266
264267 const contributors = await getContributors ( from , to )
265268
0 commit comments