Commit graph

3 commits

Author SHA1 Message Date
Resham Joshi
d49a6a4eba
fix(claude): attribute each call to the project of its own cwd (#1689)
* fix(claude): attribute each call to the project of its own cwd

* fix(claude): keep subfolder cwds in their project, count and show a split session once

* fix(claude): a deleted subfolder stays its own project
2026-10-08 06:28:32 +02:00
ozymandiashh
fdc69ea235 Fix period comparison identities, daily deltas and detail cache 2026-09-12 13:43:24 -07:00
ozymandiashh
f7a66e51f5 feat(cli): compare-periods command with a deterministic B-minus-A diff engine
Add src/period-diff.ts: pure period-vs-period difference engine. Totals come
from the shared buildPeriodData rules; contributions per project and per model
carry status new/gone/up/down/flat with pct=null at A=0 (labeled New, never an
infinite percentage); normalized views per day and per 100 calls print their
denominators; day arithmetic walks local midnights so DST and month boundaries
count calendar days. historyBasis cross-checks the durable daily cache and
reports aggregate-only carried days separately instead of force-reconciling
them into the totals. diffSessions joins the drill-down on the canonical
session identity (provider + project path + sessionId), attributing the
model's own slice for the model lens.

New command: compare-periods --format json|sessions with explicit
--from-a/--to-a/--from-b/--to-b (local YYYY-MM-DD, validated loudly) defaulting
to the last seven complete days vs the seven before, plus --provider and the
existing --project/--exclude filtering. Range slicing reuses parseAllSessions'
call-granularity behavior, so a session straddling the boundary contributes to
each side by its own calls.

Tests: engine fixtures including the X/Y/Z acceptance reconciliation, A=0/B=0,
unequal lengths, DST and month walks, carried history, a real-parse boundary
session split by call and joined back into one drill-down row, and CLI runs on
a temp HOME fixture.
2026-09-12 13:43:24 -07:00