@hua-labs/tap 0.5.1 → 0.5.2

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.
package/dist/index.mjs CHANGED
@@ -1022,16 +1022,22 @@ import * as os3 from "os";
1022
1022
  import * as path10 from "path";
1023
1023
  import { spawnSync as spawnSync2 } from "child_process";
1024
1024
  import { fileURLToPath as fileURLToPath2 } from "url";
1025
+ function resolveProbeCommand(candidate) {
1026
+ return resolveCommandPath(candidate) ?? candidate;
1027
+ }
1028
+ function probeCommandVersion(command) {
1029
+ return spawnSync2(command, ["--version"], {
1030
+ encoding: "utf-8",
1031
+ windowsHide: true
1032
+ });
1033
+ }
1025
1034
  function probeCommand(candidates) {
1026
1035
  for (const candidate of candidates) {
1027
- const result = spawnSync2(candidate, ["--version"], {
1028
- encoding: "utf-8",
1029
- shell: process.platform === "win32"
1030
- });
1036
+ const resolvedCommand = resolveProbeCommand(candidate);
1037
+ const result = probeCommandVersion(resolvedCommand);
1031
1038
  if (result.status === 0) {
1032
1039
  const version2 = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim() || null;
1033
- const absolutePath = resolveCommandPath(candidate);
1034
- return { command: absolutePath ?? candidate, version: version2 };
1040
+ return { command: resolvedCommand, version: version2 };
1035
1041
  }
1036
1042
  }
1037
1043
  return { command: null, version: null };
@@ -1133,19 +1139,16 @@ function findPreferredBunCommand() {
1133
1139
  const candidates = process.platform === "win32" ? [path10.join(home, ".bun", "bin", "bun.exe"), "bun", "bun.cmd"] : [path10.join(home, ".bun", "bin", "bun"), "bun"];
1134
1140
  for (const candidate of candidates) {
1135
1141
  if (path10.isAbsolute(candidate) && !fs10.existsSync(candidate)) continue;
1136
- const result = spawnSync2(candidate, ["--version"], {
1137
- encoding: "utf-8",
1138
- shell: process.platform === "win32"
1139
- });
1142
+ const resolvedCommand = resolveProbeCommand(candidate);
1143
+ const result = probeCommandVersion(resolvedCommand);
1140
1144
  if (result.status === 0) {
1141
- return path10.isAbsolute(candidate) ? toForwardSlashPath(candidate) : candidate;
1145
+ return path10.isAbsolute(resolvedCommand) ? toForwardSlashPath(resolvedCommand) : resolvedCommand;
1142
1146
  }
1143
1147
  }
1144
1148
  return null;
1145
1149
  }
1146
1150
  function buildManagedMcpServerSpec(ctx, instanceId) {
1147
1151
  const sourcePath = findTapCommsServerEntry(ctx);
1148
- const bunCommand = findPreferredBunCommand();
1149
1152
  const warnings = [];
1150
1153
  const issues = [];
1151
1154
  const env = {
@@ -1165,7 +1168,7 @@ function buildManagedMcpServerSpec(ctx, instanceId) {
1165
1168
  }
1166
1169
  const isBundled = sourcePath.endsWith(".mjs");
1167
1170
  const isEphemeralSource = isEphemeralPath(sourcePath);
1168
- let command = null;
1171
+ let command;
1169
1172
  let args = [toForwardSlashPath(sourcePath)];
1170
1173
  if (isEphemeralSource && isBundled) {
1171
1174
  command = "npx";
@@ -1179,7 +1182,7 @@ function buildManagedMcpServerSpec(ctx, instanceId) {
1179
1182
  );
1180
1183
  command = nodeProbe.command ?? "node";
1181
1184
  } else {
1182
- command = bunCommand;
1185
+ command = findPreferredBunCommand();
1183
1186
  }
1184
1187
  if (!command) {
1185
1188
  issues.push(