claude-warden 1.5.2 → 1.5.3

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.5.2",
3
+ "version": "1.5.3",
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
@@ -18143,6 +18143,53 @@ function preprocessCatHeredocs(input) {
18143
18143
  const regex = /\$\(cat\s+<<-?\s*['"]?(\w+)['"]?\n([\s\S]*?)\n\1\s*\)/g;
18144
18144
  return input.replace(regex, "__HEREDOC_TEXT__");
18145
18145
  }
18146
+ function preprocessPathParentheses(input) {
18147
+ const result = [];
18148
+ let i = 0;
18149
+ while (i < input.length) {
18150
+ const ch = input[i];
18151
+ if (ch === '"' || ch === "'") {
18152
+ const quote = ch;
18153
+ let j = i + 1;
18154
+ while (j < input.length && input[j] !== quote) {
18155
+ if (input[j] === "\\" && quote === '"') j++;
18156
+ j++;
18157
+ }
18158
+ result.push(input.slice(i, j + 1));
18159
+ i = j + 1;
18160
+ continue;
18161
+ }
18162
+ if (ch === "$" && i + 1 < input.length && input[i + 1] === "(") {
18163
+ let depth = 1;
18164
+ let j = i + 2;
18165
+ while (j < input.length && depth > 0) {
18166
+ if (input[j] === "(") depth++;
18167
+ else if (input[j] === ")") depth--;
18168
+ if (depth > 0) j++;
18169
+ }
18170
+ result.push(input.slice(i, j + 1));
18171
+ i = j + 1;
18172
+ continue;
18173
+ }
18174
+ if (ch !== " " && ch !== " " && ch !== "\n") {
18175
+ let j = i;
18176
+ while (j < input.length && !" \n".includes(input[j]) && input[j] !== '"' && input[j] !== "'" && !(input[j] === "$" && j + 1 < input.length && input[j + 1] === "(")) {
18177
+ j++;
18178
+ }
18179
+ const token = input.slice(i, j);
18180
+ if (token.includes("/") && /[()]/.test(token) && !/^[<>|;&]/.test(token)) {
18181
+ result.push('"' + token + '"');
18182
+ } else {
18183
+ result.push(token);
18184
+ }
18185
+ i = j;
18186
+ continue;
18187
+ }
18188
+ result.push(ch);
18189
+ i++;
18190
+ }
18191
+ return result.join("");
18192
+ }
18146
18193
  function convertCommand(node) {
18147
18194
  if (!node.name) return null;
18148
18195
  const originalCommand = node.name.text;
@@ -18290,6 +18337,7 @@ function parseCommand(input) {
18290
18337
  return { commands: [], hasSubshell: false, subshellCommands: [], parseError: false };
18291
18338
  }
18292
18339
  input = preprocessCatHeredocs(input);
18340
+ input = preprocessPathParentheses(input);
18293
18341
  try {
18294
18342
  const ast = (0, import_bash_parser.default)(input);
18295
18343
  const result = { commands: [], hasSubshell: false, subshellCommands: [] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-warden",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
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",