vps-health-api/__tests__
le king fu c8f92ab25f
All checks were successful
CI / verification (pull_request) Successful in 28s
feat(agent): aggregate Claude usage from local transcripts
Pure, dependency-free module for the claude-usage agent. It walks
~/.claude/projects/**/*.jsonl (subagent transcripts included), keeps
assistant lines with message.usage, drops <synthetic> and truncated
lines, deduplicates on (message.id, requestId) across all files at the
largest output_tokens, and buckets by America/Toronto day computed as
strings only (DST-safe).

Returns { openDays, days, projects, claudeCodeVersion }: the recomputed
non-frozen days, the merged 30-day series (at most 12 models per day,
the rest folded into "other"), the top 8 projects by work tokens plus
"(autres)", and the version of the newest line. Files whose mtime day
is before the day after the most recent frozen day are never opened.

Resolves #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 09:10:51 -04:00
..
fixtures/claude-usage/projects/-home-tester-claude-code-alpha feat(agent): aggregate Claude usage from local transcripts 2026-10-04 09:10:51 -04:00
agent-claude-usage.test.js feat(agent): aggregate Claude usage from local transcripts 2026-10-04 09:10:51 -04:00
agent.test.js feat(agent): push workstation metrics to /hosts/<id> from cron 2026-08-16 12:21:59 -04:00
auth.test.js test(auth): pin the single space after the Bearer scheme 2026-09-27 19:23:50 -04:00
ci.test.js test(ci): pin the two ends of the port range and the end anchor (#46) 2026-10-02 14:15:03 -04:00
findings.test.js feat(defenseurs): add GET /defenseurs/findings?project=X route 2026-05-12 20:56:56 -04:00
health.test.js refactor: extract CPU/RAM/disk collection into metrics.js 2026-08-16 11:30:03 -04:00
hosts.test.js test(hosts): pin the symlink guard and the regex anchor of the temp sweep (#38) 2026-10-01 18:10:49 -04:00
state.test.js feat(defenseurs): serve the Sergent's findings state at GET /defenseurs/state 2026-09-24 20:42:20 -04:00
writes.test.js test(writes): count every write, drop the stack attribution (#40) 2026-10-01 20:01:09 -04:00