getaimeter 0.6.1 → 0.6.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/watcher.js +17 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaimeter",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Track AI coding costs across Claude, Cursor, Codex, and Gemini. Optimization recommendations that cut costs by 30%.",
5
5
  "bin": {
6
6
  "aimeter": "cli.js"
package/watcher.js CHANGED
@@ -646,17 +646,26 @@ function startWatching() {
646
646
  const cursorDbs = findCursorDbs(watchPaths);
647
647
  if (cursorDbs.length > 0) {
648
648
  log('Cursor databases found:', cursorDbs.join(', '));
649
- // Mark existing Cursor data as seen on first run
650
- if (isFirstRun) {
651
- for (const dbPath of cursorDbs) {
652
- try {
649
+ // Always pre-populate _cursorSeenKeys on startup so we don't re-report
650
+ // historical conversations. On first run, also set the mtime offset.
651
+ for (const dbPath of cursorDbs) {
652
+ try {
653
+ if (isFirstRun) {
653
654
  const mtime = fs.statSync(dbPath).mtimeMs;
654
655
  setOffset(dbPath + ':mtime', mtime);
655
- // Pre-populate seen keys so we don't report historical data
656
- extractCursorUsage(dbPath); // populates _cursorSeenKeys but we discard results
657
- } catch {}
656
+ }
657
+ // Dry-run extraction to populate _cursorSeenKeys (discard results)
658
+ const existing = extractCursorUsage(dbPath);
659
+ if (isFirstRun && existing.length > 0) {
660
+ log(`Cursor: marked ${existing.length} existing conversations as read`);
661
+ } else if (existing.length > 0) {
662
+ // Not first run but has new data since last mtime — report it
663
+ reportEvents(existing);
664
+ log(`Cursor: catch-up reported ${existing.length} events`);
665
+ }
666
+ } catch (err) {
667
+ logError('Cursor startup scan:', err.message);
658
668
  }
659
- log('Cursor: marked existing conversations as read');
660
669
  }
661
670
  }
662
671