@golproductions/check 1.2.1 → 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.
- package/package.json +1 -1
- package/src/index.js +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golproductions/check",
|
|
3
|
-
"version": "1.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",
|
|
@@ -26,7 +32,7 @@ function install() {
|
|
|
26
32
|
existing.hooks = existing.hooks || {};
|
|
27
33
|
existing.hooks.PreToolUse = [{
|
|
28
34
|
matcher: "Bash|PowerShell",
|
|
29
|
-
hooks: [{ type: "command", command: "
|
|
35
|
+
hooks: [{ type: "command", command: "node", args: [scriptPath] }]
|
|
30
36
|
}];
|
|
31
37
|
existing.env = existing.env || {};
|
|
32
38
|
existing.env.GOL_CLIENT_ID = key;
|
|
@@ -41,7 +47,8 @@ function install() {
|
|
|
41
47
|
existing.hooks = existing.hooks || {};
|
|
42
48
|
existing.hooks.BeforeTool = [{
|
|
43
49
|
type: "command",
|
|
44
|
-
command: "
|
|
50
|
+
command: "node",
|
|
51
|
+
args: [scriptPath],
|
|
45
52
|
matcher: ".*",
|
|
46
53
|
timeout: 5000
|
|
47
54
|
}];
|
|
@@ -56,7 +63,7 @@ function install() {
|
|
|
56
63
|
existing.version = existing.version || 1;
|
|
57
64
|
existing.hooks = existing.hooks || {};
|
|
58
65
|
existing.hooks.beforeShellExecution = [{
|
|
59
|
-
command: "
|
|
66
|
+
command: "node " + scriptPath
|
|
60
67
|
}];
|
|
61
68
|
return existing;
|
|
62
69
|
}
|
|
@@ -69,7 +76,6 @@ function install() {
|
|
|
69
76
|
let existing = {};
|
|
70
77
|
try { existing = JSON.parse(readFileSync(filepath, "utf8")); } catch {}
|
|
71
78
|
const updated = t.config(existing);
|
|
72
|
-
mkdirSync(t.dir, { recursive: true });
|
|
73
79
|
writeFileSync(filepath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
74
80
|
console.log(` ${t.name} configured`);
|
|
75
81
|
installed++;
|