ccsniff 1.1.4 → 1.1.5

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.4",
3
+ "version": "1.1.5",
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
@@ -26,8 +26,8 @@ if (process.argv[2] === 'gui') {
26
26
  } else {
27
27
 
28
28
  const FLAGS = {
29
- string: ['since', 'until', 'before', 'after', 'grep', 'igrep', 'cwd', 'project', 'role', 'type', 'tool', 'session', 'sid', 'parent', 'rollup', 'format', 'sort', 'unsloth', 'unsloth-format'],
30
- multi: ['grep', 'igrep', 'role', 'type', 'tool', 'session', 'sid', 'project', 'cwd'],
29
+ string: ['since', 'until', 'before', 'after', 'grep', 'igrep', 'cwd', 'project', 'role', 'type', 'tool', 'session', 'sid', 'parent', 'rollup', 'format', 'sort', 'unsloth', 'unsloth-format', 'exclude-sess', 'exclude-sid', 'exclude-cwd', 'exclude-project'],
30
+ multi: ['grep', 'igrep', 'role', 'type', 'tool', 'session', 'sid', 'project', 'cwd', 'exclude-sess', 'exclude-sid', 'exclude-cwd', 'exclude-project'],
31
31
  number: ['limit', 'head', 'tail-n', 'ctx', 'truncate'],
32
32
  bool: ['json', 'ndjson', 'tail', 'f', 'full', 'reverse', 'invert', 'no-subagents', 'only-subagents', 'no-meta', 'only-meta', 'list-sessions', 'list-projects', 'list-tools', 'bash-discipline', 'include-subagents', 'stats', 'count', 'help', 'h'],
33
33
  };
@@ -81,6 +81,9 @@ FILTERS (repeatable flags combine as OR within a flag, AND across flags)
81
81
  --type <t> text|tool_use|tool_result|thinking|system|result; repeat = OR
82
82
  --tool <name> tool name (Read, Bash, ...); repeat = OR
83
83
  --session <sid> session id prefix; repeat = OR (alias: --sid)
84
+ --exclude-sess <sid> exclude session id prefix; repeat = exclude any (alias: --exclude-sid)
85
+ --exclude-cwd <re> exclude working-dir regex; repeat = exclude any
86
+ --exclude-project <n> exclude basename(cwd) exact match; repeat = exclude any
84
87
  --parent <sid> subagent parent session id
85
88
  --no-subagents exclude subagent sessions
86
89
  --only-subagents only subagent sessions
package/src/filters.js CHANGED
@@ -46,6 +46,9 @@ export function buildFilter(opts) {
46
46
  const types = new Set(m.type || []);
47
47
  const tools = new Set(m.tool || []);
48
48
  const sids = (m.session || []).concat(m.sid || []);
49
+ const excludeSids = (m['exclude-sess'] || []).concat(m['exclude-sid'] || []);
50
+ const excludeCwdRes = compileRegexes(m['exclude-cwd']);
51
+ const excludeProjects = new Set(m['exclude-project'] || []);
49
52
  const parent = opts.parent || null;
50
53
 
51
54
  return ev => {
@@ -61,6 +64,9 @@ export function buildFilter(opts) {
61
64
  else if (types.size && !types.has(block.type)) pass = false;
62
65
  else if (tools.size && !tools.has(block.name)) pass = false;
63
66
  else if (sids.length && !sids.some(s => conv.id?.startsWith(s))) pass = false;
67
+ else if (excludeSids.length && excludeSids.some(s => conv.id?.startsWith(s))) pass = false;
68
+ else if (excludeCwdRes.length && excludeCwdRes.some(r => r.test(conv.cwd || ''))) pass = false;
69
+ else if (excludeProjects.size && excludeProjects.has(path.basename(conv.cwd || ''))) pass = false;
64
70
  else if (parent && conv.parentSid !== parent) pass = false;
65
71
  else if (opts['no-subagents'] && conv.isSubagent) pass = false;
66
72
  else if (opts['only-subagents'] && !conv.isSubagent) pass = false;