From dcbb107ee28ef26f1bc726d8e885d58797e6efa5 Mon Sep 17 00:00:00 2001 From: marius-kilocode Date: Mon, 13 Jul 2026 12:47:39 +0200 Subject: [PATCH] fix(cli): use public npm registry for curl fallback, fix tests and changeset --- .changeset/fix-upgrade-curl-version.md | 2 +- packages/opencode/src/installation/index.ts | 14 ++++++----- .../test/installation/installation.test.ts | 24 ++++++++++++------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.changeset/fix-upgrade-curl-version.md b/.changeset/fix-upgrade-curl-version.md index 0b2cebb2b5..7b6b7c641f 100644 --- a/.changeset/fix-upgrade-curl-version.md +++ b/.changeset/fix-upgrade-curl-version.md @@ -1,5 +1,5 @@ --- -" @kilocode/cli": patch +"@kilocode/cli": patch --- Fix `kilo upgrade` for curl installs resolving the wrong latest version diff --git a/packages/opencode/src/installation/index.ts b/packages/opencode/src/installation/index.ts index a2f3ac47bd..0568ffb18e 100644 --- a/packages/opencode/src/installation/index.ts +++ b/packages/opencode/src/installation/index.ts @@ -308,13 +308,15 @@ export const layer: Layer.Layer { describe("latest", () => { - testEffect(testLayer(() => jsonResponse({ tag_name: "v1.2.3" }))).effect( - "reads release version from GitHub releases", - () => - Effect.gen(function* () { - const result = yield* Installation.use.latest("unknown") - expect(result).toBe("1.2.3") - }), + // kilocode_change start - curl/unknown fallback now resolves from the public npm + // registry instead of GitHub /releases/latest (which is polluted by JetBrains releases) + const curlCalls: string[] = [] + testEffect( + testLayer((request) => { + curlCalls.push(request.url) + return jsonResponse({ version: "1.2.3" }) + }), + ).effect("reads release version from GitHub releases", () => + Effect.gen(function* () { + const result = yield* Installation.use.latest("unknown") + expect(result).toBe("1.2.3") + expect(curlCalls).toContain("https://registry.npmjs.org/@kilocode%2fcli/local") + }), ) - testEffect(testLayer(() => jsonResponse({ tag_name: "v4.0.0-beta.1" }))).effect( + testEffect(testLayer(() => jsonResponse({ version: "4.0.0-beta.1" }))).effect( "strips v prefix from GitHub release tag", () => Effect.gen(function* () { @@ -75,6 +82,7 @@ describe("installation", () => { expect(result).toBe("4.0.0-beta.1") }), ) + // kilocode_change end const npmCalls: string[] = [] testEffect(