diff --git a/packages/cli/__tests__/lib/preflight.test.ts b/packages/cli/__tests__/lib/preflight.test.ts index 36446ea46..dc7536ce4 100644 --- a/packages/cli/__tests__/lib/preflight.test.ts +++ b/packages/cli/__tests__/lib/preflight.test.ts @@ -97,24 +97,14 @@ describe("preflight.checkTmux", () => { expect(mockExec).toHaveBeenCalledWith("tmux", ["-V"]); }); - it("attempts auto-install when tmux is missing", async () => { - // First call: tmux -V fails (not installed) - // Second call: auto-install attempt (brew/apt/dnf) - // Third call: tmux -V succeeds (installed now) - mockExec - .mockRejectedValueOnce(new Error("ENOENT")) // tmux -V - .mockResolvedValueOnce({ stdout: "", stderr: "" }) // install command - .mockResolvedValueOnce({ stdout: "tmux 3.3a", stderr: "" }); // verify - await expect(preflight.checkTmux()).resolves.toBeUndefined(); - }); - - it("throws with install instructions when auto-install fails", async () => { - // All attempts fail + it("throws with install instructions when tmux is missing", async () => { mockExec.mockRejectedValue(new Error("ENOENT")); const err = await preflight.checkTmux().catch((e: Error) => e); expect(err).toBeInstanceOf(Error); expect(err.message).toContain("tmux is not installed"); expect(err.message).toContain("Install it:"); + expect(mockExec).toHaveBeenCalledTimes(1); + expect(mockExec).toHaveBeenCalledWith("tmux", ["-V"]); }); }); diff --git a/packages/cli/src/lib/preflight.ts b/packages/cli/src/lib/preflight.ts index 7b424ddfc..0f7721f85 100644 --- a/packages/cli/src/lib/preflight.ts +++ b/packages/cli/src/lib/preflight.ts @@ -66,22 +66,17 @@ function findPackageUp(startDir: string, ...segments: string[]): string | null { } /** - * Check that tmux is installed. If missing, attempt auto-install. - * Falls back to a clear error with platform-appropriate instructions - * if auto-install is not possible. + * Check that tmux is installed. + * Throws with platform-appropriate manual install instructions when missing. */ async function checkTmux(): Promise { try { await exec("tmux", ["-V"]); return; } catch { - // tmux not found — try to install it + // tmux not found } - // Attempt auto-install based on platform - const installed = await autoInstallTmux(); - if (installed) return; - const hint = process.platform === "darwin" ? "brew install tmux" @@ -91,36 +86,6 @@ async function checkTmux(): Promise { throw new Error(`tmux is not installed. Install it: ${hint}`); } -/** - * Try to auto-install tmux. Returns true if successful. - * Tries brew (macOS), apt-get, then dnf (Linux). Silent on failure. - */ -async function autoInstallTmux(): Promise { - const attempts: Array<{ cmd: string; args: string[] }> = - process.platform === "darwin" - ? [{ cmd: "brew", args: ["install", "tmux"] }] - : process.platform === "linux" - ? [ - { cmd: "sudo", args: ["apt-get", "install", "-y", "tmux"] }, - { cmd: "sudo", args: ["dnf", "install", "-y", "tmux"] }, - ] - : []; - - for (const { cmd, args } of attempts) { - try { - const label = [cmd, ...args].join(" "); - console.log(` Attempting: ${label}`); - await exec(cmd, args); - // Verify it actually worked - await exec("tmux", ["-V"]); - return true; - } catch { - // Try next method - } - } - return false; -} - /** * Check that the GitHub CLI is installed and authenticated. * Distinguishes between "not installed" and "not authenticated"