Compare commits

...
Author SHA1 Message Date
Saoud Rizwan c2c3e48bdc fix(cli): version hub compatibility by cli release 2026-06-03 23:54:10 -07:00
3 changed files with 54 additions and 0 deletions
+4
View File
@@ -8,8 +8,12 @@ import {
cleanupActiveRuntime,
isAbortInProgress,
} from "./runtime/active-runtime";
import { configureCliHubCompatibility } from "./utils/hub-compatibility";
import { writeErr } from "./utils/output";
// Configure hub compatibility before any SDK hub discovery or daemon startup.
configureCliHubCompatibility();
// Initialize VCR before any HTTP requests are made.
// Set CLINE_VCR=record|playback and CLINE_VCR_CASSETTE=<path> to enable.
initVcr(process.env.CLINE_VCR);
@@ -0,0 +1,33 @@
import { describe, expect, it } from "vitest";
import { version } from "../../package.json";
import { configureCliHubCompatibility } from "./hub-compatibility";
describe("configureCliHubCompatibility", () => {
it("uses the CLI release version as the hub build id", () => {
const env: NodeJS.ProcessEnv = {};
configureCliHubCompatibility(env);
expect(env.CLINE_HUB_BUILD_ID).toBe(`cli:${version}`);
});
it("preserves an explicit hub build id override", () => {
const env: NodeJS.ProcessEnv = {
CLINE_HUB_BUILD_ID: "custom-build",
};
configureCliHubCompatibility(env);
expect(env.CLINE_HUB_BUILD_ID).toBe("custom-build");
});
it("replaces a blank hub build id override", () => {
const env: NodeJS.ProcessEnv = {
CLINE_HUB_BUILD_ID: " ",
};
configureCliHubCompatibility(env);
expect(env.CLINE_HUB_BUILD_ID).toBe(`cli:${version}`);
});
});
+17
View File
@@ -0,0 +1,17 @@
import { version } from "../../package.json";
const CLINE_HUB_BUILD_ID_ENV = "CLINE_HUB_BUILD_ID";
export function configureCliHubCompatibility(
env: NodeJS.ProcessEnv = process.env,
): void {
if (env[CLINE_HUB_BUILD_ID_ENV]?.trim()) {
return;
}
// The SDK defaults hub compatibility to @cline/core's version, but published
// CLI releases can change CLI-owned hub behavior while @cline/core stays on
// the same workspace package version. Stamp local hubs with the CLI release
// before any SDK hub code probes or spawns the daemon.
env[CLINE_HUB_BUILD_ID_ENV] = `cli:${version}`;
}