@golproductions/check 3.0.4 → 3.0.5
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 +8 -2
- package/src/index.js +84 -22
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golproductions/check",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "The anti-hallucination
|
|
3
|
+
"version": "3.0.5",
|
|
4
|
+
"description": "The anti-hallucination firewall for AI agents. Supports Claude Code, Cursor, Gemini CLI, Windsurf, Amazon Q, Continue, Roo Code, and more.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"check": "src/index.js",
|
|
7
7
|
"check-mcp": "src/mcp.js"
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"cursor",
|
|
33
33
|
"antigravity",
|
|
34
34
|
"windsurf",
|
|
35
|
+
"devin-desktop",
|
|
36
|
+
"gemini-cli",
|
|
37
|
+
"amazon-q",
|
|
38
|
+
"continue-dev",
|
|
39
|
+
"roo-code",
|
|
40
|
+
"cline",
|
|
35
41
|
"ai-guardrails",
|
|
36
42
|
"llm-validation",
|
|
37
43
|
"mcp",
|
package/src/index.js
CHANGED
|
@@ -37,6 +37,8 @@ async function install() {
|
|
|
37
37
|
const binaryPath = join(hooksDir, "truth-gate" + ext);
|
|
38
38
|
await downloadBinary(binaryPath);
|
|
39
39
|
|
|
40
|
+
const mcpEntry = { command: "npx", args: ["@golproductions/check", "--mcp"], env: { GOL_CLIENT_ID: key } };
|
|
41
|
+
|
|
40
42
|
const targets = [
|
|
41
43
|
{
|
|
42
44
|
name: "Claude Code",
|
|
@@ -58,17 +60,19 @@ async function install() {
|
|
|
58
60
|
}
|
|
59
61
|
},
|
|
60
62
|
{
|
|
61
|
-
name: "Antigravity
|
|
62
|
-
dir: join(home, ".gemini"
|
|
63
|
-
file: "
|
|
63
|
+
name: "Gemini CLI / Antigravity",
|
|
64
|
+
dir: join(home, ".gemini"),
|
|
65
|
+
file: "settings.json",
|
|
64
66
|
config: (existing) => {
|
|
65
|
-
existing
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
existing.hooks = existing.hooks || {};
|
|
68
|
+
existing.hooks.BeforeTool = existing.hooks.BeforeTool || [];
|
|
69
|
+
const hooks = existing.hooks.BeforeTool;
|
|
70
|
+
if (!hooks.find(h => h.hooks?.some(hh => hh.name === "check-gate"))) {
|
|
71
|
+
hooks.push({
|
|
72
|
+
matcher: ".*",
|
|
73
|
+
hooks: [{ type: "command", command: "node " + scriptPath, name: "check-gate" }]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
72
76
|
return existing;
|
|
73
77
|
}
|
|
74
78
|
},
|
|
@@ -102,12 +106,64 @@ async function install() {
|
|
|
102
106
|
existing.env.GOL_CLIENT_ID = key;
|
|
103
107
|
return existing;
|
|
104
108
|
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "Windsurf (MCP)",
|
|
112
|
+
dir: join(home, ".codeium", "windsurf"),
|
|
113
|
+
file: "mcp_config.json",
|
|
114
|
+
config: (existing) => {
|
|
115
|
+
existing.mcpServers = existing.mcpServers || {};
|
|
116
|
+
existing.mcpServers.Check = mcpEntry;
|
|
117
|
+
return existing;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "Continue (MCP)",
|
|
122
|
+
dir: join(process.cwd(), ".continue", "mcpServers"),
|
|
123
|
+
file: "check.json",
|
|
124
|
+
config: () => {
|
|
125
|
+
return { mcpServers: { Check: mcpEntry } };
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "Amazon Q Developer (MCP)",
|
|
130
|
+
dir: join(home, ".aws", "amazonq"),
|
|
131
|
+
file: "mcp.json",
|
|
132
|
+
config: (existing) => {
|
|
133
|
+
existing.mcpServers = existing.mcpServers || {};
|
|
134
|
+
existing.mcpServers.Check = { type: "stdio", ...mcpEntry };
|
|
135
|
+
return existing;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "Roo Code (project MCP)",
|
|
140
|
+
dir: join(process.cwd(), ".roo"),
|
|
141
|
+
file: "mcp.json",
|
|
142
|
+
config: (existing) => {
|
|
143
|
+
existing.mcpServers = existing.mcpServers || {};
|
|
144
|
+
existing.mcpServers.Check = mcpEntry;
|
|
145
|
+
return existing;
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "Project MCP (shared)",
|
|
150
|
+
dir: process.cwd(),
|
|
151
|
+
file: ".mcp.json",
|
|
152
|
+
config: (existing) => {
|
|
153
|
+
existing.mcpServers = existing.mcpServers || {};
|
|
154
|
+
existing.mcpServers.Check = mcpEntry;
|
|
155
|
+
return existing;
|
|
156
|
+
}
|
|
105
157
|
}
|
|
106
158
|
];
|
|
107
159
|
|
|
160
|
+
const mcpTargets = ["Windsurf (MCP)", "Continue (MCP)", "Amazon Q Developer (MCP)", "Roo Code (project MCP)", "Project MCP (shared)"];
|
|
161
|
+
|
|
108
162
|
let hasClaude = false;
|
|
109
163
|
for (const t of targets) {
|
|
110
|
-
|
|
164
|
+
const isMcp = mcpTargets.includes(t.name);
|
|
165
|
+
if (!isMcp && !existsSync(t.dir)) continue;
|
|
166
|
+
if (isMcp) mkdirSync(t.dir, { recursive: true });
|
|
111
167
|
const filepath = join(t.dir, t.file);
|
|
112
168
|
let existing = {};
|
|
113
169
|
try { existing = JSON.parse(readFileSync(filepath, "utf8")); } catch {}
|
|
@@ -147,31 +203,37 @@ if (process.argv.includes("--mcp")) { await import("./mcp.js"); process.exit(0);
|
|
|
147
203
|
|
|
148
204
|
function detect(p) {
|
|
149
205
|
if (typeof p.command === "string" && !p.tool_input) return "cursor";
|
|
150
|
-
if (p.hook_event_name === "BeforeTool") return "gemini";
|
|
151
|
-
if (p.toolCall?.argumentsJson) return "antigravity";
|
|
206
|
+
if (p.hook_event_name === "BeforeTool" || p.toolCall?.argumentsJson) return "gemini";
|
|
152
207
|
return "claude";
|
|
153
208
|
}
|
|
154
209
|
|
|
155
210
|
function cmd(p, f) {
|
|
156
211
|
if (f === "cursor") return p.command;
|
|
157
|
-
if (f === "
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
212
|
+
if (f === "gemini") {
|
|
213
|
+
if (p.tool_input?.command) return p.tool_input.command;
|
|
214
|
+
if (p.toolCall?.argumentsJson) {
|
|
215
|
+
try {
|
|
216
|
+
const a = typeof p.toolCall.argumentsJson === "string" ? JSON.parse(p.toolCall.argumentsJson) : p.toolCall.argumentsJson;
|
|
217
|
+
return a.command || a.CommandLine || a.command_line;
|
|
218
|
+
} catch { return null; }
|
|
219
|
+
}
|
|
220
|
+
return null;
|
|
162
221
|
}
|
|
163
222
|
return p.tool_input?.command;
|
|
164
223
|
}
|
|
165
224
|
|
|
166
225
|
function out(f, ok, reason) {
|
|
167
226
|
if (ok) {
|
|
168
|
-
const r = { cursor: { permission: "allow" }, gemini: { decision: "allow" },
|
|
169
|
-
process.stdout.write(JSON.stringify(r[f]));
|
|
227
|
+
const r = { cursor: { permission: "allow" }, gemini: { decision: "allow" }, claude: { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "allow" } } };
|
|
228
|
+
process.stdout.write(JSON.stringify(r[f] || r.claude));
|
|
170
229
|
process.exit(0);
|
|
171
230
|
}
|
|
172
|
-
if (f === "gemini"
|
|
231
|
+
if (f === "gemini") {
|
|
232
|
+
process.stdout.write(JSON.stringify({ decision: "deny", reason }));
|
|
233
|
+
process.exit(2);
|
|
234
|
+
}
|
|
173
235
|
const r = { cursor: { permission: "deny", user_message: reason, agent_message: reason }, claude: { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: reason } } };
|
|
174
|
-
process.stdout.write(JSON.stringify(r[f]));
|
|
236
|
+
process.stdout.write(JSON.stringify(r[f] || r.claude));
|
|
175
237
|
process.exit(0);
|
|
176
238
|
}
|
|
177
239
|
|