ccsniff 1.1.7 → 1.1.8

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 +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsniff",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
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
@@ -316,6 +316,7 @@ if (opts['git-discipline']) {
316
316
  const includeSubagents = opts['include-subagents'];
317
317
  const PUSH = /\bgit\s+push\b/;
318
318
  const PORCELAIN_CLEAN = /\bgit\s+status\s+(--porcelain|-s)\b/;
319
+ const stripQuoted = (s) => s.replace(/"(?:\\.|[^"\\])*"/g, '""').replace(/'(?:\\.|[^'\\])*'/g, "''");
319
320
  const bySid = new Map();
320
321
  for (const ev of all) {
321
322
  if (!filter(ev)) continue;
@@ -331,9 +332,10 @@ if (opts['git-discipline']) {
331
332
  for (let i = 0; i < evs.length; i++) {
332
333
  const ev = evs[i];
333
334
  const cmd = ev.block?.input?.command || '';
334
- if (!PUSH.test(cmd)) continue;
335
+ const cmdStripped = stripQuoted(cmd);
336
+ if (!PUSH.test(cmdStripped)) continue;
335
337
  const lookback = evs.slice(Math.max(0, i - 20), i);
336
- const witnessed = lookback.some(e => PORCELAIN_CLEAN.test(e.block?.input?.command || ''));
338
+ const witnessed = lookback.some(e => PORCELAIN_CLEAN.test(stripQuoted(e.block?.input?.command || '')));
337
339
  if (witnessed) continue;
338
340
  violations.push({ ts: ev.timestamp, sid, project: path.basename(ev.conversation.cwd || ''), kind: 'push-no-porcelain-witness', cmd: cmd.slice(0, 200) });
339
341
  }