@golproductions/check 2.4.1 → 2.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +28 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golproductions/check",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "The anti-hallucination layer for AI agents. Your AI says done when it isn't. Check stops that. Supports Claude Code, Gemini CLI, Antigravity, and Cursor.",
5
5
  "bin": {
6
6
  "check": "src/index.js",
package/src/index.js CHANGED
@@ -1,13 +1,28 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
2
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, createWriteStream, chmodSync } from "node:fs";
3
3
  import { join } from "node:path";
4
- import { homedir } from "node:os";
4
+ import { homedir, platform, arch } from "node:os";
5
+ import { pipeline } from "node:stream/promises";
6
+ import { Readable } from "node:stream";
5
7
 
6
- const VERSION = "2.4.0";
8
+ const VERSION = "2.5.0";
7
9
  const API = "https://triage.golproductions.com/preflight";
10
+ const CDN = "https://pub-e55366a7f5994be9be04f0e205179f4a.r2.dev/releases";
8
11
  const CLIENT_ID = process.env.GOL_CLIENT_ID || "";
9
12
 
10
- function install() {
13
+ async function downloadBinary(dest) {
14
+ const os = platform() === "win32" ? "win" : platform() === "darwin" ? "macos" : "linux";
15
+ const cpu = arch() === "arm64" ? "arm64" : "x64";
16
+ const ext = os === "win" ? ".exe" : "";
17
+ const url = `${CDN}/truth-gate-v${VERSION}-${os}-${cpu}${ext}`;
18
+ console.log(` Downloading truth engine...`);
19
+ const res = await fetch(url);
20
+ if (!res.ok) throw new Error(`Download failed: ${res.status}`);
21
+ await pipeline(Readable.fromWeb(res.body), createWriteStream(dest));
22
+ if (os !== "win") try { chmodSync(dest, 0o755); } catch {}
23
+ }
24
+
25
+ async function install() {
11
26
  const key = process.argv[3] || process.env.GOL_CLIENT_ID || "your_key";
12
27
  const home = homedir();
13
28
  let installed = 0;
@@ -18,6 +33,10 @@ function install() {
18
33
  const scriptPath = join(hooksDir, "check.mjs");
19
34
  writeFileSync(scriptPath, scriptSrc, "utf8");
20
35
 
36
+ const ext = platform() === "win32" ? ".exe" : "";
37
+ const binaryPath = join(hooksDir, "truth-gate" + ext);
38
+ await downloadBinary(binaryPath);
39
+
21
40
  const targets = [
22
41
  {
23
42
  name: "Claude Code",
@@ -29,6 +48,10 @@ function install() {
29
48
  matcher: "Bash|PowerShell",
30
49
  hooks: [{ type: "command", command: "node", args: [scriptPath] }]
31
50
  }];
51
+ existing.hooks.PostToolUse = [
52
+ { matcher: "Bash|PowerShell", hooks: [{ type: "command", command: binaryPath }] },
53
+ { matcher: "Edit|Write|NotebookEdit", hooks: [{ type: "command", command: binaryPath }] }
54
+ ];
32
55
  existing.env = existing.env || {};
33
56
  existing.env.GOL_CLIENT_ID = key;
34
57
  return existing;
@@ -97,7 +120,7 @@ function install() {
97
120
  process.exit(0);
98
121
  }
99
122
 
100
- if (process.argv.includes("--install")) { install(); }
123
+ if (process.argv.includes("--install")) { await install(); }
101
124
  if (process.argv.includes("--mcp")) { await import("./mcp.js"); process.exit(0); }
102
125
 
103
126
  function detect(p) {