From 494a7750efc90e7edbb1ba400536ff083ae52e61 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 3 Feb 2026 01:45:35 +0100 Subject: [PATCH] fix(coding-agent): remove install method cache --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/src/config.ts | 36 ++++++++++------------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index ab0b6611..6f37b13e 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added - Added ExtensionUIContext getToolsExpanded and setToolsExpanded for controlling tool output expansion ([#1199](https://github.com/badlogic/pi-mono/pull/1199) by [@academo](https://github.com/academo)) +- Added install method detection to show package manager specific update instructions ([#1203](https://github.com/badlogic/pi-mono/pull/1203) by [@Itsnotaka](https://github.com/Itsnotaka)) ### Fixed diff --git a/packages/coding-agent/src/config.ts b/packages/coding-agent/src/config.ts index 603e6d84..38fcc9f3 100644 --- a/packages/coding-agent/src/config.ts +++ b/packages/coding-agent/src/config.ts @@ -26,39 +26,27 @@ export const isBunRuntime = !!process.versions.bun; export type InstallMethod = "bun-binary" | "npm" | "pnpm" | "yarn" | "bun" | "unknown"; -let _cachedInstallMethod: InstallMethod | undefined; - export function detectInstallMethod(): InstallMethod { - if (_cachedInstallMethod) return _cachedInstallMethod; - if (isBunBinary) { - _cachedInstallMethod = "bun-binary"; - return _cachedInstallMethod; + return "bun-binary"; } const resolvedPath = `${__dirname}\0${process.execPath || ""}`.toLowerCase(); if (resolvedPath.includes("/pnpm/") || resolvedPath.includes("/.pnpm/") || resolvedPath.includes("\\pnpm\\")) { - _cachedInstallMethod = "pnpm"; - } else if ( - resolvedPath.includes("/yarn/") || - resolvedPath.includes("/.yarn/") || - resolvedPath.includes("\\yarn\\") - ) { - _cachedInstallMethod = "yarn"; - } else if (isBunRuntime) { - _cachedInstallMethod = "bun"; - } else if ( - resolvedPath.includes("/npm/") || - resolvedPath.includes("/node_modules/") || - resolvedPath.includes("\\npm\\") - ) { - _cachedInstallMethod = "npm"; - } else { - _cachedInstallMethod = "unknown"; + return "pnpm"; + } + if (resolvedPath.includes("/yarn/") || resolvedPath.includes("/.yarn/") || resolvedPath.includes("\\yarn\\")) { + return "yarn"; + } + if (isBunRuntime) { + return "bun"; + } + if (resolvedPath.includes("/npm/") || resolvedPath.includes("/node_modules/") || resolvedPath.includes("\\npm\\")) { + return "npm"; } - return _cachedInstallMethod; + return "unknown"; } export function getUpdateInstruction(packageName: string): string {