@devries-cameron20 / t3code Mirror · read-only / commits / 77fe1d6a02
Fork 0

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 21, 09:45 UTC

fix(cli): ignore non-executable paths when checking installation (#37903)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Simone committed Nov 17, 2026 at 05:32 UTC 77fe1d6a0242541b74d6062f9e9a1cfc7fea8f45
2 files changed +10 -3
apps/server/src/cli/install.test.ts
+8 -1
@@ -72,13 +72,20 @@ it.layer(NodeServices.layer)("t3 install", (it) => {
72 // Another t3 earlier on PATH still runs first, so `t3` would not run this one.
73 const otherBin = path.join(root, "other-bin");
74 yield* fs.makeDirectory(otherBin);
75 - yield* fs.writeFileString(path.join(otherBin, "t3"), "");
75 + yield* fs.writeFileString(path.join(otherBin, "t3"), "", { mode: 0o755 });
76 const shadowed = yield* provide(installCli(), {
77 PATH: `${otherBin}:${path.join(root, "bin")}`,
78 });
79 assert.isFalse(shadowed.onPath);
80 assert.equal(shadowed.shadowedBy, path.join(otherBin, "t3"));
81 assert.isUndefined(shadowed.pathCommand);
82 + yield* fs.remove(path.join(otherBin, "t3"));
83 + yield* fs.makeDirectory(path.join(otherBin, "t3"));
84 + const directory = yield* provide(installCli(), {
85 + PATH: `${otherBin}:${path.join(root, "bin")}`,
86 + });
87 + assert.isTrue(directory.onPath);
88 + assert.isUndefined(directory.shadowedBy);
89 const recorded = yield* fs.readFileString(path.join(runtimeDir, "launchers"));
90 assert.equal(recorded, `\n${yield* fs.realPath(path.join(root, "bin"))}/t3\n`);
91
apps/server/src/cli/install.ts
+2 -2
@@ -1,5 +1,5 @@
1 import * as HostProcess from "@t3tools/shared/HostProcess";
2 -import { pathSetupCommand } from "@t3tools/shared/shell";
2 +import { pathSetupCommand, resolveCommandPath } from "@t3tools/shared/shell";
3 import * as Console from "effect/Console";
4 import * as Duration from "effect/Duration";
5 import * as Effect from "effect/Effect";
@@ -156,7 +156,7 @@ export const installCli = Effect.fn("cli.install.install")(function* () {
156 if (!path.isAbsolute(entry) || detectCliRunner(`${entry}/`) !== null) continue;
157 for (const name of windows ? ["t3.cmd", "t3.exe"] : ["t3"]) {
158 const candidate = path.join(entry, name);
159 - if (yield* fs.exists(candidate).pipe(Effect.orElseSucceed(() => false))) return candidate;
159 + if (yield* resolveCommandPath(candidate, { env: environment })) return candidate;
160 }
161 }
162 return undefined;