claude-warden 1.8.0 → 1.8.2

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-warden",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "Smart command safety filter for Claude Code — parses shell pipelines and evaluates per-command safety rules to auto-approve safe commands and block dangerous ones",
5
5
  "author": {
6
6
  "name": "banyudu"
package/dist/index.cjs CHANGED
@@ -18379,9 +18379,80 @@ function parseCommand(input) {
18379
18379
  return { commands: [], hasSubshell: true, subshellCommands: [], parseError: true };
18380
18380
  }
18381
18381
  }
18382
+ const fallback = regexFallbackParse(input);
18383
+ if (fallback) {
18384
+ return { commands: [fallback], hasSubshell: false, subshellCommands: [], parseError: false };
18385
+ }
18382
18386
  return { commands: [], hasSubshell: false, subshellCommands: [], parseError: true };
18383
18387
  }
18384
18388
  }
18389
+ function regexFallbackParse(input) {
18390
+ const trimmed = input.trim();
18391
+ if (!trimmed) return null;
18392
+ let inSingle = false;
18393
+ let inDouble = false;
18394
+ for (let i = 0; i < trimmed.length; i++) {
18395
+ const ch = trimmed[i];
18396
+ if (ch === "\\" && inDouble) {
18397
+ i++;
18398
+ continue;
18399
+ }
18400
+ if (ch === "'" && !inDouble) {
18401
+ inSingle = !inSingle;
18402
+ continue;
18403
+ }
18404
+ if (ch === '"' && !inSingle) {
18405
+ inDouble = !inDouble;
18406
+ continue;
18407
+ }
18408
+ if (!inSingle && !inDouble && (ch === "|" || ch === ";" || ch === "&" && trimmed[i + 1] === "&")) {
18409
+ return null;
18410
+ }
18411
+ }
18412
+ const envPrefixes = [];
18413
+ let rest = trimmed;
18414
+ while (/^[A-Za-z_][A-Za-z0-9_]*=/.test(rest)) {
18415
+ const match = rest.match(/^([A-Za-z_][A-Za-z0-9_]*=\S*)\s*/);
18416
+ if (!match) break;
18417
+ envPrefixes.push(match[1]);
18418
+ rest = rest.slice(match[0].length);
18419
+ }
18420
+ if (!rest) return null;
18421
+ const cmdMatch = rest.match(/^(\S+)/);
18422
+ if (!cmdMatch) return null;
18423
+ const originalCommand = cmdMatch[1];
18424
+ const command = originalCommand.includes("/") ? (0, import_path.basename)(originalCommand) : originalCommand;
18425
+ const argsStr = rest.slice(cmdMatch[0].length).trim();
18426
+ const args2 = [];
18427
+ let current = "";
18428
+ let qSingle = false;
18429
+ let qDouble = false;
18430
+ for (let i = 0; i < argsStr.length; i++) {
18431
+ const ch = argsStr[i];
18432
+ if (ch === "\\" && qDouble && i + 1 < argsStr.length) {
18433
+ current += argsStr[++i];
18434
+ continue;
18435
+ }
18436
+ if (ch === "'" && !qDouble) {
18437
+ qSingle = !qSingle;
18438
+ continue;
18439
+ }
18440
+ if (ch === '"' && !qSingle) {
18441
+ qDouble = !qDouble;
18442
+ continue;
18443
+ }
18444
+ if (!qSingle && !qDouble && /\s/.test(ch)) {
18445
+ if (current) {
18446
+ args2.push(current);
18447
+ current = "";
18448
+ }
18449
+ continue;
18450
+ }
18451
+ current += ch;
18452
+ }
18453
+ if (current) args2.push(current);
18454
+ return { command, originalCommand, args: args2, envPrefixes, raw: trimmed };
18455
+ }
18385
18456
 
18386
18457
  // src/evaluator.ts
18387
18458
  var import_os = require("os");
@@ -19131,7 +19202,8 @@ var SAFE_DEV_TOOLS = [
19131
19202
  "wrangler",
19132
19203
  "netlify",
19133
19204
  "vercel",
19134
- "json"
19205
+ "json",
19206
+ "biome"
19135
19207
  ];
19136
19208
  var SCRIPT_RUNNERS = ["tsx", "ts-node", "nodemon"];
19137
19209
  var REGISTRY_OPS = ["publish", "unpublish", "deprecate", "owner", "access", "token", "adduser", "login", "logout"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-warden",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "Smart command safety filter for Claude Code — auto-approves safe commands, blocks dangerous ones",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",