From 95eadb9ed7f45e1c1267a71658b55df645414406 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Sat, 6 Dec 2025 23:12:36 +0100 Subject: [PATCH] Release v0.13.1 --- package-lock.json | 18 ++--- packages/agent/package.json | 6 +- packages/ai/package.json | 2 +- packages/coding-agent/CHANGELOG.md | 6 ++ packages/coding-agent/README.md | 26 ++++++- packages/coding-agent/package.json | 8 +-- packages/coding-agent/src/settings-manager.ts | 10 +++ packages/coding-agent/src/tools/bash.ts | 69 +++++++++++++++++-- packages/mom/package.json | 6 +- packages/pods/package.json | 4 +- packages/proxy/package.json | 2 +- packages/tui/package.json | 2 +- packages/web-ui/example/package.json | 2 +- packages/web-ui/package.json | 6 +- 14 files changed, 132 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index ba87f87c..376f964f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6459,7 +6459,7 @@ }, "packages/agent": { "name": "@mariozechner/pi-agent-core", - "version": "0.13.0", + "version": "0.13.1", "license": "MIT", "dependencies": { "@mariozechner/pi-ai": "^0.13.0", @@ -6493,7 +6493,7 @@ }, "packages/ai": { "name": "@mariozechner/pi-ai", - "version": "0.13.0", + "version": "0.13.1", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.61.0", @@ -6534,7 +6534,7 @@ }, "packages/coding-agent": { "name": "@mariozechner/pi-coding-agent", - "version": "0.13.0", + "version": "0.13.1", "license": "MIT", "dependencies": { "@mariozechner/pi-agent-core": "^0.13.0", @@ -6576,7 +6576,7 @@ }, "packages/mom": { "name": "@mariozechner/pi-mom", - "version": "0.13.0", + "version": "0.13.1", "license": "MIT", "dependencies": { "@anthropic-ai/sandbox-runtime": "^0.0.16", @@ -6619,7 +6619,7 @@ }, "packages/pods": { "name": "@mariozechner/pi", - "version": "0.13.0", + "version": "0.13.1", "license": "MIT", "dependencies": { "@mariozechner/pi-agent-core": "^0.13.0", @@ -6635,7 +6635,7 @@ }, "packages/proxy": { "name": "@mariozechner/pi-proxy", - "version": "0.13.0", + "version": "0.13.1", "dependencies": { "@hono/node-server": "^1.14.0", "hono": "^4.6.16" @@ -6651,7 +6651,7 @@ }, "packages/tui": { "name": "@mariozechner/pi-tui", - "version": "0.13.0", + "version": "0.13.1", "license": "MIT", "dependencies": { "@types/mime-types": "^2.1.4", @@ -6695,7 +6695,7 @@ }, "packages/web-ui": { "name": "@mariozechner/pi-web-ui", - "version": "0.13.0", + "version": "0.13.1", "license": "MIT", "dependencies": { "@lmstudio/sdk": "^1.5.0", @@ -6721,7 +6721,7 @@ }, "packages/web-ui/example": { "name": "pi-web-ui-example", - "version": "1.1.0", + "version": "1.1.1", "dependencies": { "@mariozechner/mini-lit": "^0.2.0", "@mariozechner/pi-ai": "file:../../ai", diff --git a/packages/agent/package.json b/packages/agent/package.json index 6d8fb366..b0c7f939 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-agent-core", - "version": "0.13.0", + "version": "0.13.1", "description": "General-purpose agent with transport abstraction, state management, and attachment support", "type": "module", "main": "./dist/index.js", @@ -18,8 +18,8 @@ "prepublishOnly": "npm run clean && npm run build" }, "dependencies": { - "@mariozechner/pi-ai": "^0.13.0", - "@mariozechner/pi-tui": "^0.13.0" + "@mariozechner/pi-ai": "^0.13.1", + "@mariozechner/pi-tui": "^0.13.1" }, "keywords": [ "ai", diff --git a/packages/ai/package.json b/packages/ai/package.json index 901b7264..0f30ee27 100644 --- a/packages/ai/package.json +++ b/packages/ai/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-ai", - "version": "0.13.0", + "version": "0.13.1", "description": "Unified LLM API with automatic model discovery and provider configuration", "type": "module", "main": "./dist/index.js", diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 60844cfd..641a7d59 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased] +## [0.13.1] - 2025-12-06 + +### Added + +- **Flexible Windows shell configuration**: The bash tool now supports multiple shell sources beyond Git Bash. Resolution order: (1) custom `shellPath` in settings.json, (2) Git Bash in standard locations, (3) any bash.exe on PATH. This enables Cygwin, MSYS2, and other bash environments. Configure with `~/.pi/agent/settings.json`: `{"shellPath": "C:\\cygwin64\\bin\\bash.exe"}`. + ### Fixed - **Windows binary detection**: Fixed Bun compiled binary detection on Windows by checking for URL-encoded `%7EBUN` in addition to `$bunfs` and `~BUN` in `import.meta.url`. This ensures the binary correctly locates supporting files (package.json, themes, etc.) next to the executable. diff --git a/packages/coding-agent/README.md b/packages/coding-agent/README.md index 302f80f8..5f47d103 100644 --- a/packages/coding-agent/README.md +++ b/packages/coding-agent/README.md @@ -2,11 +2,12 @@ A radically simple and opinionated coding agent with multi-model support (including mid-session switching), a simple yet powerful CLI for headless coding tasks, and many creature comforts you might be used to from other coding agents. -Works on Linux, macOS, and Windows (barely tested, needs Git Bash running in the "modern" Windows Terminal). +Works on Linux, macOS, and Windows (needs a bash shell, see [Windows Shell Configuration](#windows-shell-configuration)). ## Table of Contents - [Installation](#installation) +- [Windows Shell Configuration](#windows-shell-configuration) - [Quick Start](#quick-start) - [API Keys](#api-keys) - [OAuth Authentication (Optional)](#oauth-authentication-optional) @@ -81,6 +82,29 @@ npm run build:binary ./dist/pi ``` +## Windows Shell Configuration + +On Windows, pi requires a bash shell. The following locations are checked in order: + +1. **Custom shell path** from `~/.pi/agent/settings.json` (if configured) +2. **Git Bash** in standard locations (`C:\Program Files\Git\bin\bash.exe`) +3. **bash.exe on PATH** (Cygwin, MSYS2, WSL, etc.) + +For most users, installing [Git for Windows](https://git-scm.com/download/win) is sufficient. + +### Custom Shell Path + +If you use Cygwin, MSYS2, or have bash in a non-standard location, add the path to your settings: + +```json +// ~/.pi/agent/settings.json +{ + "shellPath": "C:\\cygwin64\\bin\\bash.exe" +} +``` + +Alternatively, ensure your bash is on the system PATH. + ## Quick Start ```bash diff --git a/packages/coding-agent/package.json b/packages/coding-agent/package.json index 71850815..04209576 100644 --- a/packages/coding-agent/package.json +++ b/packages/coding-agent/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-coding-agent", - "version": "0.13.0", + "version": "0.13.1", "description": "Coding agent CLI with read, bash, edit, write tools and session management", "type": "module", "piConfig": { @@ -28,9 +28,9 @@ "prepublishOnly": "npm run clean && npm run build" }, "dependencies": { - "@mariozechner/pi-agent-core": "^0.13.0", - "@mariozechner/pi-ai": "^0.13.0", - "@mariozechner/pi-tui": "^0.13.0", + "@mariozechner/pi-agent-core": "^0.13.1", + "@mariozechner/pi-ai": "^0.13.1", + "@mariozechner/pi-tui": "^0.13.1", "chalk": "^5.5.0", "diff": "^8.0.2", "glob": "^11.0.3" diff --git a/packages/coding-agent/src/settings-manager.ts b/packages/coding-agent/src/settings-manager.ts index f9147f28..3b660b8f 100644 --- a/packages/coding-agent/src/settings-manager.ts +++ b/packages/coding-agent/src/settings-manager.ts @@ -17,6 +17,7 @@ export interface Settings { theme?: string; compaction?: CompactionSettings; hideThinkingBlock?: boolean; + shellPath?: string; // Custom shell path (e.g., for Cygwin users on Windows) } export class SettingsManager { @@ -153,4 +154,13 @@ export class SettingsManager { this.settings.hideThinkingBlock = hide; this.save(); } + + getShellPath(): string | undefined { + return this.settings.shellPath; + } + + setShellPath(path: string | undefined): void { + this.settings.shellPath = path; + this.save(); + } } diff --git a/packages/coding-agent/src/tools/bash.ts b/packages/coding-agent/src/tools/bash.ts index 4171f95c..fc138fb6 100644 --- a/packages/coding-agent/src/tools/bash.ts +++ b/packages/coding-agent/src/tools/bash.ts @@ -1,13 +1,57 @@ import type { AgentTool } from "@mariozechner/pi-ai"; import { Type } from "@sinclair/typebox"; -import { spawn } from "child_process"; +import { spawn, spawnSync } from "child_process"; import { existsSync } from "fs"; +import { SettingsManager } from "../settings-manager.js"; + +let cachedShellConfig: { shell: string; args: string[] } | null = null; /** - * Get shell configuration based on platform + * Find bash executable on PATH (Windows) + */ +function findBashOnPath(): string | null { + try { + const result = spawnSync("where", ["bash.exe"], { encoding: "utf-8", timeout: 5000 }); + if (result.status === 0 && result.stdout) { + const firstMatch = result.stdout.trim().split(/\r?\n/)[0]; + if (firstMatch && existsSync(firstMatch)) { + return firstMatch; + } + } + } catch { + // Ignore errors + } + return null; +} + +/** + * Get shell configuration based on platform. + * Resolution order: + * 1. User-specified shellPath in settings.json + * 2. On Windows: Git Bash in known locations + * 3. Fallback: bash on PATH (Windows) or sh (Unix) */ function getShellConfig(): { shell: string; args: string[] } { + if (cachedShellConfig) { + return cachedShellConfig; + } + + const settings = new SettingsManager(); + const customShellPath = settings.getShellPath(); + + // 1. Check user-specified shell path + if (customShellPath) { + if (existsSync(customShellPath)) { + cachedShellConfig = { shell: customShellPath, args: ["-c"] }; + return cachedShellConfig; + } + throw new Error( + `Custom shell path not found: ${customShellPath}\n` + `Please update shellPath in ~/.pi/agent/settings.json`, + ); + } + if (process.platform === "win32") { + // 2. Try Git Bash in known locations const paths: string[] = []; const programFiles = process.env.ProgramFiles; if (programFiles) { @@ -20,16 +64,29 @@ function getShellConfig(): { shell: string; args: string[] } { for (const path of paths) { if (existsSync(path)) { - return { shell: path, args: ["-c"] }; + cachedShellConfig = { shell: path, args: ["-c"] }; + return cachedShellConfig; } } + // 3. Fallback: search bash.exe on PATH (Cygwin, MSYS2, WSL, etc.) + const bashOnPath = findBashOnPath(); + if (bashOnPath) { + cachedShellConfig = { shell: bashOnPath, args: ["-c"] }; + return cachedShellConfig; + } + throw new Error( - `Git Bash not found. Please install Git for Windows from https://git-scm.com/download/win\n` + - `Searched in:\n${paths.map((p) => ` ${p}`).join("\n")}`, + `No bash shell found. Options:\n` + + ` 1. Install Git for Windows: https://git-scm.com/download/win\n` + + ` 2. Add your bash to PATH (Cygwin, MSYS2, etc.)\n` + + ` 3. Set shellPath in ~/.pi/agent/settings.json\n\n` + + `Searched Git Bash in:\n${paths.map((p) => ` ${p}`).join("\n")}`, ); } - return { shell: "sh", args: ["-c"] }; + + cachedShellConfig = { shell: "sh", args: ["-c"] }; + return cachedShellConfig; } /** diff --git a/packages/mom/package.json b/packages/mom/package.json index 2d283cbc..f476dd21 100644 --- a/packages/mom/package.json +++ b/packages/mom/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-mom", - "version": "0.13.0", + "version": "0.13.1", "description": "Slack bot that delegates messages to the pi coding agent", "type": "module", "bin": { @@ -21,8 +21,8 @@ }, "dependencies": { "@anthropic-ai/sandbox-runtime": "^0.0.16", - "@mariozechner/pi-agent-core": "^0.13.0", - "@mariozechner/pi-ai": "^0.13.0", + "@mariozechner/pi-agent-core": "^0.13.1", + "@mariozechner/pi-ai": "^0.13.1", "@sinclair/typebox": "^0.34.0", "@slack/socket-mode": "^2.0.0", "@slack/web-api": "^7.0.0", diff --git a/packages/pods/package.json b/packages/pods/package.json index 88b91f8f..eca33948 100644 --- a/packages/pods/package.json +++ b/packages/pods/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi", - "version": "0.13.0", + "version": "0.13.1", "description": "CLI tool for managing vLLM deployments on GPU pods", "type": "module", "bin": { @@ -34,7 +34,7 @@ "node": ">=20.0.0" }, "dependencies": { - "@mariozechner/pi-agent-core": "^0.13.0", + "@mariozechner/pi-agent-core": "^0.13.1", "chalk": "^5.5.0" }, "devDependencies": {} diff --git a/packages/proxy/package.json b/packages/proxy/package.json index a9aa9509..eb036d50 100644 --- a/packages/proxy/package.json +++ b/packages/proxy/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-proxy", - "version": "0.13.0", + "version": "0.13.1", "type": "module", "description": "CORS and authentication proxy for pi-ai", "main": "dist/index.js", diff --git a/packages/tui/package.json b/packages/tui/package.json index fdf9b96a..6c11ad57 100644 --- a/packages/tui/package.json +++ b/packages/tui/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-tui", - "version": "0.13.0", + "version": "0.13.1", "description": "Terminal User Interface library with differential rendering for efficient text-based applications", "type": "module", "main": "dist/index.js", diff --git a/packages/web-ui/example/package.json b/packages/web-ui/example/package.json index bc1f4a6e..b2f2eea7 100644 --- a/packages/web-ui/example/package.json +++ b/packages/web-ui/example/package.json @@ -1,6 +1,6 @@ { "name": "pi-web-ui-example", - "version": "1.1.0", + "version": "1.1.1", "private": true, "type": "module", "scripts": { diff --git a/packages/web-ui/package.json b/packages/web-ui/package.json index 89578c42..fc2f4a19 100644 --- a/packages/web-ui/package.json +++ b/packages/web-ui/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-web-ui", - "version": "0.13.0", + "version": "0.13.1", "description": "Reusable web UI components for AI chat interfaces powered by @mariozechner/pi-ai", "type": "module", "main": "dist/index.js", @@ -18,8 +18,8 @@ }, "dependencies": { "@lmstudio/sdk": "^1.5.0", - "@mariozechner/pi-ai": "^0.13.0", - "@mariozechner/pi-tui": "^0.13.0", + "@mariozechner/pi-ai": "^0.13.1", + "@mariozechner/pi-tui": "^0.13.1", "docx-preview": "^0.3.7", "jszip": "^3.10.1", "lucide": "^0.544.0",