The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 08:15 UTC
fix(desktop): disable blocked t3 CLI installation (#27286)
Co-authored-by: maria-rcks <maria@kuuro.net>
Nate Glasby committed
Nov 1, 2026 at 23:43 UTC
0bccd293cfbb09ef7b9e23184df7e756c4411b58
2 files changed
+52
-1
apps/web/src/components/settings/CliCommandSettingsRow.browser.test.tsx
new
+51
@@ -0,0 +1,51 @@
1
+import { RegistryContext } from "@effect/atom-react";
2
+import type { DesktopCliCommandState } from "@t3tools/contracts";
3
+import { AtomRegistry } from "effect/reactivity";
4
+import { expect, it, vi } from "vite-plus/test";
5
+
6
+import { act, render, stubGlobal } from "../../../test/render";
7
+import { desktopCliCommandStateAtom } from "../../state/desktopCliCommand";
8
+import { CliCommandSettingsRow } from "./CliCommandSettingsRow";
9
+
10
+it("blocks installation behind another t3 without blocking removal of our installation", async () => {
11
+ const state: DesktopCliCommandState = {
12
+ supported: true,
13
+ installedPath: null,
14
+ onPath: false,
15
+ launcherPath: "/home/test/.t3/bin/t3",
16
+ };
17
+ const getState = vi.fn(async (): Promise<DesktopCliCommandState> => ({
18
+ ...state,
19
+ shadowedBy: "/usr/local/bin/t3",
20
+ }));
21
+ const uninstall = vi.fn(async () => state);
22
+ using _bridge = stubGlobal("desktopBridge", {
23
+ cliCommand: { getState, install: vi.fn(async () => state), uninstall },
24
+ getLocalEnvironmentEnabled: () => true,
25
+ getLocalEnvironmentBootstraps: () => [],
26
+ });
27
+ const registry = AtomRegistry.make();
28
+ using _registry = { [Symbol.dispose]: () => registry.dispose() };
29
+ await using screen = await render(
30
+ <RegistryContext.Provider value={registry}>
31
+ <CliCommandSettingsRow />
32
+ </RegistryContext.Provider>,
33
+ );
34
+
35
+ await expect.element(screen.getByRole("button", { name: "Install" })).toBeDisabled();
36
+
37
+ getState.mockResolvedValue(state);
38
+ await act(() => registry.refresh(desktopCliCommandStateAtom));
39
+ await expect.element(screen.getByRole("button", { name: "Install" })).toBeEnabled();
40
+
41
+ getState.mockResolvedValue({
42
+ ...state,
43
+ installedPath: "/home/test/.local/bin/t3",
44
+ shadowedBy: "/usr/local/bin/t3",
45
+ });
46
+ await act(() => registry.refresh(desktopCliCommandStateAtom));
47
+ const remove = screen.getByRole("button", { name: "Remove" });
48
+ await expect.element(remove).toBeEnabled();
49
+ await remove.click();
50
+ expect(uninstall).toHaveBeenCalledOnce();
51
+});
apps/web/src/components/settings/CliCommandSettingsRow.tsx
+1
-1
@@ -52,7 +52,7 @@ export function CliCommandSettingsRow() {
52
<Button
53
size="sm"
54
variant="outline"
55
- disabled={pending || query.isPending}
55
+ disabled={pending || query.isPending || (!installed && Boolean(state.shadowedBy))}
56
onClick={() => change(installed ? "uninstall" : "install")}
57
>
58
{installed ? "Remove" : "Install"}