mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 17:00:59 +00:00
fix(coding-agent): remove install method cache
This commit is contained in:
parent
4137ed787b
commit
494a7750ef
2 changed files with 13 additions and 24 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue