getaimeter 0.6.2 → 0.6.3

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 +12 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaimeter",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
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
@@ -372,10 +372,18 @@ function extractCursorUsage(dbPath) {
372
372
  if (!findSqlite3()) return [];
373
373
  if (!fs.existsSync(dbPath)) return [];
374
374
 
375
- // Check if the DB file has been modified since our last check
376
- let stat;
377
- try { stat = fs.statSync(dbPath); } catch { return []; }
378
- const currentMtime = stat.mtimeMs;
375
+ // Check if the DB has been modified since our last check.
376
+ // SQLite WAL mode: writes go to dbPath-wal, not the main file.
377
+ // We check the WAL file's mtime (if it exists) since that's what changes.
378
+ const walPath = dbPath + '-wal';
379
+ let currentMtime;
380
+ try {
381
+ if (fs.existsSync(walPath)) {
382
+ currentMtime = fs.statSync(walPath).mtimeMs;
383
+ } else {
384
+ currentMtime = fs.statSync(dbPath).mtimeMs;
385
+ }
386
+ } catch { return []; }
379
387
  const lastMtime = getOffset(dbPath + ':mtime');
380
388
  if (currentMtime <= lastMtime) return [];
381
389