ccgather 1.3.55 → 1.3.57

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 +33 -80
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -382,7 +382,7 @@ var init_ui = __esm({
382
382
  "use strict";
383
383
  import_chalk = __toESM(require("chalk"));
384
384
  import_string_width = __toESM(require("string-width"));
385
- VERSION = true ? "1.3.55" : "0.0.0";
385
+ VERSION = true ? "1.3.57" : "0.0.0";
386
386
  colors = {
387
387
  primary: import_chalk.default.hex("#DA7756"),
388
388
  // Claude coral
@@ -806,8 +806,23 @@ function extractProjectName(filePath) {
806
806
  }
807
807
  return "unknown";
808
808
  }
809
- function getClaudeProjectsDir() {
810
- return path2.join(os2.homedir(), ".claude", "projects");
809
+ function getClaudeProjectsDirs() {
810
+ const dirs = [];
811
+ const home = os2.homedir();
812
+ const configDir = process.env.CLAUDE_CONFIG_DIR;
813
+ if (configDir) {
814
+ dirs.push(path2.join(configDir, "projects"));
815
+ }
816
+ if (process.platform === "win32") {
817
+ const appData = process.env.APPDATA;
818
+ if (appData) {
819
+ dirs.push(path2.join(appData, "claude", "projects"));
820
+ }
821
+ }
822
+ dirs.push(path2.join(home, ".config", "claude", "projects"));
823
+ dirs.push(path2.join(home, ".claude", "projects"));
824
+ const uniqueDirs = [...new Set(dirs)];
825
+ return uniqueDirs.filter((dir) => fs2.existsSync(dir));
811
826
  }
812
827
  function encodePathLikeClaude(inputPath) {
813
828
  return inputPath.split("").map((char) => {
@@ -822,25 +837,27 @@ function encodePathLikeClaude(inputPath) {
822
837
  }).join("");
823
838
  }
824
839
  function getCurrentProjectDir() {
825
- const projectsDir = getClaudeProjectsDir();
826
- if (!fs2.existsSync(projectsDir)) {
840
+ const projectsDirs = getClaudeProjectsDirs();
841
+ if (projectsDirs.length === 0) {
827
842
  return null;
828
843
  }
829
844
  const cwd = process.cwd();
830
845
  const encodedCwd = encodePathLikeClaude(cwd);
831
- try {
832
- const entries = fs2.readdirSync(projectsDir, { withFileTypes: true });
833
- for (const entry of entries) {
834
- if (!entry.isDirectory()) continue;
835
- if (entry.name === encodedCwd) {
836
- return path2.join(projectsDir, entry.name);
837
- }
838
- if (entry.name.toLowerCase() === encodedCwd.toLowerCase()) {
839
- return path2.join(projectsDir, entry.name);
846
+ for (const projectsDir of projectsDirs) {
847
+ try {
848
+ const entries = fs2.readdirSync(projectsDir, { withFileTypes: true });
849
+ for (const entry of entries) {
850
+ if (!entry.isDirectory()) continue;
851
+ if (entry.name === encodedCwd) {
852
+ return path2.join(projectsDir, entry.name);
853
+ }
854
+ if (entry.name.toLowerCase() === encodedCwd.toLowerCase()) {
855
+ return path2.join(projectsDir, entry.name);
856
+ }
840
857
  }
858
+ } catch {
859
+ continue;
841
860
  }
842
- } catch {
843
- return null;
844
861
  }
845
862
  return null;
846
863
  }
@@ -1532,74 +1549,10 @@ async function getStatus() {
1532
1549
  }
1533
1550
 
1534
1551
  // src/index.ts
1535
- function isNewerVersion(v1, v2) {
1536
- const parts1 = v1.split(".").map(Number);
1537
- const parts2 = v2.split(".").map(Number);
1538
- for (let i = 0; i < 3; i++) {
1539
- const p1 = parts1[i] || 0;
1540
- const p2 = parts2[i] || 0;
1541
- if (p1 > p2) return true;
1542
- if (p1 < p2) return false;
1543
- }
1544
- return false;
1545
- }
1546
- async function checkLatestVersion() {
1547
- try {
1548
- const controller = new AbortController();
1549
- const timeout = setTimeout(() => controller.abort(), 2e3);
1550
- const response = await fetch("https://registry.npmjs.org/ccgather/latest", {
1551
- signal: controller.signal
1552
- });
1553
- clearTimeout(timeout);
1554
- if (!response.ok) return null;
1555
- const data = await response.json();
1556
- return data.version;
1557
- } catch {
1558
- return null;
1559
- }
1560
- }
1561
- async function promptForUpdate(latestVersion) {
1562
- console.log();
1563
- console.log(
1564
- ` ${import_chalk3.default.yellow("\u26A0")} ${import_chalk3.default.yellow("New version")} ${import_chalk3.default.green(latestVersion)} ${import_chalk3.default.yellow("available!")} ${import_chalk3.default.dim(`(current: ${VERSION})`)}`
1565
- );
1566
- console.log();
1567
- const { shouldUpdate } = await import_inquirer3.default.prompt([
1568
- {
1569
- type: "confirm",
1570
- name: "shouldUpdate",
1571
- message: `Update to ${import_chalk3.default.green(latestVersion)} now?`,
1572
- default: true
1573
- }
1574
- ]);
1575
- if (shouldUpdate) {
1576
- console.log();
1577
- console.log(` ${import_chalk3.default.cyan("\u2192")} Updating to ${import_chalk3.default.green(`ccgather@${latestVersion}`)}...`);
1578
- console.log();
1579
- const { spawn } = await import("child_process");
1580
- const child = spawn("npx", ["--yes", `ccgather@${latestVersion}`], {
1581
- stdio: "inherit",
1582
- shell: true
1583
- });
1584
- child.on("close", (code) => {
1585
- process.exit(code || 0);
1586
- });
1587
- return true;
1588
- }
1589
- return false;
1590
- }
1591
1552
  var program = new import_commander.Command();
1592
1553
  program.name("ccgather").description("Submit your Claude Code usage to the CCgather leaderboard").version(VERSION);
1593
1554
  async function showMainMenu() {
1594
1555
  await printAnimatedHeader();
1595
- const latestVersion = await checkLatestVersion();
1596
- if (latestVersion && isNewerVersion(latestVersion, VERSION)) {
1597
- const willUpdate = await promptForUpdate(latestVersion);
1598
- if (willUpdate) {
1599
- await new Promise(() => {
1600
- });
1601
- }
1602
- }
1603
1556
  if (!isAuthenticated()) {
1604
1557
  console.log(colors.warning("\n \u{1F510} Authentication required\n"));
1605
1558
  console.log(colors.dim(" To submit your Claude Code usage, you need to log in first.\n"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccgather",
3
- "version": "1.3.55",
3
+ "version": "1.3.57",
4
4
  "description": "CLI tool for syncing Claude Code usage data to CCgather leaderboard",
5
5
  "bin": {
6
6
  "ccgather": "dist/index.js",