skilltally 1.0.2 → 1.0.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.
@@ -10,7 +10,7 @@
10
10
  {
11
11
  "name": "skilltally",
12
12
  "description": "Track skill activations and identify unused skills eating context.",
13
- "version": "1.0.2",
13
+ "version": "1.0.3",
14
14
  "source": "./",
15
15
  "category": "productivity"
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skilltally",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Real-time skill usage tracking via hooks for Antigravity, Claude Code, Codex & Gemini CLI.",
5
5
  "author": {
6
6
  "name": "112516101106",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skilltally",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Real-time skill usage tracking via hooks for Antigravity, Claude Code, Codex & Gemini CLI.",
5
5
  "author": {
6
6
  "name": "112516101106",
package/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.3] - 2026-11-19
9
+
10
+ ### Fixed
11
+ - Ignore paginated continuation reads across all 4 providers (`StartLine`/`start_line`/`offset > 1`, `ByteOffset`/`byte_offset > 0`, `sed -n 'N,Mp'` with `N > 1`, non-`+1` `tail`, and `awk` `NR >= N`/`NR > N`).
12
+ - Deduplicate same-session `(host, session_id, skill)` hook writes within a 30-second window at capture time in `bin/track.mjs`, and increase the default `dedupeEvents` query window from 5 seconds to 30 seconds in `src/core/normalize.mjs`.
13
+
8
14
  ## [1.0.2] - 2026-11-19
9
15
 
10
16
  ### Added
package/bin/cli.mjs CHANGED
@@ -32,7 +32,7 @@ function getVersion() {
32
32
  try {
33
33
  return JSON.parse(readFileSync(join(pkgDir, 'package.json'), 'utf8')).version;
34
34
  } catch {
35
- return '1.0.2';
35
+ return '1.0.3';
36
36
  }
37
37
  }
38
38
 
package/bin/track.mjs CHANGED
@@ -28,11 +28,54 @@ const CLAUDE_SKILL_BASEDIR_RE =
28
28
 
29
29
  const PATH_KEYS = ['Path', 'AbsolutePath', 'TargetFile', 'file_path', 'path', 'absolute_path'];
30
30
  const ARRAY_PATH_KEYS = ['paths', 'include', 'files'];
31
+ const LINE_START_KEYS = ['StartLine', 'start_line', 'offset'];
32
+ const BYTE_OFFSET_KEYS = ['ByteOffset', 'byte_offset'];
31
33
  const CMD_KEYS = ['CommandLine', 'command', 'cmd', 'input', 'argv'];
32
34
  const WRITE_TOOL_RE = /^(write|edit|replace|apply_patch|multiedit|notebookedit|create_file|delete_file)/i;
33
35
  const READ_CMD_RE = /^(cat|sed|head|tail|less|more|bat|nl|awk|type|Get-Content)\b/i;
34
36
  const MUTATE_CMD_RE = /(?:^|\s)(?:sed|awk)\s+(?:[^\n]*\s)?(?:-i\S*|--in-place\b)|>{1,2}\s*[^\s]*SKILL\.md/i;
35
37
  const CODEX_EXEC_CMD_RE = /\bcmd\s*:\s*("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g;
38
+ const DEDUPE_WINDOW_MS = 30_000;
39
+
40
+ function isContinuationReadArgs(safeArgs) {
41
+ for (const key of LINE_START_KEYS) {
42
+ const raw = safeArgs[key];
43
+ if (raw === undefined || raw === null) continue;
44
+ const unwrapped = unwrapArg(raw);
45
+ if (typeof unwrapped === 'string' && unwrapped.trim() === '') continue;
46
+ const n = Number(unwrapped);
47
+ if (Number.isFinite(n) && n > 1) return true;
48
+ }
49
+ for (const key of BYTE_OFFSET_KEYS) {
50
+ const raw = safeArgs[key];
51
+ if (raw === undefined || raw === null) continue;
52
+ const unwrapped = unwrapArg(raw);
53
+ if (typeof unwrapped === 'string' && unwrapped.trim() === '') continue;
54
+ const n = Number(unwrapped);
55
+ if (Number.isFinite(n) && n > 0) return true;
56
+ }
57
+ return false;
58
+ }
59
+
60
+ function isContinuationShellSegment(seg) {
61
+ const mSed = seg.match(/\bsed\b[^;&\n]*?(?:^|[\s'"=])(\d+)(?:\s*,\s*(?:\d+|\$|\+\d+))?p(?=['"\s;|&]|$)/i);
62
+ if (mSed && Number(mSed[1]) > 1) return true;
63
+
64
+ if (
65
+ (/^tail\b/i.test(seg) || /\|\s*tail\b/i.test(seg)) &&
66
+ !/\btail\s+(?:-[^\s]+\s+)*-n\s*\+?[01]\b/i.test(seg)
67
+ ) {
68
+ return true;
69
+ }
70
+
71
+ const mAwkGe = seg.match(/\bawk\b[^;&\n]*?\bNR\s*>=\s*(\d+)/i);
72
+ if (mAwkGe && Number(mAwkGe[1]) > 1) return true;
73
+
74
+ const mAwkGt = seg.match(/\bawk\b[^;&\n]*?\bNR\s*>\s*(\d+)/i);
75
+ if (mAwkGt && Number(mAwkGt[1]) >= 1) return true;
76
+
77
+ return false;
78
+ }
36
79
 
37
80
  function argValue(flag, argv = process.argv) {
38
81
  const i = argv.indexOf(flag);
@@ -263,6 +306,8 @@ export function detectSkillCalls({
263
306
  }
264
307
  };
265
308
 
309
+ if (isContinuationReadArgs(safeArgs)) return [];
310
+
266
311
  for (const key of PATH_KEYS) {
267
312
  if (typeof safeArgs[key] === 'string') {
268
313
  collectFromText(unwrapArg(safeArgs[key]), 'read');
@@ -299,6 +344,7 @@ export function detectSkillCalls({
299
344
  const seg = rawSeg.trim().replace(/^(?:[A-Za-z_]\w*=\S+\s+)+/, '');
300
345
  if (!READ_CMD_RE.test(seg)) continue;
301
346
  if (MUTATE_CMD_RE.test(seg)) continue;
347
+ if (isContinuationShellSegment(seg)) continue;
302
348
  collectFromText(seg, 'shell_read');
303
349
  }
304
350
  }
@@ -332,6 +378,33 @@ function maybeRotateEvents(home, eventsPath) {
332
378
  } catch {}
333
379
  }
334
380
 
381
+ function readRecentSessionSkills(eventsPath, host, sessionId, nowMs) {
382
+ const recent = new Set();
383
+ if (!sessionId || !existsSync(eventsPath)) return recent;
384
+ try {
385
+ const raw = readFileSync(eventsPath, 'utf8');
386
+ const lines = raw.trim().split('\n');
387
+ const tail = lines.slice(-64);
388
+ for (const line of tail) {
389
+ if (!line) continue;
390
+ let ev;
391
+ try {
392
+ ev = JSON.parse(line);
393
+ } catch {
394
+ continue;
395
+ }
396
+ if (ev.ok === false || ev.host !== host || ev.session_id !== sessionId || !ev.skill) {
397
+ continue;
398
+ }
399
+ const evMs = Date.parse(ev.ts);
400
+ if (Number.isFinite(evMs) && Math.abs(nowMs - evMs) <= DEDUPE_WINDOW_MS) {
401
+ recent.add(ev.skill);
402
+ }
403
+ }
404
+ } catch {}
405
+ return recent;
406
+ }
407
+
335
408
  export function main() {
336
409
  const hostFlag = argValue('--host') ?? 'auto';
337
410
  const raw = readFileSync(0, 'utf8');
@@ -354,11 +427,23 @@ export function main() {
354
427
  const hits = detectSkillCalls({ tool: n.tool, args: n.args, prompt: n.prompt, cwd: n.cwd });
355
428
  if (hits.length === 0) return;
356
429
 
430
+ const eventsPath = join(home, 'events.jsonl');
431
+ const ts = new Date().toISOString();
432
+ const nowMs = Date.parse(ts);
433
+ const recentSkills = !n.failed ? readRecentSessionSkills(eventsPath, host, n.sessionId, nowMs) : new Set();
434
+ const seenBatch = new Set();
435
+ const uniqueHits = [];
436
+ for (const h of hits) {
437
+ if (n.sessionId && (recentSkills.has(h.skill) || seenBatch.has(h.skill))) continue;
438
+ seenBatch.add(h.skill);
439
+ uniqueHits.push(h);
440
+ }
441
+ if (uniqueHits.length === 0) return;
442
+
357
443
  mkdirSync(home, { recursive: true, mode: 0o700 });
358
444
  const storeCwd = readStoreCwdFlag(home);
359
- const ts = new Date().toISOString();
360
445
 
361
- const lines = hits.map((h, idx) =>
446
+ const lines = uniqueHits.map((h, idx) =>
362
447
  JSON.stringify({
363
448
  v: 1,
364
449
  id: `${host}:${n.sessionId ?? '-'}:${n.callId ?? ts}#${idx}`,
@@ -379,7 +464,6 @@ export function main() {
379
464
  })
380
465
  );
381
466
 
382
- const eventsPath = join(home, 'events.jsonl');
383
467
  maybeRotateEvents(home, eventsPath);
384
468
  appendFileSync(eventsPath, lines.join('\n') + '\n', { mode: 0o600 });
385
469
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "skilltally",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Real-time skill usage tracking via hooks for Antigravity, Claude Code, Codex & Gemini CLI."
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skilltally",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Real-time skill usage tracking via hooks for Antigravity, Claude Code, Codex & Gemini CLI.",
5
5
  "type": "module",
6
6
  "bin": {
package/plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "skilltally",
3
3
  "displayName": "SkillTally",
4
4
  "description": "Real-time skill usage tracking via hooks for Antigravity, Claude Code, Codex & Gemini CLI. See which skills you actually use and which eat context.",
5
- "version": "1.0.2",
5
+ "version": "1.0.3",
6
6
  "author": {
7
7
  "name": "112516101106",
8
8
  "url": "https://github.com/112516101106"
@@ -41,7 +41,7 @@ export function canonicalizeEvent(ev, inventoryIndex = null, aliases = {}) {
41
41
  };
42
42
  }
43
43
 
44
- export function dedupeEvents(events, windowMs = 5000) {
44
+ export function dedupeEvents(events, windowMs = 30_000) {
45
45
  // Prioritize real-time hook events over backfill events when deduplicating.
46
46
  const ordered = [
47
47
  ...events.filter((e) => e.origin === 'hook'),
@@ -88,7 +88,7 @@ export function installAntigravity({
88
88
 
89
89
  writeJsonAtomic(join(target, 'hooks.json'), buildAntigravityHooksJson(), 0o644);
90
90
 
91
- let version = '1.0.2';
91
+ let version = '1.0.3';
92
92
  try {
93
93
  version = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8')).version || version;
94
94
  } catch {}