The best way to control Claude Code, Codex and more from any computer or phone
fix(server): the suggested t3 command names this install, not another t3 on PATH (#22639)
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
Gourav Kumar Dhiman committed
Oct 31, 2026 at 02:11 UTC
0070b27f0ea83f39742ae241979ada208d02ffd8
2 files changed
+20
-3
apps/server/src/cli/invocation.test.ts
+8
@@ -71,7 +71,15 @@ it.layer(NodeServices.layer)("root CLI commands", (it) => {
71
72
expect(yield* rootCommand(desktop)).toBe(`sudo '${shim}' browser setup`);
73
74
+ // An unrelated `t3` on PATH, such as an older npm global, is another install's CLI.
75
expect(yield* rootCommand({ ...desktop, path: yield* pathWithT3 })).toBe(
76
+ `sudo '${shim}' browser setup`,
77
+ );
78
+
79
+ // The link the app installs onto PATH leads to its own launcher, so plain `t3` is right.
80
+ const linked = yield* fs.makeTempDirectoryScoped();
81
+ yield* fs.symlink(shim, path.join(linked, "t3"));
82
+ expect(yield* rootCommand({ ...desktop, path: linked })).toBe(
83
'sudo env "PATH=$PATH" t3 browser setup',
84
);
85
apps/server/src/cli/invocation.ts
+12
-3
@@ -6,7 +6,7 @@ import * as Schema from "effect/Schema";
6
7
import type { ServerInstallation } from "@t3tools/contracts";
8
import * as HostProcess from "@t3tools/shared/HostProcess";
9
-import { isCommandAvailable } from "@t3tools/shared/shell";
9
+import { resolveCommandPath } from "@t3tools/shared/shell";
10
11
import packageJson from "../../package.json" with { type: "json" };
12
@@ -143,7 +143,7 @@ const resolveInstallLauncher = Effect.gen(function* () {
143
});
144
145
/**
146
- * Uses `t3` on PATH, the originating package runner, or this install's absolute launcher path.
146
+ * Uses this install's `t3` on PATH, the originating runner, or its absolute launcher path.
147
* Arguments are quoted for POSIX shells or PowerShell on Windows.
148
*/
149
export const resolveHostCliCommand = Effect.fn("invocation.resolveHostCliCommand")(function* (
@@ -155,7 +155,16 @@ export const resolveHostCliCommand = Effect.fn("invocation.resolveHostCliCommand
155
[prefix, ...args.map((arg) => hostShellWord(platform, arg))].join(" ");
156
const command = yield* resolveCliCommand(subcommand);
157
if (command !== `t3 ${subcommand}`) return { command: withArgs(command), launcher: false };
158
- if (yield* isCommandAvailable("t3")) return { command: withArgs(command), launcher: false };
158
+ const onPath = yield* resolveCommandPath("t3");
159
+ if (onPath !== null) {
160
+ const shim = (yield* HostProcess.Environment).T3CODE_CLI_PATH?.trim();
161
+ const fs = yield* FileSystem.FileSystem;
162
+ const real = (file: string) => fs.realPath(file).pipe(Effect.orElseSucceed(() => null));
163
+ const shimReal = shim ? yield* real(shim) : null;
164
+ if (shimReal === null || shimReal === (yield* real(onPath))) {
165
+ return { command: withArgs(command), launcher: false };
166
+ }
167
+ }
168
const launcher = yield* resolveInstallLauncher;
169
if (Option.isNone(launcher)) return { command: withArgs(command), launcher: false };
170
// PowerShell runs a quoted path only through the call operator.