ccclub 0.2.21 → 0.2.23

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 +31 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -667,10 +667,10 @@ async function rankCommand(options) {
667
667
  }
668
668
  const data = await res.json();
669
669
  if (i === 0) spinner.stop();
670
- printGroup(data, code, period, config);
670
+ printGroup(data, code, period, config, options.cache);
671
671
  if (i < codes.length - 1) console.log("");
672
672
  }
673
- console.log(chalk5.dim("\n Data syncs automatically when each Claude Code session ends."));
673
+ console.log(chalk5.dim("\n Tokens = input + output ") + chalk5.yellow("(cache excluded)") + chalk5.dim(". Use ") + chalk5.white("--cache") + chalk5.dim(" to include cache tokens."));
674
674
  } catch (err) {
675
675
  spinner.fail(`Error: ${err instanceof Error ? err.message : err}`);
676
676
  }
@@ -686,7 +686,7 @@ function formatTokens(n) {
686
686
  }
687
687
  return String(n);
688
688
  }
689
- function printGroup(data, code, period, config) {
689
+ function printGroup(data, code, period, config, showCache = false) {
690
690
  if (data.rankings.length === 0) {
691
691
  console.log(chalk5.bold(`
692
692
  ${data.group.name}`));
@@ -705,15 +705,34 @@ function printGroup(data, code, period, config) {
705
705
  });
706
706
  for (const entry of data.rankings) {
707
707
  const isMe = entry.userId === config.userId;
708
+ const tokens = showCache ? entry.totalTokens : entry.inputTokens + entry.outputTokens;
708
709
  const marker = isMe ? chalk5.green("\u2192") : " ";
709
- const name = isMe ? chalk5.green.bold(entry.displayName) : entry.displayName;
710
- const rankColor = entry.rank <= 3 ? chalk5.yellow : chalk5.white;
710
+ let rankC;
711
+ let nameC;
712
+ let dataC;
713
+ if (isMe) {
714
+ rankC = chalk5.green.bold;
715
+ nameC = chalk5.green.bold;
716
+ dataC = chalk5.green;
717
+ } else if (entry.rank === 1) {
718
+ rankC = chalk5.yellow.bold;
719
+ nameC = chalk5.yellow;
720
+ dataC = chalk5.white;
721
+ } else if (entry.rank <= 3) {
722
+ rankC = chalk5.yellow;
723
+ nameC = chalk5.white;
724
+ dataC = chalk5.white;
725
+ } else {
726
+ rankC = chalk5.dim;
727
+ nameC = chalk5.white;
728
+ dataC = chalk5.dim;
729
+ }
711
730
  table.push([
712
- `${marker}${rankColor(String(entry.rank))}`,
713
- name,
714
- formatTokens(entry.inputTokens + entry.outputTokens),
715
- `$${entry.costUSD.toFixed(2)}`,
716
- String(entry.chatCount)
731
+ `${marker}${rankC(String(entry.rank))}`,
732
+ nameC(entry.displayName),
733
+ dataC(formatTokens(tokens)),
734
+ dataC(`$${entry.costUSD.toFixed(2)}`),
735
+ dataC(String(entry.chatCount))
717
736
  ]);
718
737
  }
719
738
  console.log(table.toString());
@@ -885,11 +904,11 @@ async function hookCommand() {
885
904
 
886
905
  // src/index.ts
887
906
  var program = new Command();
888
- program.name("ccclub").description("CCClub - Compare Claude Code usage with friends").version("0.2.21");
907
+ program.name("ccclub").description("CCClub - Compare Claude Code usage with friends").version("0.2.23");
889
908
  program.command("init").description("Initialize CCClub (one-time setup)").action(initCommand);
890
909
  program.command("join").description("Join a friend's group").argument("<invite-code>", "6-character invite code").action(joinCommand);
891
910
  program.command("sync").description("Sync local usage data to server").option("-s, --silent", "No output (used by auto-sync hook)").option("-f, --full", "Force full re-sync of all data").action(syncCommand);
892
- program.command("rank", { isDefault: true }).description("Show leaderboard rankings").option("-p, --period <period>", "daily, weekly, monthly, all-time", "daily").option("-g, --group <code>", "Group invite code").option("--global", "Show global public ranking").action(rankCommand);
911
+ program.command("rank", { isDefault: true }).description("Show leaderboard rankings").option("-p, --period <period>", "daily, weekly, monthly, all-time", "daily").option("-g, --group <code>", "Group invite code").option("--global", "Show global public ranking").option("--cache", "Show token count including cache").action(rankCommand);
893
912
  program.command("profile").description("View or update your profile").option("-n, --name <name>", "Set display name").option("--avatar <url>", "Set avatar URL (empty string to reset)").option("--public", "Set profile visibility to public").option("--private", "Set profile visibility to private").action(profileCommand);
894
913
  program.command("create").description("Create a new group").action(createGroupCommand);
895
914
  program.command("show-data").description("Show exactly what data CCClub uploads (privacy audit)").action(showDataCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccclub",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "type": "module",
5
5
  "description": "See how much Claude Code you and your friends are using",
6
6
  "bin": {