ccgather 2.0.5 → 2.0.7

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/dist/index.js +29 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -329,7 +329,7 @@ var init_ui = __esm({
329
329
  "use strict";
330
330
  import_chalk = __toESM(require("chalk"));
331
331
  import_string_width = __toESM(require("string-width"));
332
- VERSION = true ? "2.0.5" : "0.0.0";
332
+ VERSION = true ? "2.0.7" : "0.0.0";
333
333
  colors = {
334
334
  primary: import_chalk.default.hex("#DA7756"),
335
335
  // Claude coral
@@ -726,44 +726,29 @@ function extractProjectName(filePath) {
726
726
  }
727
727
  return "unknown";
728
728
  }
729
- var DEBUG = process.env.CCGATHER_DEBUG === "1" || process.env.CCGATHER_DEBUG === "true";
730
- function debugLog(...args) {
731
- if (DEBUG) {
732
- console.log("[DEBUG]", ...args);
733
- }
734
- }
735
729
  function getClaudeProjectsDirs() {
736
730
  const dirs = [];
737
731
  const home = os2.homedir();
738
- debugLog("Home directory:", home);
739
- debugLog("Platform:", process.platform);
740
732
  const configDir = process.env.CLAUDE_CONFIG_DIR;
741
733
  if (configDir) {
742
734
  const envPath = path2.join(configDir, "projects");
743
735
  dirs.push(envPath);
744
- debugLog("CLAUDE_CONFIG_DIR path:", envPath);
745
736
  }
746
737
  if (process.platform === "win32") {
747
738
  const appData = process.env.APPDATA;
748
739
  if (appData) {
749
740
  const appDataPath = path2.join(appData, "claude", "projects");
750
741
  dirs.push(appDataPath);
751
- debugLog("APPDATA path:", appDataPath);
752
742
  }
753
743
  }
754
744
  const xdgPath = path2.join(home, ".config", "claude", "projects");
755
745
  dirs.push(xdgPath);
756
- debugLog("XDG path:", xdgPath);
757
746
  const legacyPath = path2.join(home, ".claude", "projects");
758
747
  dirs.push(legacyPath);
759
- debugLog("Legacy path:", legacyPath);
760
748
  const uniqueDirs = [...new Set(dirs)];
761
749
  const existingDirs = uniqueDirs.filter((dir) => {
762
- const exists = fs2.existsSync(dir);
763
- debugLog(`Path ${dir} exists:`, exists);
764
- return exists;
750
+ return fs2.existsSync(dir);
765
751
  });
766
- debugLog("Existing project dirs:", existingDirs);
767
752
  return existingDirs;
768
753
  }
769
754
  function encodePathLikeClaude(inputPath) {
@@ -885,7 +870,6 @@ function getSessionPathDebugInfo() {
885
870
  function scanAllProjects(options = {}) {
886
871
  const projectsDirs = getClaudeProjectsDirs();
887
872
  if (projectsDirs.length === 0) {
888
- debugLog("No project directories found");
889
873
  return null;
890
874
  }
891
875
  const days = options.days ?? 0;
@@ -924,7 +908,6 @@ function scanAllProjects(options = {}) {
924
908
  }
925
909
  }
926
910
  if (allJsonlFiles.length === 0) {
927
- debugLog("No JSONL files found in any project");
928
911
  return null;
929
912
  }
930
913
  sessionsCount = allJsonlFiles.length;
@@ -1386,6 +1369,33 @@ async function submit(options) {
1386
1369
  const lineLength = 40 - text.length;
1387
1370
  return ` ${colors.white.bold(text)}${colors.dim("\u2500".repeat(Math.max(0, lineLength)))}`;
1388
1371
  };
1372
+ if (result.previous) {
1373
+ const prev = result.previous;
1374
+ const tokenDiff = usageData.totalTokens - prev.totalTokens;
1375
+ const costDiff = usageData.totalCost - prev.totalCost;
1376
+ const lastSubmit = new Date(prev.lastSubmissionAt);
1377
+ const now = /* @__PURE__ */ new Date();
1378
+ const hoursDiff = Math.floor((now.getTime() - lastSubmit.getTime()) / (1e3 * 60 * 60));
1379
+ const daysDiff = Math.floor(hoursDiff / 24);
1380
+ const timeSince = daysDiff > 0 ? `${daysDiff}d ago` : hoursDiff > 0 ? `${hoursDiff}h ago` : "just now";
1381
+ console.log(sectionHeader("\u{1F4C8}", "Since Last Submit"));
1382
+ console.log();
1383
+ console.log(` ${colors.muted("Last submitted:")} ${colors.dim(timeSince)}`);
1384
+ if (tokenDiff > 0) {
1385
+ console.log(
1386
+ ` ${colors.muted("New tokens:")} ${colors.success(`+${formatNumber(tokenDiff)}`)}`
1387
+ );
1388
+ }
1389
+ if (costDiff > 0) {
1390
+ console.log(
1391
+ ` ${colors.muted("New spending:")} ${colors.success(`+${formatCost(costDiff)}`)}`
1392
+ );
1393
+ }
1394
+ if (tokenDiff === 0 && costDiff === 0) {
1395
+ console.log(` ${colors.dim("No new usage since last submission")}`);
1396
+ }
1397
+ console.log();
1398
+ }
1389
1399
  if (result.rank || result.countryRank) {
1390
1400
  console.log();
1391
1401
  console.log(sectionHeader("\u{1F4CA}", "Your Ranking"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccgather",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "CLI tool for syncing Claude Code usage data to CCgather leaderboard",
5
5
  "bin": {
6
6
  "ccgather": "dist/index.js",