@golproductions/check 1.3.0 → 1.3.1
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 +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golproductions/check",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
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
|
@@ -97,6 +97,8 @@ if (process.argv.includes("--install")) { install(); }
|
|
|
97
97
|
|
|
98
98
|
const SKIP = new Set(["cd", "ls", "dir", "pwd", "echo", "cat", "head", "tail", "wc", "mkdir", "test", "true", "false", "exit"]);
|
|
99
99
|
const PREFIXES = new Set(["sudo", "nohup", "nice", "time", "timeout", "env"]);
|
|
100
|
+
const PS_KEYWORDS = new Set(["try", "catch", "finally", "if", "else", "elseif", "foreach", "for", "while", "do", "switch", "throw", "return", "begin", "process", "end", "function", "class", "param", "trap", "break", "continue"]);
|
|
101
|
+
const PS_VERB_PREFIXES = ["Get-", "Set-", "New-", "Remove-", "Invoke-", "Start-", "Stop-", "Write-", "Read-", "Out-", "Test-", "Add-", "Clear-", "Copy-", "Move-", "Select-", "Where-", "ForEach-", "Sort-", "Group-", "Measure-", "Compare-", "Join-", "Split-", "ConvertTo-", "ConvertFrom-", "Export-", "Import-", "Enable-", "Disable-", "Register-", "Unregister-", "Wait-", "Enter-", "Exit-", "Push-", "Pop-", "Rename-", "Resolve-", "Update-", "Find-", "Format-"];
|
|
100
102
|
|
|
101
103
|
function detectPlatform(parsed) {
|
|
102
104
|
if (typeof parsed.command === "string" && !parsed.tool_input) return "cursor";
|
|
@@ -193,6 +195,13 @@ async function main() {
|
|
|
193
195
|
|
|
194
196
|
if (SKIP.has(first)) { respond(platform, true); return; }
|
|
195
197
|
|
|
198
|
+
const toolName = parsed.tool_name;
|
|
199
|
+
if (toolName === "PowerShell") {
|
|
200
|
+
if (first.startsWith("$") || first.startsWith("(") || first.startsWith("[") || first.startsWith("@")) { respond(platform, true); return; }
|
|
201
|
+
if (PS_KEYWORDS.has(first)) { respond(platform, true); return; }
|
|
202
|
+
if (PS_VERB_PREFIXES.some(p => first.startsWith(p))) { respond(platform, true); return; }
|
|
203
|
+
}
|
|
204
|
+
|
|
196
205
|
if (!CLIENT_ID) {
|
|
197
206
|
process.stderr.write("check: GOL_CLIENT_ID not set. Get your key at https://www.golproductions.com/check.html\n");
|
|
198
207
|
respond(platform, true);
|