Skip to content

Write HTML. Render video. Built for agents.

fix(cli): avoid Python whisper CLI collision (#2414)

Miguel Ángel9b17a5ad7e77
diff --git a/packages/cli/src/whisper/manager-resolution.test.ts b/packages/cli/src/whisper/manager-resolution.test.ts
new file mode 100644
index 0000000000..345ac35e01
--- /dev/null
+++ b/packages/cli/src/whisper/manager-resolution.test.ts
@@ -0,0 +1,25 @@
+import { describe, expect, it, vi } from "vitest";
+
+vi.mock("node:child_process", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("node:child_process")>();
+ return {
+ ...actual,
+ execFileSync: vi.fn((_command: string, args: string[]) => {
+ if (args[0] === "whisper") return "/fake/python-whisper\n";
+ throw new Error(`${args[0]} not found`);
+ }),
+ };
+});
+
+vi.mock("node:fs", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("node:fs")>();
+ return { ...actual, existsSync: vi.fn(() => false) };
+});
+
+describe("findWhisper", () => {
+ it("does not treat the OpenAI Python whisper command as whisper.cpp", async () => {
+ const { findWhisper } = await import("./manager.js");
+
+ expect(findWhisper()).toBeUndefined();
+ });
+});
diff --git a/packages/cli/src/whisper/manager.ts b/packages/cli/src/whisper/manager.ts
index 7985283382..55d4e3b0de 100644
--- a/packages/cli/src/whisper/manager.ts
+++ b/packages/cli/src/whisper/manager.ts
@@ -67,10 +67,9 @@ function findFromEnv(): WhisperResult | undefined {
}
function findFromSystem(): WhisperResult | undefined {
- for (const name of ["whisper-cli", "whisper"]) {
- const path = whichBinary(name);
- if (path) return { executablePath: path, source: "system" };
- }
+ // `whisper` is the OpenAI Python CLI; only whisper.cpp's binary accepts our flags.
+ const path = whichBinary("whisper-cli");
+ if (path) return { executablePath: path, source: "system" };
// Check brew paths directly on macOS
if (platform() === "darwin") {