ccsniff 1.1.22 → 1.1.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsniff",
3
- "version": "1.1.22",
3
+ "version": "1.1.23",
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
@@ -257,6 +257,17 @@ if (opts['list-projects']) {
257
257
  process.exit(0);
258
258
  }
259
259
 
260
+ // Each --*-discipline below is its own one-shot report ending in process.exit(0), so only the
261
+ // first requested discipline in source order would ever run. Combining flags (e.g.
262
+ // `--git-discipline --search-discipline`) would silently drop every discipline but the first and
263
+ // yield a false-clean audit. Fail loud instead of running one and dropping the rest.
264
+ const DISCIPLINE_FLAGS = ['bash-discipline', 'git-discipline', 'verb-bypass-discipline', 'spool-discipline', 'search-discipline', 'glyph-discipline', 'continuation-discipline'];
265
+ const requestedDisciplines = DISCIPLINE_FLAGS.filter(d => opts[d]);
266
+ if (requestedDisciplines.length > 1) {
267
+ process.stderr.write(`ccsniff: ${requestedDisciplines.length} discipline flags given (${requestedDisciplines.map(d => '--' + d).join(' ')}); each is a separate one-shot report and only the first would run. Invoke one discipline per call.\n`);
268
+ process.exit(2);
269
+ }
270
+
260
271
  // ---------- bash-discipline (flag Bash calls that should have been Read/Glob/Grep/dispatch)
261
272
  if (opts['bash-discipline']) {
262
273
  // discipline is about MY tool routing, not subagents — they have separate prompts/contexts.
@@ -7,7 +7,7 @@ const isAbs = (d) => d.startsWith('/') || /^[a-z]:/.test(d);
7
7
  export function targetsOutsideCwd(line, cwd) {
8
8
  const cwdN = normPath(cwd);
9
9
  if (!cwdN) return false;
10
- const stripped = stripQuoted(line);
10
+ const stripped = stripQuoted(line).replace(/\\/g, '/');
11
11
  const ctxM = stripped.match(/(?:^|[|&;]\s*)(?:cd|pushd)\s+([^\s|&;]+)/i) || stripped.match(/\bgit\s+-C\s+([^\s|&;]+)/i);
12
12
  if (ctxM) { const d = normPath(ctxM[1]); if (isAbs(d) && !d.startsWith(cwdN)) return true; }
13
13
  const absArgs = stripped.match(/(?:^|\s)((?:[a-z]:)?\/[^\s|&;"']+)/gi) || [];