From cc115e23da5810c574d7419d19e066ecf69f80ef Mon Sep 17 00:00:00 2001 From: Ariane Emory Date: Wed, 11 Mar 2026 06:14:45 -0400 Subject: [PATCH] fix: use short version for integration branches When building from an integration branch (integration/YYYY-MM-DD-HH-MM), automatically extract and use the timestamp from the branch name instead of generating a long preview version string. This allows users to build integration branches without explicitly setting OPENCODE_VERSION and still get a clean version display. --- packages/script/src/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/script/src/index.ts b/packages/script/src/index.ts index ee4bc1e4650..6016441cfda 100644 --- a/packages/script/src/index.ts +++ b/packages/script/src/index.ts @@ -32,7 +32,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)