refactor: migrated binary detection to $which() utility across codebase

- Replaced all Bun.which() calls with $which() utility from @oh-my-pi/pi-utils across 22 files.
- Removed findBashOnPath() wrapper function from procmgr.ts, consolidating binary path resolution.
- Updated AGENTS.md documentation to reflect new $which() API usage pattern.
- Centralized binary detection logic through shared utility, reducing code duplication.
This commit is contained in:
can1357
2026-04-08 05:22:27 +02:00
parent 528d8225b7
commit 6d07944654
23 changed files with 93 additions and 81 deletions
@@ -4,7 +4,7 @@ import * as path from "node:path";
import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
import { resetPreludeDocsCache, warmPythonEnvironment } from "@oh-my-pi/pi-coding-agent/ipy/executor";
import { getPythonToolDescription, PythonTool } from "@oh-my-pi/pi-coding-agent/tools/python";
import { getProjectDir } from "@oh-my-pi/pi-utils";
import { $which, getProjectDir } from "@oh-my-pi/pi-utils";
const resolvePythonPath = (): string | null => {
const venvPath = Bun.env.VIRTUAL_ENV;
@@ -19,7 +19,7 @@ const resolvePythonPath = (): string | null => {
return pythonCandidate;
}
}
return Bun.which("python") ?? Bun.which("python3");
return $which("python") ?? $which("python3");
};
const pythonPath = resolvePythonPath();