@yhong91/vibetime 0.1.37 → 0.1.38

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/bin/vibetime.mjs +32 -4
  2. package/package.json +1 -1
package/bin/vibetime.mjs CHANGED
@@ -1928,7 +1928,7 @@ function countTextLines(text) {
1928
1928
  }
1929
1929
 
1930
1930
  // src/lib/constants.ts
1931
- var PACKAGE_VERSION = true ? "0.1.37" : "0.1.1";
1931
+ var PACKAGE_VERSION = true ? "0.1.38" : "0.1.1";
1932
1932
  var DEFAULT_API_URL = "http://121.196.224.82:3001";
1933
1933
  var DEFAULT_BACKFILL_BATCH_SIZE = 50;
1934
1934
  var DEFAULT_BACKFILL_BATCH_BYTES = 800 * 1024;
@@ -4786,7 +4786,7 @@ async function codebuddyBackfillFiles(sourceRoot, home, env) {
4786
4786
  const filePath = path9.join(traceDir, entry);
4787
4787
  try {
4788
4788
  const stat14 = await import("node:fs/promises").then((fs) => fs.stat(filePath));
4789
- files.push({ path: filePath, modifiedAt: stat14.mtime.toISOString() });
4789
+ files.push({ path: filePath, modifiedAt: stat14.mtime.toISOString(), groupId: pidDir.name });
4790
4790
  } catch {
4791
4791
  }
4792
4792
  }
@@ -12097,10 +12097,37 @@ function selectBackfillFilesForImport(files, watermarkTs) {
12097
12097
  if (Number.isNaN(watermarkMs)) {
12098
12098
  return files;
12099
12099
  }
12100
- return files.filter((f) => {
12100
+ const isPast = (f) => {
12101
12101
  const modifiedMs = Date.parse(f.modifiedAt);
12102
12102
  return !Number.isNaN(modifiedMs) && modifiedMs > watermarkMs;
12103
- });
12103
+ };
12104
+ const groups = /* @__PURE__ */ new Map();
12105
+ const picked = [];
12106
+ for (const f of files) {
12107
+ if (!f.groupId) {
12108
+ if (isPast(f)) {
12109
+ picked.push(f);
12110
+ }
12111
+ continue;
12112
+ }
12113
+ const arr = groups.get(f.groupId);
12114
+ if (arr) {
12115
+ arr.push(f);
12116
+ } else {
12117
+ groups.set(f.groupId, [f]);
12118
+ }
12119
+ }
12120
+ for (const arr of groups.values()) {
12121
+ if (arr.some(isPast)) {
12122
+ picked.push(...arr);
12123
+ }
12124
+ }
12125
+ const order = /* @__PURE__ */ new Map();
12126
+ for (let i = 0; i < files.length; i += 1) {
12127
+ order.set(files[i].path, i);
12128
+ }
12129
+ picked.sort((a, b) => (order.get(a.path) ?? 0) - (order.get(b.path) ?? 0));
12130
+ return picked;
12104
12131
  }
12105
12132
  function backfillIncrementalStatePath(home) {
12106
12133
  return path24.join(home, ".vibetime", "backfill-state.json");
@@ -12530,6 +12557,7 @@ Environment:
12530
12557
  }
12531
12558
  export {
12532
12559
  run,
12560
+ selectBackfillFilesForImport,
12533
12561
  syncLocalRunnerEntryArgs
12534
12562
  };
12535
12563
  const code = await run(process.argv.slice(2));process.exitCode = code;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yhong91/vibetime",
3
3
  "type": "module",
4
- "version": "0.1.37",
4
+ "version": "0.1.38",
5
5
  "description": "vibetime CLI — install AI-agent hooks (Claude Code, Codex, OpenCode, Pi) and report activity to vibetime.",
6
6
  "license": "MIT",
7
7
  "publishConfig": {