@golproductions/check 1.3.2 → 1.3.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 +33 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golproductions/check",
3
- "version": "1.3.2",
3
+ "version": "1.3.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
@@ -6,7 +6,7 @@ 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.2";
9
+ const VERSION = "1.3.3";
10
10
  const API = "https://triage.golproductions.com/preflight";
11
11
  const LOG_API = "https://triage.golproductions.com/log";
12
12
  const CLIENT_ID = process.env.GOL_CLIENT_ID || "";
@@ -209,22 +209,46 @@ async function main() {
209
209
  input = input.replace(/^/, "").trim();
210
210
 
211
211
  let parsed;
212
- try { parsed = JSON.parse(input); } catch { respond("claude", true); return; }
212
+ try { parsed = JSON.parse(input); } catch {
213
+ logEvent({ verdict: "allow", reason: "parse_failed", binary: "", platform, cmd: input.slice(0, 100) });
214
+ respond("claude", true);
215
+ return;
216
+ }
213
217
 
214
218
  platform = detectPlatform(parsed);
215
219
  const command = extractCommand(parsed, platform);
216
- if (!command) { respond(platform, true); return; }
220
+ if (!command) {
221
+ logEvent({ verdict: "allow", reason: "no_command", binary: "", platform, cmd: "" });
222
+ respond(platform, true);
223
+ return;
224
+ }
217
225
 
218
226
  const trimmed = command.trim();
219
227
  const first = trimmed.split(/\s+/)[0];
220
228
 
221
- if (SKIP.has(first)) { respond(platform, true); return; }
229
+ if (SKIP.has(first)) {
230
+ logEvent({ verdict: "allow", reason: "skip_builtin", binary: first, platform, cmd: trimmed.slice(0, 100) });
231
+ respond(platform, true);
232
+ return;
233
+ }
222
234
 
223
235
  const toolName = parsed.tool_name;
224
236
  if (toolName === "PowerShell") {
225
- if (first.startsWith("$") || first.startsWith("(") || first.startsWith("[") || first.startsWith("@")) { respond(platform, true); return; }
226
- if (PS_KEYWORDS.has(first)) { respond(platform, true); return; }
227
- if (PS_VERB_PREFIXES.some(p => first.startsWith(p))) { respond(platform, true); return; }
237
+ if (first.startsWith("$") || first.startsWith("(") || first.startsWith("[") || first.startsWith("@")) {
238
+ logEvent({ verdict: "allow", reason: "ps_syntax", binary: first.slice(0, 30), platform, cmd: trimmed.slice(0, 100) });
239
+ respond(platform, true);
240
+ return;
241
+ }
242
+ if (PS_KEYWORDS.has(first)) {
243
+ logEvent({ verdict: "allow", reason: "ps_keyword", binary: first, platform, cmd: trimmed.slice(0, 100) });
244
+ respond(platform, true);
245
+ return;
246
+ }
247
+ if (PS_VERB_PREFIXES.some(p => first.startsWith(p))) {
248
+ logEvent({ verdict: "allow", reason: "ps_cmdlet", binary: first, platform, cmd: trimmed.slice(0, 100) });
249
+ respond(platform, true);
250
+ return;
251
+ }
228
252
  }
229
253
 
230
254
  if (!CLIENT_ID) {
@@ -269,7 +293,8 @@ async function main() {
269
293
  logEvent({ verdict: "deny", reason: "api_rejected", binary: base, platform, cmd: trimmed.slice(0, 100) });
270
294
  respond(platform, false, "Check: command is invalid");
271
295
  }
272
- } catch {
296
+ } catch (e) {
297
+ logEvent({ verdict: "allow", reason: "error_fallback", binary: "", platform, cmd: String(e).slice(0, 100) });
273
298
  respond(platform, true);
274
299
  }
275
300
  }