ccsniff 1.1.14 → 1.1.15

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/cli.js +8 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsniff",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Watch Claude Code JSONL output files and emit structured events as a Node.js EventEmitter",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/cli.js CHANGED
@@ -400,11 +400,15 @@ if (opts['search-discipline']) {
400
400
  }
401
401
  } else if (name === 'Bash') {
402
402
  const cmd = ev.block?.input?.command || '';
403
- if (BASH_SEARCH.test(cmd)) {
403
+ // A search tool fed by a pipe (`<cmd> | grep ...`) is filtering another command's stdout,
404
+ // not searching the codebase tree — codesearch has no equivalent for that and it is not the
405
+ // bypass the rule targets. Flag only a search tool that STARTS a pipeline segment (reads the
406
+ // tree directly), never one immediately downstream of a pipe.
407
+ const isTreeSearchLine = (line) => BASH_SEARCH.test(line.split('|')[0]);
408
+ const hitLine = cmd.split('\n').find(isTreeSearchLine);
409
+ if (hitLine) {
404
410
  kind = 'native-search-bash';
405
- // show the line that actually invokes the search tool, not line 1 (often a cd)
406
- const hit = cmd.split('\n').find(l => BASH_SEARCH.test(l)) || cmd;
407
- detail = hit.trim().slice(0, 120);
411
+ detail = (hitLine.split('|')[0]).trim().slice(0, 120);
408
412
  }
409
413
  }
410
414
  if (kind) violations.push({ ts, sid, project, kind, detail });