ccclub 0.2.60 → 0.2.62
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.
- package/dist/index.js +10 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -726,6 +726,7 @@ async function rankCommand(options) {
|
|
|
726
726
|
Usage: ccclub -d <period>
|
|
727
727
|
|
|
728
728
|
Options:
|
|
729
|
+
${chalk5.white("ccclub -d 1")} Yesterday
|
|
729
730
|
${chalk5.white("ccclub -d 7")} Last 7 days
|
|
730
731
|
${chalk5.white("ccclub -d 30")} Last 30 days
|
|
731
732
|
${chalk5.white("ccclub -d all")} All time
|
|
@@ -736,7 +737,7 @@ async function rankCommand(options) {
|
|
|
736
737
|
console.log(DAYS_HINT);
|
|
737
738
|
return;
|
|
738
739
|
}
|
|
739
|
-
const DAYS_MAP = { "7": "weekly", "30": "monthly", "all": "all-time" };
|
|
740
|
+
const DAYS_MAP = { "1": "yesterday", "7": "weekly", "30": "monthly", "all": "all-time" };
|
|
740
741
|
const mapped = DAYS_MAP[options.days];
|
|
741
742
|
if (!mapped) {
|
|
742
743
|
console.log(chalk5.red(`
|
|
@@ -782,7 +783,7 @@ async function rankCommand(options) {
|
|
|
782
783
|
const data = await res.json();
|
|
783
784
|
if (i === 0) spinner.stop();
|
|
784
785
|
printGroup(data, code, period, config, options.cache);
|
|
785
|
-
const range = period === "weekly" ? "7d" : period === "monthly" || period === "all-time" ? "30d" : "24h";
|
|
786
|
+
const range = period === "weekly" ? "7d" : period === "monthly" || period === "all-time" ? "30d" : period === "yesterday" ? "yesterday" : "24h";
|
|
786
787
|
await printActivity(config.apiUrl, code, range);
|
|
787
788
|
if (i < codes.length - 1) console.log("");
|
|
788
789
|
}
|
|
@@ -820,7 +821,7 @@ function printGroup(data, code, period, config, showCache = false) {
|
|
|
820
821
|
}
|
|
821
822
|
console.log(chalk5.bold(`
|
|
822
823
|
${data.group.name}`));
|
|
823
|
-
const periodLabel = { daily: "TODAY", weekly: "7 DAYS", monthly: "30 DAYS", "all-time": "ALL TIME" };
|
|
824
|
+
const periodLabel = { daily: "TODAY", yesterday: "YESTERDAY", weekly: "7 DAYS", monthly: "30 DAYS", "all-time": "ALL TIME" };
|
|
824
825
|
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
|
|
825
826
|
`));
|
|
826
827
|
const hasPlan = data.rankings.some((r) => r.plan);
|
|
@@ -888,7 +889,7 @@ async function printActivity(apiUrl, code, range) {
|
|
|
888
889
|
if (active.length === 0) return;
|
|
889
890
|
const startMs = new Date(data.start).getTime();
|
|
890
891
|
const endMs = new Date(data.end).getTime();
|
|
891
|
-
const bucketCount = range === "24h" ? 48 : range === "7d" ? 28 : 30;
|
|
892
|
+
const bucketCount = range === "24h" || range === "yesterday" ? 48 : range === "7d" ? 28 : 30;
|
|
892
893
|
const bucketMs = (endMs - startMs) / bucketCount;
|
|
893
894
|
const allBuckets = [];
|
|
894
895
|
for (const user of active) {
|
|
@@ -936,7 +937,7 @@ async function printActivity(apiUrl, code, range) {
|
|
|
936
937
|
console.log(` ${chalk5.dim(name + pad)} ${spark} ${chalk5.dim("$" + total.toFixed(2))}`);
|
|
937
938
|
}
|
|
938
939
|
const axisArr = new Array(bucketCount).fill(" ");
|
|
939
|
-
if (range === "24h") {
|
|
940
|
+
if (range === "24h" || range === "yesterday") {
|
|
940
941
|
for (let b = 0; b < bucketCount; b += 12) {
|
|
941
942
|
const t = new Date(startMs + b * bucketMs);
|
|
942
943
|
const label = `${t.getHours()}h`;
|
|
@@ -1212,11 +1213,11 @@ async function hookCommand() {
|
|
|
1212
1213
|
}
|
|
1213
1214
|
|
|
1214
1215
|
// src/index.ts
|
|
1215
|
-
var VERSION = "0.2.
|
|
1216
|
+
var VERSION = "0.2.62";
|
|
1216
1217
|
startUpdateCheck(VERSION);
|
|
1217
1218
|
var program = new Command();
|
|
1218
1219
|
program.name("ccclub").description("Claude Code leaderboard among friends").version(VERSION, "-v, -V, --version");
|
|
1219
|
-
program.command("rank", { isDefault: true, hidden: true }).description("Show leaderboard").option("-d, --days [days]", "Time window: 7 | 30 | all (default: today)").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);
|
|
1220
|
+
program.command("rank", { isDefault: true, hidden: true }).description("Show leaderboard").option("-d, --days [days]", "Time window: 1 | 7 | 30 | all (default: today)").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);
|
|
1220
1221
|
program.command("init").description("Create a group and get started (first-time setup)").action(initCommand);
|
|
1221
1222
|
program.command("join").description("Join a group with a 6-letter invite code").argument("[invite-code]", "6-character invite code").action((code) => {
|
|
1222
1223
|
if (!code) {
|
|
@@ -1243,14 +1244,14 @@ program.command("show-data").description("Preview exactly what gets uploaded (pr
|
|
|
1243
1244
|
program.command("hook", { hidden: true }).description("Set up auto-sync hook").action(hookCommand);
|
|
1244
1245
|
program.addHelpText("after", `
|
|
1245
1246
|
Leaderboard options:
|
|
1246
|
-
-d <period> Time window: 7 | 30 | all (default: today)
|
|
1247
|
+
-d <period> Time window: 1 | 7 | 30 | all (default: today)
|
|
1247
1248
|
-g <code> Show a specific group
|
|
1248
1249
|
--global Global public leaderboard
|
|
1249
1250
|
--cache Include cache tokens in total
|
|
1250
1251
|
|
|
1251
1252
|
Examples:
|
|
1252
1253
|
$ ccclub Show today's leaderboard (default)
|
|
1253
|
-
$ ccclub -d 7|30|all
|
|
1254
|
+
$ ccclub -d 1|7|30|all Time window (default: today)
|
|
1254
1255
|
$ ccclub --global Global public leaderboard
|
|
1255
1256
|
$ ccclub sync --force Force full re-sync of all data
|
|
1256
1257
|
`);
|