tmex-cli 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20282,7 +20282,7 @@ var require_lib3 = __commonJS((exports, module) => {
20282
20282
 
20283
20283
  // src/runtime/server.ts
20284
20284
  import { existsSync as existsSync3 } from "fs";
20285
- import { extname, join as join2, normalize, resolve as resolve2, sep } from "path";
20285
+ import { extname, join as join3, normalize, resolve as resolve2, sep } from "path";
20286
20286
 
20287
20287
  // ../../apps/gateway/src/crypto/errors.ts
20288
20288
  function contextLabel(context) {
@@ -51869,6 +51869,7 @@ import { homedir } from "os";
51869
51869
 
51870
51870
  // ../../apps/gateway/src/tmux/local-shell-path.ts
51871
51871
  import { existsSync } from "fs";
51872
+ import { delimiter, join as join2 } from "path";
51872
51873
  var SHELL_ENV_BEGIN_MARKER = "__TMEX_SHELL_ENV_BEGIN__";
51873
51874
  var SHELL_ENV_END_MARKER = "__TMEX_SHELL_ENV_END__";
51874
51875
  var SHELL_ENV_PROBE_COMMAND = `printf '${SHELL_ENV_BEGIN_MARKER}\\n'; /usr/bin/env; printf '${SHELL_ENV_END_MARKER}\\n'`;
@@ -51938,23 +51939,40 @@ function extractPathFromShellEnv(stdout) {
51938
51939
  }
51939
51940
  return null;
51940
51941
  }
51942
+ function canResolveExecutableFromPath(resolvedPath, executableName, deps) {
51943
+ for (const rawDir of resolvedPath.split(delimiter)) {
51944
+ const dir2 = rawDir.trim();
51945
+ if (!dir2) {
51946
+ continue;
51947
+ }
51948
+ if (deps.fileExists(join2(dir2, executableName))) {
51949
+ return true;
51950
+ }
51951
+ }
51952
+ return false;
51953
+ }
51941
51954
  function probeShellPath(shellPath, deps) {
51942
51955
  const attempts = [
51943
51956
  [shellPath, "-l", "-c", SHELL_ENV_PROBE_COMMAND],
51944
51957
  [shellPath, "-l", "-i", "-c", SHELL_ENV_PROBE_COMMAND],
51945
51958
  [shellPath, "-c", SHELL_ENV_PROBE_COMMAND]
51946
51959
  ];
51960
+ let fallbackPath = null;
51947
51961
  for (const cmd of attempts) {
51948
51962
  const result = deps.runSync(cmd);
51949
51963
  if (result.exitCode !== 0) {
51950
51964
  continue;
51951
51965
  }
51952
51966
  const resolvedPath = extractPathFromShellEnv(result.stdout);
51953
- if (resolvedPath) {
51967
+ if (!resolvedPath) {
51968
+ continue;
51969
+ }
51970
+ fallbackPath ??= resolvedPath;
51971
+ if (canResolveExecutableFromPath(resolvedPath, "tmux", deps)) {
51954
51972
  return resolvedPath;
51955
51973
  }
51956
51974
  }
51957
- return null;
51975
+ return fallbackPath;
51958
51976
  }
51959
51977
  function createLocalShellPathCache(input = {}) {
51960
51978
  const deps = {
@@ -55758,7 +55776,7 @@ async function serveFrontend(req, staticRoot) {
55758
55776
  if (!requestedPath) {
55759
55777
  return new Response(t3("runtime.forbidden"), { status: 403 });
55760
55778
  }
55761
- const indexPath = join2(staticRoot, "index.html");
55779
+ const indexPath = join3(staticRoot, "index.html");
55762
55780
  const targetPath = existsSync3(requestedPath) ? requestedPath : indexPath;
55763
55781
  if (!existsSync3(targetPath)) {
55764
55782
  return new Response(t3("runtime.frontendMissing"), { status: 500 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmex-cli",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "tmex": "./bin/tmex.js",