@golproductions/check 3.2.5 → 3.2.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +21 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golproductions/check",
3
- "version": "3.2.5",
3
+ "version": "3.2.6",
4
4
  "description": "The anti-hallucination layer for AI coding agents. Stops hallucinated commands, packages, and URLs before they run.",
5
5
  "bin": {
6
6
  "check": "src/index.js",
package/src/index.js CHANGED
@@ -6,7 +6,7 @@ import { homedir, platform, arch } from "node:os";
6
6
  import { pipeline } from "node:stream/promises";
7
7
  import { Readable } from "node:stream";
8
8
 
9
- const VERSION = "3.2.5";
9
+ const VERSION = "3.2.6";
10
10
  const BINARY_VERSION = "3.0.0";
11
11
  const API = "https://triage.golproductions.com/preflight";
12
12
  const CDN = "https://pub-e55366a7f5994be9be04f0e205179f4a.r2.dev/releases";
@@ -768,6 +768,23 @@ function segmentBases(command) {
768
768
  // on itself: builtins, keywords, functions, and PATH binaries all answer
769
769
  // through the exact resolution the shell will use at launch. A model of the
770
770
  // shell can drift from the shell; the shell cannot drift from itself.
771
+ // On Windows, bare "bash" is a trap: PATH can resolve to WSL's
772
+ // System32\bash.exe — a different operating system with a different
773
+ // filesystem. The command will actually run in Git Bash, so the probe
774
+ // must ask Git Bash, located explicitly. If it cannot be located,
775
+ // abstain — never let the wrong interpreter answer for the right one.
776
+ function bashPath() {
777
+ if (platform() !== "win32") return "bash";
778
+ const candidates = [
779
+ process.env.CLAUDE_CODE_GIT_BASH_PATH,
780
+ "C:/Program Files/Git/bin/bash.exe",
781
+ "C:/Program Files/Git/usr/bin/bash.exe",
782
+ "C:/Program Files (x86)/Git/bin/bash.exe",
783
+ ].filter(Boolean);
784
+ for (const c of candidates) { try { if (existsSync(c)) return c; } catch {} }
785
+ return null;
786
+ }
787
+
771
788
  function shellKnows(name, cwd, shell) {
772
789
  try {
773
790
  if (shell === "powershell") {
@@ -776,7 +793,9 @@ function shellKnows(name, cwd, shell) {
776
793
  { cwd, timeout: 4000, stdio: "ignore", env: { ...process.env, CHECK_PROBE: name } });
777
794
  return r.error ? null : r.status === 0;
778
795
  }
779
- const r = spawnSync("bash", ["-c", 'type -- "$1" >/dev/null 2>&1', "check", name],
796
+ const bash = bashPath();
797
+ if (!bash) return null;
798
+ const r = spawnSync(bash, ["-c", 'type -- "$1" >/dev/null 2>&1', "check", name],
780
799
  { cwd, timeout: 4000, stdio: "ignore" });
781
800
  return r.error ? null : r.status === 0;
782
801
  } catch { return null; }