diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index e76228bf..bb1861ec 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -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 diff --git a/packages/coding-agent/src/config.ts b/packages/coding-agent/src/config.ts index b865350e..9d9af583 100644 --- a/packages/coding-agent/src/config.ts +++ b/packages/coding-agent/src/config.ts @@ -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) // ============================================================================= diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts index 2469d9c0..79f536b0 100644 --- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts @@ -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)));