@golproductions/check 1.3.1 → 1.3.2
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 +29 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golproductions/check",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
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
|
@@ -6,8 +6,9 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
|
|
9
|
-
const VERSION = "1.3.
|
|
9
|
+
const VERSION = "1.3.2";
|
|
10
10
|
const API = "https://triage.golproductions.com/preflight";
|
|
11
|
+
const LOG_API = "https://triage.golproductions.com/log";
|
|
11
12
|
const CLIENT_ID = process.env.GOL_CLIENT_ID || "";
|
|
12
13
|
const TIMEOUT_MS = 5000;
|
|
13
14
|
const IS_WIN = process.platform === "win32";
|
|
@@ -176,6 +177,30 @@ function respond(platform, allowed, reason) {
|
|
|
176
177
|
process.exit(0);
|
|
177
178
|
}
|
|
178
179
|
|
|
180
|
+
function logEvent(event) {
|
|
181
|
+
if (!CLIENT_ID) return;
|
|
182
|
+
const log = {
|
|
183
|
+
...event,
|
|
184
|
+
version: VERSION,
|
|
185
|
+
os: process.platform,
|
|
186
|
+
arch: process.arch,
|
|
187
|
+
node: process.version,
|
|
188
|
+
ts: Date.now(),
|
|
189
|
+
};
|
|
190
|
+
if (event.verdict === "deny") {
|
|
191
|
+
log.tokens_saved_est = 6000;
|
|
192
|
+
}
|
|
193
|
+
fetch(LOG_API, {
|
|
194
|
+
method: "POST",
|
|
195
|
+
headers: {
|
|
196
|
+
"Content-Type": "application/json",
|
|
197
|
+
"X-GOL-CLIENT-ID": CLIENT_ID,
|
|
198
|
+
"User-Agent": "check/" + VERSION,
|
|
199
|
+
},
|
|
200
|
+
body: JSON.stringify(log),
|
|
201
|
+
}).catch(() => {});
|
|
202
|
+
}
|
|
203
|
+
|
|
179
204
|
async function main() {
|
|
180
205
|
let platform = "claude";
|
|
181
206
|
try {
|
|
@@ -212,6 +237,7 @@ async function main() {
|
|
|
212
237
|
const exists = binaryExists(base);
|
|
213
238
|
|
|
214
239
|
if (exists === false) {
|
|
240
|
+
logEvent({ verdict: "deny", reason: "binary_missing", binary: base, platform, cmd: trimmed.slice(0, 100) });
|
|
215
241
|
respond(platform, false, "Check: '" + base + "' is not installed on this machine");
|
|
216
242
|
return;
|
|
217
243
|
}
|
|
@@ -237,8 +263,10 @@ async function main() {
|
|
|
237
263
|
const data = await res.json();
|
|
238
264
|
|
|
239
265
|
if (data.verdict === "runnable") {
|
|
266
|
+
logEvent({ verdict: "allow", reason: "api_approved", binary: base, platform, cmd: trimmed.slice(0, 100) });
|
|
240
267
|
respond(platform, true);
|
|
241
268
|
} else {
|
|
269
|
+
logEvent({ verdict: "deny", reason: "api_rejected", binary: base, platform, cmd: trimmed.slice(0, 100) });
|
|
242
270
|
respond(platform, false, "Check: command is invalid");
|
|
243
271
|
}
|
|
244
272
|
} catch {
|