Skip to content

Commit 6738fa4

Browse files
committed
merged index
1 parent 4a1084a commit 6738fa4

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

packages/cli/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
44
import * as NodeServices from "@effect/platform-node/NodeServices"
55
import * as Effect from "effect/Effect"
6+
import { InstallationVersion } from "@opencode-ai/core/installation/version"
67
import { Commands } from "./commands/commands"
78
import { Runtime } from "./framework/runtime"
89
import { Daemon } from "./services/daemon"

packages/script/src/index.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,11 @@ const IS_PREVIEW = CHANNEL !== "latest"
3333

3434
const 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

5043
const bot = ["actions-user", "opencode", "opencode-agent[bot]"]

0 commit comments

Comments
 (0)