Skip to content

Commit 8616a7e

Browse files
anandgupta42claude
andauthored
fix: define ALTIMATE_CLI build-time constants for correct version reporting (#41)
* fix: define ALTIMATE_CLI_VERSION, CHANNEL, and ENGINE_VERSION at build time The build script defined OPENCODE_VERSION and OPENCODE_CHANNEL but never defined their ALTIMATE_CLI_* counterparts. Since the runtime code checks `typeof ALTIMATE_CLI_VERSION === "string"`, the check always failed and fell back to "local" — causing --version and telemetry to report "cli_version":"local" instead of the actual version. Add the three missing build-time defines: - ALTIMATE_CLI_VERSION: from Script.version (same as OPENCODE_VERSION) - ALTIMATE_CLI_CHANNEL: from Script.channel (same as OPENCODE_CHANNEL) - ALTIMATE_ENGINE_VERSION: read from altimate-engine/pyproject.toml This fixes version reporting in: - `altimate --version` output - Telemetry cli_version property - Telemetry ai.application.ver tag - Engine manifest.json cli_version field - Upgrade telemetry from_version field Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove unused OPENCODE_* build defines Remove OPENCODE_VERSION, OPENCODE_CHANNEL, OPENCODE_WORKER_PATH, and OPENCODE_LIBC — none are referenced anywhere in the source code. These were upstream OpenCode leftovers superseded by ALTIMATE_CLI_* constants. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1cd945e commit 8616a7e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

packages/altimate-code/script/build.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ process.chdir(dir)
1515
import { Script } from "@altimateai/altimate-code-script"
1616
import pkg from "../package.json"
1717

18+
// Read engine version from pyproject.toml
19+
const enginePyprojectPath = path.resolve(dir, "../altimate-engine/pyproject.toml")
20+
const enginePyproject = await Bun.file(enginePyprojectPath).text()
21+
const engineVersionMatch = enginePyproject.match(/^version\s*=\s*"([^"]+)"/m)
22+
if (!engineVersionMatch) {
23+
throw new Error("Could not read engine version from altimate-engine/pyproject.toml")
24+
}
25+
const engineVersion = engineVersionMatch[1]
26+
console.log(`Engine version: ${engineVersion}`)
27+
1828
const modelsUrl = process.env.OPENCODE_MODELS_URL || "https://models.dev"
1929
// Fetch and generate models.dev snapshot
2030
const modelsData = process.env.MODELS_DEV_API_JSON
@@ -186,12 +196,11 @@ for (const item of targets) {
186196
},
187197
entrypoints: ["./src/index.ts", parserWorker, workerPath],
188198
define: {
189-
OPENCODE_VERSION: `'${Script.version}'`,
199+
ALTIMATE_CLI_VERSION: `'${Script.version}'`,
200+
ALTIMATE_CLI_CHANNEL: `'${Script.channel}'`,
201+
ALTIMATE_ENGINE_VERSION: `'${engineVersion}'`,
190202
ALTIMATE_CLI_MIGRATIONS: JSON.stringify(migrations),
191203
OTUI_TREE_SITTER_WORKER_PATH: bunfsRoot + workerRelativePath,
192-
OPENCODE_WORKER_PATH: workerPath,
193-
OPENCODE_CHANNEL: `'${Script.channel}'`,
194-
OPENCODE_LIBC: item.os === "linux" ? `'${item.abi ?? "glibc"}'` : "",
195204
},
196205
})
197206

0 commit comments

Comments
 (0)