File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
44import * as NodeServices from "@effect/platform-node/NodeServices"
55import * as Effect from "effect/Effect"
6+ import { InstallationVersion } from "@opencode-ai/core/installation/version"
67import { Commands } from "./commands/commands"
78import { Runtime } from "./framework/runtime"
89import { Daemon } from "./services/daemon"
Original file line number Diff line number Diff line change @@ -33,18 +33,11 @@ const IS_PREVIEW = CHANNEL !== "latest"
3333
3434const VERSION = await ( async ( ) => {
3535 if ( env . OPENCODE_VERSION ) return env . OPENCODE_VERSION
36- if ( IS_PREVIEW ) return `0.0.0-${ CHANNEL } -${ new Date ( ) . toISOString ( ) . slice ( 0 , 16 ) . replace ( / [ - : T ] / g, "" ) } `
37- const version = await fetch ( "https://registry.npmjs.org/opencode-ai/latest" )
38- . then ( ( res ) => {
39- if ( ! res . ok ) throw new Error ( res . statusText )
40- return res . json ( )
41- } )
42- . then ( ( data : any ) => data . version )
43- const [ major , minor , patch ] = version . split ( "." ) . map ( ( x : string ) => Number ( x ) || 0 )
44- const t = env . OPENCODE_BUMP ?. toLowerCase ( )
45- if ( t === "major" ) return `${ major + 1 } .0.0`
46- if ( t === "minor" ) return `${ major } .${ minor + 1 } .0`
47- return `${ major } .${ minor } .${ patch + 1 } `
36+ const subPkgPath = path . resolve ( import . meta. dir , "../../opencode/package.json" )
37+ const subPkg = await Bun . file ( subPkgPath ) . json ( )
38+ const base : string = subPkg . version
39+ const hash = await $ `git rev-parse --short=7 HEAD` . text ( ) . then ( ( x ) => x . trim ( ) )
40+ return `${ base } +${ hash } `
4841} ) ( )
4942
5043const bot = [ "actions-user" , "opencode" , "opencode-agent[bot]" ]
You can’t perform that action at this time.
0 commit comments