ccclub 0.2.36 → 0.2.38
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 +25 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -782,8 +782,8 @@ function printGroup(data, code, period, config, showCache = false) {
|
|
|
782
782
|
const head = ["#", "Name", "Tokens", "Cost"];
|
|
783
783
|
const widths = [5, 20, 10, 12];
|
|
784
784
|
if (hasPlan) {
|
|
785
|
-
head.push("
|
|
786
|
-
widths.push(
|
|
785
|
+
head.push("Monthly ROI");
|
|
786
|
+
widths.push(15);
|
|
787
787
|
}
|
|
788
788
|
head.push("Chats");
|
|
789
789
|
widths.push(8);
|
|
@@ -808,14 +808,13 @@ function printGroup(data, code, period, config, showCache = false) {
|
|
|
808
808
|
if (hasPlan) {
|
|
809
809
|
if (entry.plan && entry.plan !== "api") {
|
|
810
810
|
const price = PLAN_PRICES[entry.plan];
|
|
811
|
-
const label = PLAN_LABELS[entry.plan] || entry.plan;
|
|
812
811
|
const monthly = entry.monthlyCostUSD || 0;
|
|
813
812
|
const roi = price > 0 ? Math.round(monthly / price * 100) : 0;
|
|
814
|
-
const roiStr =
|
|
813
|
+
const roiStr = `$${price}/${roi}%`;
|
|
815
814
|
const roiC = roi >= 100 ? chalk5.green.bold(roiStr) : roi >= 50 ? chalk5.yellow(roiStr) : chalk5.dim(roiStr);
|
|
816
|
-
row.push(
|
|
815
|
+
row.push(roiC);
|
|
817
816
|
} else if (entry.plan === "api") {
|
|
818
|
-
row.push(
|
|
817
|
+
row.push(chalk5.dim("API"));
|
|
819
818
|
} else {
|
|
820
819
|
row.push(chalk5.dim("\u2014"));
|
|
821
820
|
}
|
|
@@ -825,6 +824,12 @@ function printGroup(data, code, period, config, showCache = false) {
|
|
|
825
824
|
}
|
|
826
825
|
console.log(table.toString());
|
|
827
826
|
console.log(chalk5.dim(` Dashboard: ${config.apiUrl}/g/${code}`));
|
|
827
|
+
if (hasPlan) {
|
|
828
|
+
const me = data.rankings.find((r) => r.userId === config.userId);
|
|
829
|
+
if (me && !me.plan) {
|
|
830
|
+
console.log(chalk5.dim(" Set your plan: ") + chalk5.white("ccclub profile --plan pro|max100|max200|api"));
|
|
831
|
+
}
|
|
832
|
+
}
|
|
828
833
|
}
|
|
829
834
|
var SPARK_CHARS = "\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588";
|
|
830
835
|
async function printActivity(apiUrl, code, range) {
|
|
@@ -916,12 +921,23 @@ async function profileCommand(options) {
|
|
|
916
921
|
}
|
|
917
922
|
return;
|
|
918
923
|
}
|
|
924
|
+
const validPlans = ["pro", "max100", "max200", "api"];
|
|
925
|
+
if (options.plan !== void 0) {
|
|
926
|
+
const p = options.plan.toLowerCase();
|
|
927
|
+
if (p && p !== "none" && !validPlans.includes(p)) {
|
|
928
|
+
console.log(chalk6.red(`
|
|
929
|
+
Invalid plan: "${options.plan}"`));
|
|
930
|
+
console.log(chalk6.dim(" Valid options: ") + chalk6.white("pro") + chalk6.dim(" ($20), ") + chalk6.white("max100") + chalk6.dim(" ($100), ") + chalk6.white("max200") + chalk6.dim(" ($200), ") + chalk6.white("api"));
|
|
931
|
+
console.log(chalk6.dim(" To clear: ") + chalk6.white("ccclub profile --plan none"));
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
919
935
|
const body = {};
|
|
920
936
|
if (options.name !== void 0) body.displayName = options.name;
|
|
921
937
|
if (options.avatar !== void 0) body.avatar = options.avatar;
|
|
922
938
|
if (options.public) body.visibility = "public";
|
|
923
939
|
if (options.private) body.visibility = "private";
|
|
924
|
-
if (options.plan !== void 0) body.plan = options.plan;
|
|
940
|
+
if (options.plan !== void 0) body.plan = options.plan === "none" ? "" : options.plan;
|
|
925
941
|
const spinner = ora5("Updating profile...").start();
|
|
926
942
|
try {
|
|
927
943
|
const res = await fetch(`${config.apiUrl}/api/profile`, {
|
|
@@ -1053,7 +1069,7 @@ async function hookCommand() {
|
|
|
1053
1069
|
}
|
|
1054
1070
|
|
|
1055
1071
|
// src/index.ts
|
|
1056
|
-
var VERSION = "0.2.
|
|
1072
|
+
var VERSION = "0.2.38";
|
|
1057
1073
|
startUpdateCheck(VERSION);
|
|
1058
1074
|
var program = new Command();
|
|
1059
1075
|
program.name("ccclub").description("CCClub - Compare Claude Code usage with friends").version(VERSION);
|
|
@@ -1062,7 +1078,7 @@ program.command("join").description("Join a friend's group").argument("<invite-c
|
|
|
1062
1078
|
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);
|
|
1063
1079
|
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);
|
|
1064
1080
|
program.command("-p weekly|monthly|all-time", { hidden: false }).description("Switch period (default: daily)");
|
|
1065
|
-
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").option("--plan <plan>", "Set
|
|
1081
|
+
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").option("--plan <plan>", "Set plan: pro ($20), max100 ($100), max200 ($200), api, or none to clear").action(profileCommand);
|
|
1066
1082
|
program.command("create").description("Create a new group").action(createGroupCommand);
|
|
1067
1083
|
program.command("show-data").description("Show exactly what data CCClub uploads (privacy audit)").action(showDataCommand);
|
|
1068
1084
|
program.command("hook").description("Set up Claude Code hook for auto-sync on session end").action(hookCommand);
|