@golproductions/check 1.2.2 → 1.2.3

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 +10 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golproductions/check",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
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
@@ -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++;