ccclub 0.2.15 → 0.2.16
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 +14 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -646,6 +646,17 @@ async function rankCommand(options) {
|
|
|
646
646
|
spinner.fail(`Error: ${err instanceof Error ? err.message : err}`);
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
+
function formatTokens(n) {
|
|
650
|
+
if (n >= 1e6) {
|
|
651
|
+
const m = n / 1e6;
|
|
652
|
+
return m % 1 === 0 ? `${m}M` : `${parseFloat(m.toFixed(1))}M`;
|
|
653
|
+
}
|
|
654
|
+
if (n >= 1e3) {
|
|
655
|
+
const k = n / 1e3;
|
|
656
|
+
return k % 1 === 0 ? `${k}K` : `${parseFloat(k.toFixed(1))}K`;
|
|
657
|
+
}
|
|
658
|
+
return String(n);
|
|
659
|
+
}
|
|
649
660
|
function printGroup(data, code, period, config) {
|
|
650
661
|
if (data.rankings.length === 0) {
|
|
651
662
|
console.log(chalk5.bold(`
|
|
@@ -661,7 +672,7 @@ function printGroup(data, code, period, config) {
|
|
|
661
672
|
const table = new Table({
|
|
662
673
|
head: ["#", "Name", "Tokens", "Cost", "Chats"].map((h) => chalk5.cyan(h)),
|
|
663
674
|
style: { head: [], border: [] },
|
|
664
|
-
colWidths: [5, 20,
|
|
675
|
+
colWidths: [5, 20, 10, 12, 8]
|
|
665
676
|
});
|
|
666
677
|
for (const entry of data.rankings) {
|
|
667
678
|
const isMe = entry.userId === config.userId;
|
|
@@ -671,7 +682,7 @@ function printGroup(data, code, period, config) {
|
|
|
671
682
|
table.push([
|
|
672
683
|
`${marker}${rankColor(String(entry.rank))}`,
|
|
673
684
|
name,
|
|
674
|
-
entry.totalTokens
|
|
685
|
+
formatTokens(entry.totalTokens),
|
|
675
686
|
`$${entry.costUSD.toFixed(2)}`,
|
|
676
687
|
String(entry.chatCount)
|
|
677
688
|
]);
|
|
@@ -843,7 +854,7 @@ async function hookCommand() {
|
|
|
843
854
|
|
|
844
855
|
// src/index.ts
|
|
845
856
|
var program = new Command();
|
|
846
|
-
program.name("ccclub").description("CCClub - Compare Claude Code usage with friends").version("0.2.
|
|
857
|
+
program.name("ccclub").description("CCClub - Compare Claude Code usage with friends").version("0.2.16");
|
|
847
858
|
program.command("init").description("Initialize CCClub (one-time setup)").action(initCommand);
|
|
848
859
|
program.command("join").description("Join a friend's group").argument("<invite-code>", "6-character invite code").action(joinCommand);
|
|
849
860
|
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);
|