aicp-tracker 1.3.1 → 1.3.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/src/daemon.js +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicp-tracker",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "AI Code Pulse — Claude Code usage tracker for JIRA cost attribution",
5
5
  "main": "src/daemon.js",
6
6
  "bin": {
package/src/daemon.js CHANGED
@@ -8,6 +8,7 @@ const { parseNewLines } = require('./log-parser');
8
8
  const wal = require('./wal');
9
9
  const { sendPending } = require('./sender');
10
10
  const { CONFIG_DIR } = require('./config');
11
+ const state = require('./state');
11
12
 
12
13
  const PID_FILE = path.join(CONFIG_DIR, 'daemon.pid');
13
14
 
@@ -17,9 +18,15 @@ const PROJECT_PATH = process.env.AICP_PROJECT_PATH
17
18
  || process.cwd();
18
19
 
19
20
  async function tick() {
20
- const files = findJsonlFiles(PROJECT_PATH);
21
+ const files = findJsonlFiles(PROJECT_PATH);
22
+ const cutoff = Date.now() - 10 * 24 * 60 * 60 * 1000; // 10-day backfill limit
21
23
  let total = 0;
24
+
22
25
  for (const f of files) {
26
+ // Never-seen files: only backfill if modified within the last 10 days
27
+ if (state.getOffset(f) === 0) {
28
+ try { if (fs.statSync(f).mtimeMs < cutoff) continue; } catch { continue; }
29
+ }
23
30
  const records = parseNewLines(f);
24
31
  if (records.length) {
25
32
  wal.append(records);