@golproductions/check 1.1.0 → 1.2.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.
- package/README.md +98 -0
- package/package.json +8 -4
- package/src/index.js +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Check — Command Firewall for AI Agents
|
|
2
|
+
|
|
3
|
+
**152 failed commands without Check. 1 with it.** [Read the case study →](https://www.golproductions.com/blog/check-if-url-is-reachable-without-visiting.html)
|
|
4
|
+
|
|
5
|
+
Check validates every shell command before execution. It catches wrong flags, missing binaries, bad syntax, and unreachable targets — before your AI agent wastes inference retrying them.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
### Claude Code
|
|
10
|
+
|
|
11
|
+
Add to `.claude/settings.json`:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"hooks": {
|
|
16
|
+
"PreToolUse": [{
|
|
17
|
+
"matcher": "Bash|PowerShell",
|
|
18
|
+
"hooks": [{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "npx",
|
|
21
|
+
"args": ["@golproductions/check"]
|
|
22
|
+
}]
|
|
23
|
+
}]
|
|
24
|
+
},
|
|
25
|
+
"env": { "GOL_CLIENT_ID": "your_key" }
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Gemini CLI / Antigravity
|
|
30
|
+
|
|
31
|
+
Add to `.gemini/settings.json`:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"hooks": {
|
|
36
|
+
"BeforeTool": [{
|
|
37
|
+
"type": "command",
|
|
38
|
+
"command": "npx @golproductions/check",
|
|
39
|
+
"matcher": ".*",
|
|
40
|
+
"timeout": 5000
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Set `GOL_CLIENT_ID` in your shell environment.
|
|
47
|
+
|
|
48
|
+
### Cursor
|
|
49
|
+
|
|
50
|
+
Add to `.cursor/hooks.json`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"version": 1,
|
|
55
|
+
"hooks": {
|
|
56
|
+
"beforeShellExecution": [{
|
|
57
|
+
"command": "npx @golproductions/check"
|
|
58
|
+
}]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Set `GOL_CLIENT_ID` in your shell environment.
|
|
64
|
+
|
|
65
|
+
## What it does
|
|
66
|
+
|
|
67
|
+
- **Missing binaries** — `gh`, `python3`, `cargo` not installed? Blocked locally, zero API cost.
|
|
68
|
+
- **Wrong flags** — `--yes`, `--namespace-id` on commands that don't accept them.
|
|
69
|
+
- **Bad syntax** — unmatched quotes, trailing backslashes, malformed heredocs.
|
|
70
|
+
- **Unreachable targets** — DNS failures, domains that don't resolve.
|
|
71
|
+
|
|
72
|
+
Each blocked command is a retry that never happens. Each avoided retry is inference cost you keep.
|
|
73
|
+
|
|
74
|
+
## How it works
|
|
75
|
+
|
|
76
|
+
Check reads the command from stdin (passed by the hook system), validates the binary locally, then validates syntax and targets via the Check API. Returns `allow` or `deny` in the format the platform expects. Sub-100ms.
|
|
77
|
+
|
|
78
|
+
## Pricing
|
|
79
|
+
|
|
80
|
+
$0.0068 AUD per check. 80 free checks on signup. Credits never expire.
|
|
81
|
+
|
|
82
|
+
Get your free API key at [golproductions.com/check.html](https://www.golproductions.com/check.html)
|
|
83
|
+
|
|
84
|
+
## Links
|
|
85
|
+
|
|
86
|
+
- [Documentation](https://www.golproductions.com/docs-triage-gate.html)
|
|
87
|
+
- [Pricing](https://www.golproductions.com/pricing.html)
|
|
88
|
+
- [Case study: 152 vs 1](https://www.golproductions.com/blog/check-if-url-is-reachable-without-visiting.html)
|
|
89
|
+
- [VS Code extension](https://open-vsx.org/extension/golproductions/gol-check)
|
|
90
|
+
- [FAQ](https://www.golproductions.com/faq.html)
|
|
91
|
+
|
|
92
|
+
## Also available as
|
|
93
|
+
|
|
94
|
+
- **CLI** — `curl check.golproductions.com | sh`
|
|
95
|
+
- **VS Code** — `ext install golproductions.gol-check`
|
|
96
|
+
- **Direct API** — `POST https://triage.golproductions.com/preflight`
|
|
97
|
+
|
|
98
|
+
Copyright (c) 2026 GOL Productions. All rights reserved.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golproductions/check",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Pre-execution firewall hook for AI agents. Validates every command before it reaches the shell. Supports Claude Code, Gemini CLI, Antigravity, and
|
|
3
|
+
"version": "1.2.0",
|
|
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"
|
|
7
7
|
},
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"src/",
|
|
14
|
-
"LICENSE"
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.md"
|
|
15
16
|
],
|
|
16
17
|
"keywords": [
|
|
17
18
|
"claude-code",
|
|
@@ -24,7 +25,10 @@
|
|
|
24
25
|
"beforeshellexecution",
|
|
25
26
|
"command-validation",
|
|
26
27
|
"firewall",
|
|
27
|
-
"ai-agents"
|
|
28
|
+
"ai-agents",
|
|
29
|
+
"vscode",
|
|
30
|
+
"openvsx",
|
|
31
|
+
"windsurf"
|
|
28
32
|
],
|
|
29
33
|
"license": "SEE LICENSE IN LICENSE",
|
|
30
34
|
"repository": {
|
package/src/index.js
CHANGED
|
@@ -3,11 +3,94 @@
|
|
|
3
3
|
|
|
4
4
|
import { execFileSync } from "node:child_process";
|
|
5
5
|
|
|
6
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { homedir } from "node:os";
|
|
9
|
+
|
|
6
10
|
const API = "https://triage.golproductions.com/preflight";
|
|
7
11
|
const CLIENT_ID = process.env.GOL_CLIENT_ID || "";
|
|
8
12
|
const TIMEOUT_MS = 5000;
|
|
9
13
|
const IS_WIN = process.platform === "win32";
|
|
10
14
|
|
|
15
|
+
function install() {
|
|
16
|
+
const key = process.argv[3] || process.env.GOL_CLIENT_ID || "your_key";
|
|
17
|
+
const home = homedir();
|
|
18
|
+
let installed = 0;
|
|
19
|
+
|
|
20
|
+
const targets = [
|
|
21
|
+
{
|
|
22
|
+
name: "Claude Code",
|
|
23
|
+
dir: join(home, ".claude"),
|
|
24
|
+
file: "settings.json",
|
|
25
|
+
config: (existing) => {
|
|
26
|
+
existing.hooks = existing.hooks || {};
|
|
27
|
+
existing.hooks.PreToolUse = [{
|
|
28
|
+
matcher: "Bash|PowerShell",
|
|
29
|
+
hooks: [{ type: "command", command: "npx", args: ["@golproductions/check"] }]
|
|
30
|
+
}];
|
|
31
|
+
existing.env = existing.env || {};
|
|
32
|
+
existing.env.GOL_CLIENT_ID = key;
|
|
33
|
+
return existing;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "Gemini CLI / Antigravity",
|
|
38
|
+
dir: join(home, ".gemini"),
|
|
39
|
+
file: "settings.json",
|
|
40
|
+
config: (existing) => {
|
|
41
|
+
existing.hooks = existing.hooks || {};
|
|
42
|
+
existing.hooks.BeforeTool = [{
|
|
43
|
+
type: "command",
|
|
44
|
+
command: "npx @golproductions/check",
|
|
45
|
+
matcher: ".*",
|
|
46
|
+
timeout: 5000
|
|
47
|
+
}];
|
|
48
|
+
return existing;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "Cursor",
|
|
53
|
+
dir: join(home, ".cursor"),
|
|
54
|
+
file: "hooks.json",
|
|
55
|
+
config: (existing) => {
|
|
56
|
+
existing.version = existing.version || 1;
|
|
57
|
+
existing.hooks = existing.hooks || {};
|
|
58
|
+
existing.hooks.beforeShellExecution = [{
|
|
59
|
+
command: "npx @golproductions/check"
|
|
60
|
+
}];
|
|
61
|
+
return existing;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
for (const t of targets) {
|
|
67
|
+
if (!existsSync(t.dir)) continue;
|
|
68
|
+
const filepath = join(t.dir, t.file);
|
|
69
|
+
let existing = {};
|
|
70
|
+
try { existing = JSON.parse(readFileSync(filepath, "utf8")); } catch {}
|
|
71
|
+
const updated = t.config(existing);
|
|
72
|
+
mkdirSync(t.dir, { recursive: true });
|
|
73
|
+
writeFileSync(filepath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
74
|
+
console.log(`✓ ${t.name} — ${filepath}`);
|
|
75
|
+
installed++;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (installed === 0) {
|
|
79
|
+
console.log("No IDE config directories found (~/.claude, ~/.gemini, ~/.cursor).");
|
|
80
|
+
console.log("Start your IDE first, then run: npx @golproductions/check --install");
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
console.log(`\n${installed} IDE(s) configured. Restart your IDE to activate Check.`);
|
|
85
|
+
if (key === "your_key") {
|
|
86
|
+
console.log("Set your key: export GOL_CLIENT_ID=your_key");
|
|
87
|
+
console.log("Get a free key at https://www.golproductions.com/check.html");
|
|
88
|
+
}
|
|
89
|
+
process.exit(0);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (process.argv.includes("--install")) { install(); }
|
|
93
|
+
|
|
11
94
|
const SKIP = new Set(["cd", "ls", "dir", "pwd", "echo", "cat", "head", "tail", "wc", "mkdir", "test", "true", "false", "exit"]);
|
|
12
95
|
const PREFIXES = new Set(["sudo", "nohup", "nice", "time", "timeout", "env"]);
|
|
13
96
|
|