Skip to content

feat(stats): record snapshots on SessionEnd - #784

Open
ousamabenyounes wants to merge 1 commit into
JuliusBrussee:mainfrom
ousamabenyounes:fix/issue-716
Open

feat(stats): record snapshots on SessionEnd#784
ousamabenyounes wants to merge 1 commit into
JuliusBrussee:mainfrom
ousamabenyounes:fix/issue-716

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Fixes #716

Summary

  • add caveman-stats.js --record for silent SessionEnd snapshots using hook stdin transcript_path and session_id
  • wire the SessionEnd recorder through the Claude plugin manifest and standalone installers/uninstallers
  • keep malformed/missing hook stdin quiet and avoid guessing a recent session during --record

I kept the caveman-style --all pile output out of this PR so the change stays focused on dense lifetime history.

RED

node tests/test_caveman_stats.js

✗ --record appends SessionEnd snapshot silently from stdin
Expected values to be strictly equal:
+ actual - expected
+ '\nCaveman Stats\n...'
- ''
37 passed, 1 failed

node --test tests/installer/e2e.freshinstall.test.mjs tests/installer/plugin-manifest.test.mjs

not ok ... claude hook install wires SessionEnd stats recorder once
actual: 0
not ok ... plugin manifest wires SessionEnd stats recorder
0 !== 1
# pass 16
# fail 2

Revert proof with implementation files reset to upstream/main and new tests kept:

37 passed, 2 failed
not ok 19 - plugin manifest wires SessionEnd stats recorder
0 !== 1
# pass 16
# fail 3

GREEN

Baseline on upstream/main with repo-local run-ci.sh:

npm test: 112 passed, 0 failed
node tests/test_caveman_stats.js: 37 passed, 0 failed
python3 tests/verify_repo.py: all checks passed
diff-coverage-gate: PASS no changed production lines with coverage data

Final on this branch:

npm test: 115 passed, 0 failed
node tests/test_caveman_stats.js: 39 passed, 0 failed
python3 tests/verify_repo.py: all checks passed
diff-coverage-gate: PASS 100.00% (206/206) changed production lines covered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: lifetime stats that count every session — and grunt like caveman (pile view for --all)

1 participant