@golproductions/check 1.2.2 → 1.3.0

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 +13 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golproductions/check",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Pre-execution firewall hook for AI agents. Validates every command before it reaches the shell. 152 failed commands without Check. 1 with it. Supports Claude Code, Gemini CLI, Antigravity, Cursor, and VS Code.",
5
5
  "bin": {
6
6
  "check": "src/index.js"
package/src/index.js CHANGED
@@ -2,11 +2,11 @@
2
2
  // Copyright (c) 2026 GOL Productions. All rights reserved. Proprietary and confidential.
3
3
 
4
4
  import { execFileSync } from "node:child_process";
5
-
6
5
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
7
6
  import { join } from "node:path";
8
7
  import { homedir } from "node:os";
9
8
 
9
+ const VERSION = "1.3.0";
10
10
  const API = "https://triage.golproductions.com/preflight";
11
11
  const CLIENT_ID = process.env.GOL_CLIENT_ID || "";
12
12
  const TIMEOUT_MS = 5000;
@@ -17,6 +17,12 @@ function install() {
17
17
  const home = homedir();
18
18
  let installed = 0;
19
19
 
20
+ const scriptSrc = readFileSync(new URL(import.meta.url), "utf8");
21
+ const hooksDir = join(home, ".check");
22
+ mkdirSync(hooksDir, { recursive: true });
23
+ const scriptPath = join(hooksDir, "check.mjs");
24
+ writeFileSync(scriptPath, scriptSrc, "utf8");
25
+
20
26
  const targets = [
21
27
  {
22
28
  name: "Claude Code",
@@ -24,10 +30,9 @@ function install() {
24
30
  file: "settings.json",
25
31
  config: (existing) => {
26
32
  existing.hooks = existing.hooks || {};
27
- const cmd = process.platform === "win32" ? "npx.cmd" : "npx";
28
33
  existing.hooks.PreToolUse = [{
29
34
  matcher: "Bash|PowerShell",
30
- hooks: [{ type: "command", command: cmd, args: ["@golproductions/check"] }]
35
+ hooks: [{ type: "command", command: "node", args: [scriptPath] }]
31
36
  }];
32
37
  existing.env = existing.env || {};
33
38
  existing.env.GOL_CLIENT_ID = key;
@@ -42,7 +47,8 @@ function install() {
42
47
  existing.hooks = existing.hooks || {};
43
48
  existing.hooks.BeforeTool = [{
44
49
  type: "command",
45
- command: "npx @golproductions/check",
50
+ command: "node",
51
+ args: [scriptPath],
46
52
  matcher: ".*",
47
53
  timeout: 5000
48
54
  }];
@@ -57,7 +63,7 @@ function install() {
57
63
  existing.version = existing.version || 1;
58
64
  existing.hooks = existing.hooks || {};
59
65
  existing.hooks.beforeShellExecution = [{
60
- command: "npx @golproductions/check"
66
+ command: "node " + scriptPath
61
67
  }];
62
68
  return existing;
63
69
  }
@@ -70,7 +76,6 @@ function install() {
70
76
  let existing = {};
71
77
  try { existing = JSON.parse(readFileSync(filepath, "utf8")); } catch {}
72
78
  const updated = t.config(existing);
73
- mkdirSync(t.dir, { recursive: true });
74
79
  writeFileSync(filepath, JSON.stringify(updated, null, 2) + "\n", "utf8");
75
80
  console.log(` ${t.name} configured`);
76
81
  installed++;
@@ -174,6 +179,7 @@ async function main() {
174
179
  try {
175
180
  let input = "";
176
181
  for await (const chunk of process.stdin) input += chunk;
182
+ input = input.replace(/^/, "").trim();
177
183
 
178
184
  let parsed;
179
185
  try { parsed = JSON.parse(input); } catch { respond("claude", true); return; }
@@ -182,12 +188,10 @@ async function main() {
182
188
  const command = extractCommand(parsed, platform);
183
189
  if (!command) { respond(platform, true); return; }
184
190
 
185
- const toolName = parsed.tool_name;
186
191
  const trimmed = command.trim();
187
192
  const first = trimmed.split(/\s+/)[0];
188
193
 
189
194
  if (SKIP.has(first)) { respond(platform, true); return; }
190
- if (platform === "claude" && toolName === "PowerShell") { respond(platform, true); return; }
191
195
 
192
196
  if (!CLIENT_ID) {
193
197
  process.stderr.write("check: GOL_CLIENT_ID not set. Get your key at https://www.golproductions.com/check.html\n");
@@ -214,7 +218,7 @@ async function main() {
214
218
  headers: {
215
219
  "Content-Type": "application/json",
216
220
  "X-GOL-CLIENT-ID": CLIENT_ID,
217
- "User-Agent": "check/1.1.0",
221
+ "User-Agent": "check/" + VERSION,
218
222
  },
219
223
  body: JSON.stringify(payload),
220
224
  signal: controller.signal,