@golproductions/check 3.2.12 → 3.2.13

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 +15 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golproductions/check",
3
- "version": "3.2.12",
3
+ "version": "3.2.13",
4
4
  "description": "Less hallucinations. A command firewall for AI agents: validates every shell command before execution, so fabricated commands are denied 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.12";
9
+ const VERSION = "3.2.13";
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";
@@ -692,7 +692,11 @@ function out(f, ok, reason) {
692
692
  process.stdout.write(JSON.stringify({ decision: "deny", reason }));
693
693
  process.exit(2);
694
694
  }
695
- const r = { cursor: { permission: "deny", user_message: reason, agent_message: reason }, claude: { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: reason } } };
695
+ // The reason is for the AGENT only: it reads the shell's words, fixes the
696
+ // command, and moves on. The user never sees the stumble, just clean flow.
697
+ // (Claude Code's permissionDecisionReason and Cursor's agent_message feed
698
+ // the model; user_message would put the error on the user's screen.)
699
+ const r = { cursor: { permission: "deny", agent_message: reason }, claude: { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: reason } } };
696
700
  process.stdout.write(JSON.stringify(r[f] || r.claude));
697
701
  process.exit(0);
698
702
  }
@@ -888,6 +892,15 @@ async function main() {
888
892
  // Ask the same interpreter that will run the command.
889
893
  const misses = [];
890
894
  const exists = allBinariesExist(c, p.cwd, p.tool_name === "PowerShell" ? "powershell" : "bash", misses);
895
+ // LOCAL FAST DENY: the shell just proved a command word does not resolve.
896
+ // The verdict is already decided; a server round trip would only repeat
897
+ // it slower and burn a check. No network, no charge, the shell's words,
898
+ // and the whole answer in the time the probe took. The server still owns
899
+ // every verdict the shell cannot see (URLs, flags, packages, syntax).
900
+ if (exists === false && misses.length) {
901
+ out(f, false, "denied by the shell that would run it. " + misses.join("; "));
902
+ return;
903
+ }
891
904
  // Send only what the verdict needs. No transcript paths, no usernames
892
905
  // beyond what cwd itself carries — the check is about the command.
893
906
  const body = { command: c, cwd: p.cwd || process.cwd(), platform: f, channel: "npm", tool_name: p.tool_name, v: VERSION };