@golproductions/check 1.2.3 → 1.3.1
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 +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golproductions/check",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
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;
|
|
@@ -97,6 +97,8 @@ if (process.argv.includes("--install")) { install(); }
|
|
|
97
97
|
|
|
98
98
|
const SKIP = new Set(["cd", "ls", "dir", "pwd", "echo", "cat", "head", "tail", "wc", "mkdir", "test", "true", "false", "exit"]);
|
|
99
99
|
const PREFIXES = new Set(["sudo", "nohup", "nice", "time", "timeout", "env"]);
|
|
100
|
+
const PS_KEYWORDS = new Set(["try", "catch", "finally", "if", "else", "elseif", "foreach", "for", "while", "do", "switch", "throw", "return", "begin", "process", "end", "function", "class", "param", "trap", "break", "continue"]);
|
|
101
|
+
const PS_VERB_PREFIXES = ["Get-", "Set-", "New-", "Remove-", "Invoke-", "Start-", "Stop-", "Write-", "Read-", "Out-", "Test-", "Add-", "Clear-", "Copy-", "Move-", "Select-", "Where-", "ForEach-", "Sort-", "Group-", "Measure-", "Compare-", "Join-", "Split-", "ConvertTo-", "ConvertFrom-", "Export-", "Import-", "Enable-", "Disable-", "Register-", "Unregister-", "Wait-", "Enter-", "Exit-", "Push-", "Pop-", "Rename-", "Resolve-", "Update-", "Find-", "Format-"];
|
|
100
102
|
|
|
101
103
|
function detectPlatform(parsed) {
|
|
102
104
|
if (typeof parsed.command === "string" && !parsed.tool_input) return "cursor";
|
|
@@ -179,6 +181,7 @@ async function main() {
|
|
|
179
181
|
try {
|
|
180
182
|
let input = "";
|
|
181
183
|
for await (const chunk of process.stdin) input += chunk;
|
|
184
|
+
input = input.replace(/^/, "").trim();
|
|
182
185
|
|
|
183
186
|
let parsed;
|
|
184
187
|
try { parsed = JSON.parse(input); } catch { respond("claude", true); return; }
|
|
@@ -187,12 +190,17 @@ async function main() {
|
|
|
187
190
|
const command = extractCommand(parsed, platform);
|
|
188
191
|
if (!command) { respond(platform, true); return; }
|
|
189
192
|
|
|
190
|
-
const toolName = parsed.tool_name;
|
|
191
193
|
const trimmed = command.trim();
|
|
192
194
|
const first = trimmed.split(/\s+/)[0];
|
|
193
195
|
|
|
194
196
|
if (SKIP.has(first)) { respond(platform, true); return; }
|
|
195
|
-
|
|
197
|
+
|
|
198
|
+
const toolName = parsed.tool_name;
|
|
199
|
+
if (toolName === "PowerShell") {
|
|
200
|
+
if (first.startsWith("$") || first.startsWith("(") || first.startsWith("[") || first.startsWith("@")) { respond(platform, true); return; }
|
|
201
|
+
if (PS_KEYWORDS.has(first)) { respond(platform, true); return; }
|
|
202
|
+
if (PS_VERB_PREFIXES.some(p => first.startsWith(p))) { respond(platform, true); return; }
|
|
203
|
+
}
|
|
196
204
|
|
|
197
205
|
if (!CLIENT_ID) {
|
|
198
206
|
process.stderr.write("check: GOL_CLIENT_ID not set. Get your key at https://www.golproductions.com/check.html\n");
|
|
@@ -219,7 +227,7 @@ async function main() {
|
|
|
219
227
|
headers: {
|
|
220
228
|
"Content-Type": "application/json",
|
|
221
229
|
"X-GOL-CLIENT-ID": CLIENT_ID,
|
|
222
|
-
"User-Agent": "check/
|
|
230
|
+
"User-Agent": "check/" + VERSION,
|
|
223
231
|
},
|
|
224
232
|
body: JSON.stringify(payload),
|
|
225
233
|
signal: controller.signal,
|