fix: show bun install instead of npm install in update notification when running under Bun (#714)

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
This commit is contained in:
Danila Poyarkov 2026-01-14 12:23:49 +03:00 committed by GitHub
parent 0c135d0141
commit 5279bb92da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

View file

@ -2,6 +2,9 @@
## [Unreleased]
### Fixed
- Show `bun install` instead of `npm install` in update notification when running under Bun
### Added
- Edit tool now uses fuzzy matching as fallback when exact match fails, tolerating trailing whitespace, smart quotes, Unicode dashes, and special spaces

View file

@ -17,6 +17,9 @@ const __dirname = dirname(__filename);
export const isBunBinary =
import.meta.url.includes("$bunfs") || import.meta.url.includes("~BUN") || import.meta.url.includes("%7EBUN");
/** Detect if Bun is the runtime (compiled binary or bun run) */
export const isBunRuntime = !!process.versions.bun;
// =============================================================================
// Package Asset Paths (shipped with executable)
// =============================================================================

View file

@ -42,7 +42,7 @@ import {
visibleWidth,
} from "@mariozechner/pi-tui";
import { spawn, spawnSync } from "child_process";
import { APP_NAME, getAuthPath, getDebugLogPath, isBunBinary, VERSION } from "../../config.js";
import { APP_NAME, getAuthPath, getDebugLogPath, isBunBinary, isBunRuntime, VERSION } from "../../config.js";
import type { AgentSession, AgentSessionEvent } from "../../core/agent-session.js";
import type {
ExtensionContext,
@ -2330,11 +2330,10 @@ export class InteractiveMode {
}
showNewVersionNotification(newVersion: string): void {
const updateInstruction = isBunBinary
? theme.fg("muted", `New version ${newVersion} is available. Download from: `) +
theme.fg("accent", "https://github.com/badlogic/pi-mono/releases/latest")
: theme.fg("muted", `New version ${newVersion} is available. Run: `) +
theme.fg("accent", "npm install -g @mariozechner/pi-coding-agent");
const action = isBunBinary
? `Download from: ${theme.fg("accent", "https://github.com/badlogic/pi-mono/releases/latest")}`
: `Run: ${theme.fg("accent", `${isBunRuntime ? "bun" : "npm"} install -g @mariozechner/pi-coding-agent`)}`;
const updateInstruction = theme.fg("muted", `New version ${newVersion} is available. `) + action;
this.chatContainer.addChild(new Spacer(1));
this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));