Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/cli/src/whisper/manager.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { describe, it, expect } from "vitest";
import { WhisperUnavailableError, isWhisperUnavailable } from "./manager.js";
import {
WHISPER_CPP_SYSTEM_BINARY_NAMES,
WhisperUnavailableError,
isWhisperUnavailable,
} from "./manager.js";

describe("system executable discovery", () => {
it("does not accept the unrelated Python whisper CLI", () => {
expect(WHISPER_CPP_SYSTEM_BINARY_NAMES).toEqual(["whisper-cli"]);
expect(WHISPER_CPP_SYSTEM_BINARY_NAMES).not.toContain("whisper");
});
});

describe("isWhisperUnavailable", () => {
it("recognizes WhisperUnavailableError instances", () => {
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/whisper/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export interface WhisperResult {
source: WhisperSource;
}

// Only whisper.cpp's current executable is compatible with the CLI arguments
// used below. The unrelated Python `whisper` package installs a binary named
// `whisper` with a different interface, so it must never satisfy discovery.
export const WHISPER_CPP_SYSTEM_BINARY_NAMES = ["whisper-cli"] as const;

// A missing/uninstallable whisper-cpp is an environment prerequisite gap (no
// binary, no Homebrew, no compiler toolchain), not a transcription bug. Callers
// that treat captions as optional (init, skill pipelines) skip on this and keep
Expand Down Expand Up @@ -67,7 +72,7 @@ function findFromEnv(): WhisperResult | undefined {
}

function findFromSystem(): WhisperResult | undefined {
for (const name of ["whisper-cli", "whisper"]) {
for (const name of WHISPER_CPP_SYSTEM_BINARY_NAMES) {
const path = whichBinary(name);
if (path) return { executablePath: path, source: "system" };
}
Expand Down
Loading