ccclub 0.2.81 → 0.2.83

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 +14 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -855,6 +855,7 @@ async function getUpdateResult() {
855
855
  }
856
856
 
857
857
  // src/commands/rank.ts
858
+ var ACTIVE_THRESHOLD_MS = 15 * 60 * 1e3;
858
859
  async function rankCommand(options) {
859
860
  const config = await requireConfig();
860
861
  if (!isHookInstalled()) await installHook();
@@ -989,14 +990,20 @@ function printGroup(data, code, period, config, showCache = false, showAll = fal
989
990
  console.log(chalk6.bold(`
990
991
  ${data.group.name}`));
991
992
  const periodLabel = { daily: "TODAY", yesterday: "YESTERDAY", weekly: "7 DAYS", monthly: "30 DAYS", "all-time": "ALL TIME" };
992
- console.log(chalk6.dim(` ${periodLabel[period] || period.toUpperCase()} \xB7 ${data.start.slice(0, 10)} \u2192 ${data.end.slice(0, 10)} \xB7 ${data.group.memberCount} members
993
- `));
993
+ const now = Date.now();
994
+ const activeCount = data.rankings.filter((r) => r.lastSync && now - new Date(r.lastSync).getTime() < ACTIVE_THRESHOLD_MS).length;
995
+ console.log(chalk6.dim(` ${periodLabel[period] || period.toUpperCase()} \xB7 ${data.start.slice(0, 10)} \u2192 ${data.end.slice(0, 10)} \xB7 ${data.group.memberCount} members`));
996
+ if (activeCount > 0) {
997
+ console.log(chalk6.green(` ${activeCount} active`));
998
+ }
999
+ console.log("");
994
1000
  const activeRankings = showAll || data.rankings.length <= 15 ? data.rankings : data.rankings.filter((r) => r.costUSD > 0 || r.userId === config.userId);
995
1001
  const hiddenCount = data.rankings.length - activeRankings.length;
996
1002
  const hasPlan = activeRankings.some((r) => r.plan);
997
1003
  const hasUsage = activeRankings.some((r) => r.usageSnapshot);
998
1004
  const head = ["#", "Name", "Cost", "Tokens"];
999
- const widths = [5, 20, 12, 10];
1005
+ const hasActive = activeRankings.some((r) => r.lastSync && now - new Date(r.lastSync).getTime() < ACTIVE_THRESHOLD_MS);
1006
+ const widths = [5, hasActive ? 30 : 20, 12, 10];
1000
1007
  if (hasPlan) {
1001
1008
  head.push("Monthly ROI");
1002
1009
  widths.push(15);
@@ -1016,12 +1023,14 @@ function printGroup(data, code, period, config, showCache = false, showAll = fal
1016
1023
  const isMe = entry.userId === config.userId;
1017
1024
  const tokens = showCache ? entry.totalTokens : entry.inputTokens + entry.outputTokens;
1018
1025
  const marker = isMe ? chalk6.green("\u2192") : " ";
1026
+ const isActive = entry.lastSync && now - new Date(entry.lastSync).getTime() < ACTIVE_THRESHOLD_MS;
1019
1027
  const id = (s) => s;
1020
1028
  const c = isMe ? chalk6.green : entry.rank === 1 ? chalk6.yellow : id;
1021
1029
  const nameC = isMe ? chalk6.green.bold : entry.rank === 1 ? chalk6.yellow.bold : id;
1030
+ const displayName = isActive ? `${entry.displayName} ${chalk6.green("(active)")}` : entry.displayName;
1022
1031
  const row = [
1023
1032
  `${marker}${c(String(entry.rank))}`,
1024
- nameC(entry.displayName),
1033
+ nameC(displayName),
1025
1034
  c(`$${entry.costUSD.toFixed(2)}`),
1026
1035
  c(formatTokens(tokens))
1027
1036
  ];
@@ -1394,7 +1403,7 @@ async function hookCommand() {
1394
1403
  }
1395
1404
 
1396
1405
  // src/index.ts
1397
- var VERSION = "0.2.81";
1406
+ var VERSION = "0.2.83";
1398
1407
  startUpdateCheck(VERSION);
1399
1408
  var program = new Command();
1400
1409
  program.name("ccclub").description("Claude Code leaderboard among friends").version(VERSION, "-v, -V, --version");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccclub",
3
- "version": "0.2.81",
3
+ "version": "0.2.83",
4
4
  "type": "module",
5
5
  "description": "Claude Code leaderboard among friends",
6
6
  "bin": {