@golproductions/check 3.0.6 → 3.0.7
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 +44 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golproductions/check",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Anti-hallucination firewall for AI agents. Validates commands, imports, and function calls before execution. Supports Claude Code, Cursor, Gemini CLI, Windsurf, JetBrains, Neovim, Emacs, Sublime Text, Zed, and any MCP client.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"check": "src/index.js",
|
package/src/index.js
CHANGED
|
@@ -5,12 +5,30 @@ import { homedir, platform, arch } from "node:os";
|
|
|
5
5
|
import { pipeline } from "node:stream/promises";
|
|
6
6
|
import { Readable } from "node:stream";
|
|
7
7
|
|
|
8
|
-
const VERSION = "3.0.
|
|
8
|
+
const VERSION = "3.0.7";
|
|
9
9
|
const BINARY_VERSION = "3.0.0";
|
|
10
10
|
const API = "https://triage.golproductions.com/preflight";
|
|
11
11
|
const CDN = "https://pub-e55366a7f5994be9be04f0e205179f4a.r2.dev/releases";
|
|
12
12
|
const CLIENT_ID = process.env.GOL_CLIENT_ID || "";
|
|
13
13
|
|
|
14
|
+
async function validateKey(key) {
|
|
15
|
+
try {
|
|
16
|
+
const res = await fetch(API, {
|
|
17
|
+
method: "POST",
|
|
18
|
+
headers: { "Content-Type": "application/json", "X-GOL-CLIENT-ID": key, "User-Agent": "c/" + VERSION },
|
|
19
|
+
body: JSON.stringify({ command: "echo check-install-verify", cwd: process.cwd(), v: VERSION }),
|
|
20
|
+
signal: AbortSignal.timeout(10000),
|
|
21
|
+
});
|
|
22
|
+
if (res.ok) return { valid: true, expired: false };
|
|
23
|
+
let body = {};
|
|
24
|
+
try { body = await res.json(); } catch {}
|
|
25
|
+
const expired = /expir/i.test(body.reason || body.error || body.message || "");
|
|
26
|
+
return { valid: false, expired };
|
|
27
|
+
} catch {
|
|
28
|
+
return { valid: false, expired: false };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
14
32
|
async function downloadBinary(dest) {
|
|
15
33
|
const os = platform() === "win32" ? "win" : platform() === "darwin" ? "macos" : "linux";
|
|
16
34
|
const cpu = arch() === "arm64" ? "arm64" : "x64";
|
|
@@ -23,7 +41,30 @@ async function downloadBinary(dest) {
|
|
|
23
41
|
}
|
|
24
42
|
|
|
25
43
|
async function install() {
|
|
26
|
-
const key = process.argv[3] || process.env.GOL_CLIENT_ID || "
|
|
44
|
+
const key = process.argv[3] || process.env.GOL_CLIENT_ID || "";
|
|
45
|
+
|
|
46
|
+
if (!key || key === "your_key") {
|
|
47
|
+
console.log("\n Check requires a valid Client ID to install.\n");
|
|
48
|
+
console.log(" Get your key (free): https://golproductions.com/check\n");
|
|
49
|
+
console.log(" Then run:");
|
|
50
|
+
console.log(" npx @golproductions/check --install YOUR_KEY\n");
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const result = await validateKey(key);
|
|
55
|
+
if (!result.valid) {
|
|
56
|
+
if (result.expired) {
|
|
57
|
+
console.log("\n Your Client ID has expired: " + key);
|
|
58
|
+
console.log("\n Renew your key at: https://golproductions.com/check\n");
|
|
59
|
+
} else {
|
|
60
|
+
console.log("\n Invalid Client ID: " + key);
|
|
61
|
+
console.log("\n Get a valid key at: https://golproductions.com/check\n");
|
|
62
|
+
}
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log("\n Key verified. Installing Check...\n");
|
|
67
|
+
|
|
27
68
|
const home = homedir();
|
|
28
69
|
let installed = 0;
|
|
29
70
|
|
|
@@ -249,7 +290,7 @@ async function main() {
|
|
|
249
290
|
f = detect(p);
|
|
250
291
|
const c = cmd(p, f);
|
|
251
292
|
if (!c) { out(f, true); return; }
|
|
252
|
-
if (!CLIENT_ID) { process.stderr.write("check: GOL_CLIENT_ID not set. Get your key at https://
|
|
293
|
+
if (!CLIENT_ID) { process.stderr.write("check: GOL_CLIENT_ID not set. Get your key at https://golproductions.com/check\n"); out(f, true); return; }
|
|
253
294
|
const controller = new AbortController();
|
|
254
295
|
const timer = setTimeout(() => controller.abort(), 5000);
|
|
255
296
|
const res = await fetch(API, {
|