From 823a26ec81dfa3d0eac83281dea564895fb64cbc Mon Sep 17 00:00:00 2001 From: Omer Cohen <639682+omercnet@users.noreply.github.com> Date: Mon, 16 Nov 2026 09:27:13 +0000 Subject: [PATCH] fix(context-mode): replace the D1 host update command with plugin upgrade advice Context Mode 2.1.7 and later print the host's own update command as the D1 fix for an outdated runtime (for example claude plugin update or npm i -g context-mode && context-mode setup) instead of run ctx_upgrade, so the doctor passed native-install advice through for the bundled runtime. Match the D1 update-available row and give the runtime-specific advice again. --- context-mode/server/actions.ts | 6 +++++- context-mode/tests/actions.test.ts | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/context-mode/server/actions.ts b/context-mode/server/actions.ts index 542976ebc..17d77dbd5 100644 --- a/context-mode/server/actions.ts +++ b/context-mode/server/actions.ts @@ -42,6 +42,9 @@ const INFORMATIONAL_CHECK = /^D(3|5b?)\b/; /** Upstream's fix for an outdated runtime; the plugin offers no in-place upgrade. */ const UPGRADE_FIX = "run ctx_upgrade"; +/** D1's detail on an outdated runtime; since 2.1.7 its fix is the host's update command. */ +const UPDATE_AVAILABLE = "update available"; + const UPGRADE_ADVICE: Readonly> = { bundled: "Update the Context Mode plugin in Paseo", settings: "Upgrade the Context Mode install configured in settings", @@ -58,7 +61,8 @@ function doctorRow( if (INFORMATIONAL_CHECK.test(check)) { return { ...row, status: status === "ok" ? "ok" : "warning" }; } - if (upstreamFix === UPGRADE_FIX) { + const outdated = /^D1\b/.test(check) && detail.includes(UPDATE_AVAILABLE); + if (outdated || upstreamFix === UPGRADE_FIX) { // A bundled runtime that trails npm is expected until the next plugin release. const upgradeStatus = runtime === "bundled" ? "warning" : status; return { ...row, status: upgradeStatus, fix: UPGRADE_ADVICE[runtime] }; diff --git a/context-mode/tests/actions.test.ts b/context-mode/tests/actions.test.ts index 2b12f769c..7a7e02ae9 100644 --- a/context-mode/tests/actions.test.ts +++ b/context-mode/tests/actions.test.ts @@ -96,6 +96,24 @@ describe("structured actions", () => { }); }); + test("replaces the host update command that 2.1.7 and later print for an outdated runtime", () => { + // Rows as Context Mode 2.1.10 prints them for Claude Code and Copilot. + const outdated = [ + "| D1 version | WARN | 2.1.10 (877eebc): update available, latest on npm is 2.2.0 | Fix: claude plugin marketplace update context-mode && claude plugin update context-mode@context-mode |", + "| D1 version | WARN | 2.1.10 (877eebc): update available, latest on npm is 2.2.0 | Fix: npm i -g context-mode && context-mode setup --agents copilot-cli |", + ].join("\n"); + const detail = "2.1.10 (877eebc): update available, latest on npm is 2.2.0"; + const row = { status: "warning", check: "D1 version", detail }; + expect(parseContextModeDoctorOutput(outdated, "bundled")).toEqual([ + { ...row, fix: "Update the Context Mode plugin in Paseo" }, + { ...row, fix: "Update the Context Mode plugin in Paseo" }, + ]); + expect(parseContextModeDoctorOutput(outdated, "settings")[1]).toEqual({ + ...row, + fix: "Upgrade the Context Mode install configured in settings", + }); + }); + test("runs ctx_doctor against the plugin-owned probe store", async () => { const handlers = createContextModeActionHandlers(settingsHandle(), { resolveBinary: async () => ({