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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user