ccclub 0.2.48 → 0.2.49

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 +27 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -721,16 +721,29 @@ async function rankCommand(options) {
721
721
  if (needsFullSync()) {
722
722
  await doSync(true, true);
723
723
  }
724
- const validPeriods = ["daily", "weekly", "monthly", "all-time"];
725
- if (options.period === true || typeof options.period === "string" && !validPeriods.includes(options.period)) {
726
- const got = options.period === true ? "(missing)" : `"${options.period}"`;
727
- console.log(chalk5.red(`
724
+ let period = "daily";
725
+ if (options.days) {
726
+ const DAYS_MAP = { "7": "weekly", "30": "monthly", "all": "all-time" };
727
+ const mapped = DAYS_MAP[options.days];
728
+ if (!mapped) {
729
+ console.log(chalk5.red(`
730
+ Invalid value: -d ${options.days}`));
731
+ console.log(chalk5.dim(" Usage: ") + chalk5.white("ccclub -d 7 | 30 | all"));
732
+ return;
733
+ }
734
+ period = mapped;
735
+ } else if (options.period) {
736
+ const validPeriods = ["daily", "weekly", "monthly", "all-time"];
737
+ if (options.period === true || typeof options.period === "string" && !validPeriods.includes(options.period)) {
738
+ const got = options.period === true ? "(missing)" : `"${options.period}"`;
739
+ console.log(chalk5.red(`
728
740
  Invalid period: ${got}`));
729
- console.log(chalk5.dim(" Usage: ") + chalk5.white("ccclub -p daily|weekly|monthly|all-time"));
730
- return;
741
+ console.log(chalk5.dim(" Usage: ") + chalk5.white("ccclub -d 7 | 30 | all"));
742
+ return;
743
+ }
744
+ period = options.period;
731
745
  }
732
746
  const isGlobal = options.global === true;
733
- const period = options.period || "daily";
734
747
  let codes;
735
748
  if (isGlobal) {
736
749
  codes = ["global"];
@@ -797,7 +810,8 @@ function printGroup(data, code, period, config, showCache = false) {
797
810
  }
798
811
  console.log(chalk5.bold(`
799
812
  ${data.group.name}`));
800
- console.log(chalk5.dim(` ${period.toUpperCase()} \xB7 ${data.start.slice(0, 10)} \u2192 ${data.end.slice(0, 10)} \xB7 ${data.group.memberCount} members
813
+ const periodLabel = { daily: "TODAY", weekly: "7 DAYS", monthly: "30 DAYS", "all-time": "ALL TIME" };
814
+ console.log(chalk5.dim(` ${periodLabel[period] || period.toUpperCase()} \xB7 ${data.start.slice(0, 10)} \u2192 ${data.end.slice(0, 10)} \xB7 ${data.group.memberCount} members
801
815
  `));
802
816
  const hasPlan = data.rankings.some((r) => r.plan);
803
817
  const head = ["#", "Name", "Tokens", "Cost"];
@@ -1115,11 +1129,11 @@ async function hookCommand() {
1115
1129
  }
1116
1130
 
1117
1131
  // src/index.ts
1118
- var VERSION = "0.2.48";
1132
+ var VERSION = "0.2.49";
1119
1133
  startUpdateCheck(VERSION);
1120
1134
  var program = new Command();
1121
1135
  program.name("ccclub").description("Compare Claude Code usage with friends").version(VERSION, "-v, -V, --version");
1122
- program.command("rank", { isDefault: true, hidden: true }).description("Show leaderboard").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", "Include cache tokens in count").action(rankCommand);
1136
+ program.command("rank", { isDefault: true, hidden: true }).description("Show leaderboard").option("-d, --days <days>", "Time window: 7 | 30 | all").addOption(new Option("-p, --period [period]").hideHelp()).option("-g, --group <code>", "Group invite code").option("--global", "Show global public ranking").option("--cache", "Include cache tokens in count").action(rankCommand);
1123
1137
  program.command("init").description("Create a group and start tracking (first-time setup)").action(initCommand);
1124
1138
  program.command("join").description("Join a group with a 6-letter invite code").argument("<invite-code>", "6-character invite code").action(joinCommand);
1125
1139
  program.command("sync").description("Upload usage data (runs automatically after each chat)").addOption(new Option("-s, --silent").hideHelp()).option("-f, --force", "Force full re-sync of all data").addOption(new Option("--full", "Same as --force").hideHelp()).action(
@@ -1132,7 +1146,9 @@ program.command("hook", { hidden: true }).description("Set up auto-sync hook").a
1132
1146
  program.addHelpText("after", `
1133
1147
  Examples:
1134
1148
  $ ccclub Show today's leaderboard (default)
1135
- $ ccclub -p weekly Switch period: weekly | monthly | all-time
1149
+ $ ccclub -d 7 Last 7 days
1150
+ $ ccclub -d 30 Last 30 days
1151
+ $ ccclub -d all All time
1136
1152
  $ ccclub --global Global public leaderboard
1137
1153
  $ ccclub --cache Include cache tokens in total
1138
1154
  $ ccclub sync --force Force full re-sync of all data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccclub",
3
- "version": "0.2.48",
3
+ "version": "0.2.49",
4
4
  "type": "module",
5
5
  "description": "See how much Claude Code you and your friends are using",
6
6
  "bin": {