Commit graph

379 commits

Author SHA1 Message Date
iamtoruk
ed5512144a fix(cursor-agent): preserve raw model name for unknown Cursor models
The fallback path in modelDisplayName returned "Auto (Sonnet est.) (est.)"
for any model not listed in modelDisplayNames, double-tagging the est.
suffix and hiding the real model ID. New Cursor model IDs now surface as
their raw name with a single (est.) suffix until the display map is
updated. Adds a regression test.
2026-04-20 19:20:15 -07:00
iamtoruk
988060cd09 chore: bump version to 0.8.4, update changelog 2026-04-20 18:28:02 -07:00
iamtoruk
bf17d20476 fix: remove noCache override for menubar-json format
Source cache fixes (empty-session guards, date range reordering) make
the cache safe for menubar use. Forcing noCache on every 15s poll was
re-parsing 5800+ files each time, causing the menubar to hang.
2026-04-20 18:25:43 -07:00
iamtoruk
78438e52f2 chore: remove CLAUDE.md from public repo
Internal development rules do not belong in a public repository.
File is kept locally and added to .gitignore.
2026-04-20 18:24:18 -07:00
iamtoruk
594013c5ce docs: add cached-vs-uncached verification rule for parser PRs 2026-04-20 18:08:38 -07:00
iamtoruk
f2195c12a1 chore: bump version to 0.8.3, update changelog 2026-04-20 18:08:11 -07:00
iamtoruk
b7ad5c5505 fix: source cache empty-session poisoning, TUI refresh, menubar stale data
Source cache entries with zero sessions now treated as cache misses instead
of serving stale empty data. Date range skip moved after fingerprint check
so changed files are never incorrectly excluded. TUI refresh timer bypasses
in-memory CachedWindow cache. Menubar-json forces noCache. Swift menubar
adds explicit refreshStatusButton calls to avoid observation race.
2026-04-20 18:07:37 -07:00
Matt Van Horn
554036d2a7
feat(cursor-agent): add provider for cursor-agent CLI sessions
Discovers transcripts at ~/.cursor/projects/*/agent-transcripts/*.txt
and joins against ~/.cursor/ai-tracking/ai-code-tracking.db for model
attribution. Token counts are estimated from transcript character
length since the attribution DB does not carry them; the model label
surfaces the estimation with an (est.) suffix on every row.

Deduplication keys prefix cursor-agent: to stay disjoint from the
existing cursor: prefix so the two providers do not cross-dedupe
on shared conversationId namespaces.

Tests cover: empty ~/.cursor/projects/, single transcript, multiple
projects, missing ai-code-tracking.db, unrecognized transcript format
skip, non-UUID filename fallback, and sqlite metadata join.

Closes #55
2026-04-20 17:49:45 -07:00
iamtoruk
508edcd62b chore: bump version to 0.8.2, update changelog and readme 2026-04-20 15:56:09 -07:00
iamtoruk
e18a1ef2f7 fix: tighten types, remove dead exports, prevent FD leak 2026-04-20 15:52:18 -07:00
Sharada Mohanty
7594fa0254 feat: optimize parse caching across providers 2026-04-21 00:07:07 +02:00
Sharada Mohanty
563f9c4f1b refactor: share provider presentation metadata 2026-04-21 00:04:29 +02:00
Sharada Mohanty
eb3737f756 docs: document persistent cache behavior 2026-04-21 00:03:49 +02:00
Sharada Mohanty
140e50b702 test: stabilize local-date aggregation 2026-04-21 00:03:49 +02:00
Sharada Mohanty
ff442c71f2 perf: cache provider discovery metadata 2026-04-21 00:03:49 +02:00
Sharada Mohanty
2a9daec0ea feat: add cache rebuild flag and progress 2026-04-21 00:03:49 +02:00
Sharada Mohanty
1b8e0f8289 fix: harden Claude append cache refresh 2026-04-21 00:01:46 +02:00
Sharada Mohanty
ad5366472a feat: cache Claude sources by session file 2026-04-21 00:01:46 +02:00
Sharada Mohanty
862be251e5 refactor: move providers onto shared cache metadata 2026-04-21 00:01:46 +02:00
Sharada Mohanty
303a9256c5 feat: reuse cached parsed sources 2026-04-21 00:01:46 +02:00
Sharada Mohanty
a2593ceb1e fix: harden source cache validation 2026-04-21 00:01:46 +02:00
Sharada Mohanty
ac5dd8c3e9 fix: tighten source cache validation 2026-04-21 00:01:46 +02:00
Sharada Mohanty
0d4d103627 fix: tighten source cache validation 2026-04-21 00:01:46 +02:00
Sharada Mohanty
a0bad07c19 feat: add persistent source cache storage 2026-04-21 00:01:46 +02:00
iamtoruk
e25922030d fix(config): restore catch-all in readConfig to prevent CLI crash on malformed config 2026-04-20 15:00:03 -07:00
Trevin Chow
c0d24cc191 fix(plan): resolve type errors in plan summary and isActivePlan guard
Two pre-existing type errors surfaced during the rebase against main:

1. JsonPlanSummary.id was hardcoded to four plan ids, but PlanId now
   includes 'none' (PLAN_IDS was extended when 'codeburn plan clear'
   was added). toJsonPlanSummary only runs for active plans at runtime,
   but the static type still had to be widened. Use PlanId directly
   instead of the hand-rolled union.

2. isActivePlan used Boolean(plan) as the nullish guard, which doesn't
   narrow plan's type in TypeScript. Switch to an explicit
   'plan !== undefined' so the subsequent .id and .monthlyUsd accesses
   type-check.

npx tsc --noEmit is now clean; all 285 tests still pass.
2026-04-20 14:55:07 -07:00
Trevin Chow
1af4d73da4 fix(plan): scope TUI plan row to billing period, use currency-aware formatting
Address review feedback on #74:

1. TUI plan row previously used the active tab's filtered projects as
   plan spend, so 'Today' showed today's cost as plan spent. Switch
   renderDashboard and reloadData to getPlanUsageOrNull(), which uses
   the plan's own billing period regardless of tab.

2. Plan row rendered via a local formatUsd that hardcoded USD. Replace
   every call with formatCost so 'codeburn currency EUR' flows through.
   Removes the adjacent '$3,425.52' vs '$32.07' style mismatch.

3. renderPlanBar capped filled width at 100%, so 105% and 1700% looked
   identical. Past 100%, render a full bar plus chevron tail sized by
   order of magnitude (log10): 1.05x -> 1 chevron, 17x -> 2, 170x -> 3.

4. 'running on API overage pricing' is wrong for Claude Pro/Max (rate
   limited, not charged overage). Drop that claim; keep the Nx-over
   multiplier and match the under/near projection line structure.

5. Spell out 'equiv' as 'API-equivalent' in the plan label.

Dead code cleanup: getPlanUsageOrNullForProjects is now unused; remove
it. getPlanUsageFromProjects stays (unit tests still use it).
2026-04-20 14:55:07 -07:00
Trevin Chow
553cf2d706 feat(plan): subscription plan tracking with usage progress bar
Adds `codeburn plan set <id>` to configure a subscription plan (Claude Pro,
Claude Max, Cursor Pro, or custom). When set, the Overview panel renders
an API-equivalent progress bar against subscription price with a
projected month-end cost.

Closes the loudest demand signal on the repo: issue #11 ("Subscription
vs API Use") from two independent voices, plus the routing-decision use
case raised in #12.

- src/config.ts: extends CodeburnConfig with Plan, adds readPlan/savePlan/clearPlan
- src/plans.ts: presets (claude-pro $20, claude-max $200, cursor-pro $20)
- src/plan-usage.ts: getPlanUsage, resetDay-aware period math (1-28),
  median-of-7-day-trailing projection
- src/cli.ts: `codeburn plan [show|set|reset]` subcommand, plan wired
  into JSON outputs for report/today/month/status (only when active)
- src/dashboard.tsx: Plan row in Overview, color-coded (green under 80%,
  orange near, red over), with days-until-reset
- README.md: Plans section with honest framing (API-equivalent vs
  subscription price, not token allowance)
- tests/plan-usage.test.ts, tests/plans.test.ts, tests/cli-plan.test.ts:
  period math, presets, CLI round-trip

Resets respect resetDay across month boundaries. Uses median daily spend
(not mean) so one huge day doesn't distort the month-end projection.

Fixes #11

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 14:55:07 -07:00
iamtoruk
a4d261a536 fix: pricing accuracy, stream leak, CSV injection hardening
- Remove bidirectional fuzzy match in getModelCosts that could return
  wrong pricing when a short canonical name prefix-matched a longer key
- Use explicit undefined check in parseLiteLLMEntry so free models with
  zero cost are not silently dropped from the LiteLLM pricing database
- Destroy read stream in finally block of readSessionLines to prevent
  file descriptor leaks when the generator is abandoned early
- Extend CSV injection escaping to cover tab and carriage-return prefixes
- Add optional chaining fallback for empty periods in exportCsv/exportJson
- Add regression tests for all fixes (models, export, fs-utils)
2026-04-20 14:49:32 -07:00
iamtoruk
b61e7cd32a docs: add star history chart to README
Some checks are pending
CI / semgrep (push) Waiting to run
2026-04-19 16:57:59 -07:00
iamtoruk
12f0833bef fix(menubar): use numeric version comparison for update check
Compare versions with .orderedDescending instead of != to prevent
showing update button when installed version is newer than cached.
2026-04-19 16:33:52 -07:00
iamtoruk
45be10b755 docs: credit CodexBar as inspiration 2026-04-19 15:49:12 -07:00
iamtoruk
b896208be9 chore: update readme badges and menubar screenshot
Remove bundlephobia and monthly downloads badges, update menubar
screenshot to 0.8.0.
2026-04-19 15:31:11 -07:00
iamtoruk
9940d64258 chore: bump version to 0.8.1 2026-04-19 13:35:04 -07:00
Resham Joshi
bb0303c257
Merge pull request #109 from getagentseal/fix/view-persistence-and-compare-period-hints
fix: preserve view on period switch and auto-refresh
2026-04-19 13:34:53 -07:00
iamtoruk
95bcd60aba fix: preserve view on period switch and auto-refresh
Period switching no longer resets optimize or compare views back to
the dashboard. Auto-refresh keeps the current screen. Arrow keys
now work in all views. Added period switch hints to compare status bar.

Closes #107
2026-04-19 13:34:30 -07:00
iamtoruk
19b4513400 fix: auto-refresh no longer resets optimize view
reloadData() was clearing optimizeResult before fetching, which
caused the optimize screen to flash back to the dashboard on every
30s refresh cycle. Let the projects useEffect re-scan naturally.
2026-04-19 13:16:51 -07:00
iamtoruk
dba33428ca fix(mac): update badge always visible due to version prefix mismatch
GitHub asset name includes a v prefix (v0.8.0) while
CFBundleShortVersionString does not (0.8.0). Strip the prefix
before comparing. Also capture stderr on update failure so the
button doesn't hang on "Updating..." forever.
2026-04-19 13:00:20 -07:00
Resham Joshi
44d5ffa03f
Merge pull request #108 from getagentseal/fix/menubar-all-tab-stale-refresh
Some checks are pending
CI / semgrep (push) Waiting to run
Release 0.8.0: model comparison, auto-refresh, menubar fix
2026-04-19 08:59:09 -07:00
iamtoruk
6e4db43c41 Release 0.8.0: model comparison, auto-refresh, menubar fix
Add compare command docs to README, update changelog for 0.8.0,
bump version. TUI auto-refresh default 30s, menubar refresh 15s.
2026-04-19 08:58:45 -07:00
iamtoruk
fc576f44ba fix: real-time refresh for menubar and TUI dashboard
Menubar: reduce cache TTL from 300s to 30s, background refresh from
60s to 15s, always fetch fresh data on tab switch instead of serving
stale cache. TUI: default auto-refresh to 30s (--refresh 0 to disable).

Closes #107
2026-04-19 08:55:48 -07:00
iamtoruk
bd43b15342 feat(compare): model comparison with planning rate fix
5-section compare view: Performance (one-shot, retry, self-correction),
Efficiency (cost/call, cost/edit, output/call, cache hit), Category
Head-to-Head bar charts, Working Style, and Context.

Planning rate now detects TaskCreate/TaskUpdate/TodoWrite instead of
only EnterPlanMode (which was never used, showing 0% for all models).
Validated against raw JSONL with zero false positives.

Responsive side-by-side layout at 90+ cols. Self-correction scanner
with compact file skipping and model+timestamp dedup. 274 tests.
2026-04-19 08:34:49 -07:00
iamtoruk
fb24eea186 fix(compare): refine self-correction patterns, skip compact files, deduplicate
Remove high-false-positive patterns (I'm sorry, I should have, sorry for).
Add precise patterns (you're right I, that was incorrect, let me correct).
Skip compact JSONL files that replay compressed context.
Deduplicate by model+timestamp to prevent double-counting.
Fix test timestamps to work with deduplication.
2026-04-19 07:14:02 -07:00
iamtoruk
d04159a056 fix(compare): remove winner column, green highlight is sufficient 2026-04-19 06:52:50 -07:00
iamtoruk
27a3ddd7f8 fix(compare): strip date suffixes from model names for cleaner display 2026-04-19 06:51:26 -07:00
iamtoruk
2a9ecab05c feat(compare): show self-correction counts in context section 2026-04-19 06:47:43 -07:00
iamtoruk
e0d8ecddd9 fix(compare): show compare-styled loading screen during period switch 2026-04-19 06:45:47 -07:00
iamtoruk
73ae1c3786 feat(compare): period switching in compare view, hide status bar
Period changes (arrows, 1-5) now update comparison results in place
instead of returning to dashboard. Status bar hidden in compare view
to reduce clutter.
2026-04-19 06:43:27 -07:00
iamtoruk
f43ef70922 fix(compare): hide provider indicator and shortcut in compare view 2026-04-19 06:29:58 -07:00
iamtoruk
b285320063 fix(compare): wrap all screens in bordered boxes to match dashboard UI 2026-04-19 06:28:55 -07:00