Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
cc115e2
fix: use short version for integration branches
ariane-emory Mar 11, 2026
c5732b3
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Mar 13, 2026
c837884
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Mar 20, 2026
496aba1
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Mar 20, 2026
97ac75e
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Mar 24, 2026
d852eb7
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Mar 24, 2026
86281d1
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Mar 24, 2026
ed56224
test: add regression tests for integration branch short version format
ariane-emory Mar 24, 2026
1cebc3b
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Apr 3, 2026
fbbab55
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Apr 12, 2026
ccb963d
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Apr 17, 2026
86ba3c6
Merge branch 'dev' into fix/build-with-short-version
ariane-emory Apr 24, 2026
2dc04e3
Merge branch 'dev' into fix/build-with-short-version
ariane-emory May 4, 2026
940e716
Merge branch 'dev' into fix/build-with-short-version
ariane-emory May 11, 2026
cc52e8c
Merge branch 'dev' into fix/build-with-short-version
ariane-emory May 11, 2026
843691a
Merge branch 'dev' into fix/build-with-short-version
ariane-emory May 11, 2026
c901870
Merge branch 'dev' into fix/build-with-short-version
ariane-emory May 11, 2026
8c1b189
Merge branch 'dev' into fix/build-with-short-version
ariane-emory May 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/opencode/test/script/version.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { describe, expect, test } from "bun:test"
import { readFileSync } from "fs"
import { join } from "path"

describe("build script version format", () => {
const scriptPath = join(
__dirname,
"../../../script/src/index.ts",
)

test("script must contain integration branch regex pattern", () => {
const content = readFileSync(scriptPath, "utf-8")
expect(content).toContain('/^integration\\/(\\d{4}-\\d{2}-\\d{2}-\\d{2}-\\d{2})$/')
})

test("script must check for integration match and return short version", () => {
const content = readFileSync(scriptPath, "utf-8")
expect(content).toContain('const integrationMatch = CHANNEL.match')
expect(content).toContain('if (integrationMatch)')
expect(content).toContain('return integrationMatch[1]')
})

test("script must fall back to old preview format for non-integration branches", () => {
const content = readFileSync(scriptPath, "utf-8")
expect(content).toContain('0.0.0-${CHANNEL}')
})
})
10 changes: 9 additions & 1 deletion packages/script/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ const IS_PREVIEW = CHANNEL !== "latest"

const VERSION = await (async () => {
if (env.OPENCODE_VERSION) return env.OPENCODE_VERSION
if (IS_PREVIEW) return `0.0.0-${CHANNEL}-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
if (IS_PREVIEW) {
// Check if we're on an integration branch and extract the timestamp
const integrationMatch = CHANNEL.match(/^integration\/(\d{4}-\d{2}-\d{2}-\d{2}-\d{2})$/)
if (integrationMatch) {
return integrationMatch[1] // Return just the timestamp (e.g., "2026-03-08-21-02")
}
// Otherwise use the old preview format for other branches
return `0.0.0-${CHANNEL}-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
}
const version = await fetch("https://registry.npmjs.org/opencode-ai/latest")
.then((res) => {
if (!res.ok) throw new Error(res.statusText)
Expand Down