ccclub 0.2.76 → 0.2.78
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 +19 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -533,6 +533,15 @@ async function doSync(firstSync = false, silent = false) {
|
|
|
533
533
|
if (blocksToSync.length === 0) {
|
|
534
534
|
if (spinner) spinner.succeed("Already up to date");
|
|
535
535
|
await writeFile3(getSyncVersionPath(), SYNC_FORMAT_VERSION);
|
|
536
|
+
if (usageSnapshot) {
|
|
537
|
+
fetch(`${config.apiUrl}/api/usage`, {
|
|
538
|
+
method: "POST",
|
|
539
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${config.token}` },
|
|
540
|
+
body: JSON.stringify({ usageSnapshot }),
|
|
541
|
+
signal: AbortSignal.timeout(8e3)
|
|
542
|
+
}).catch(() => {
|
|
543
|
+
});
|
|
544
|
+
}
|
|
536
545
|
return;
|
|
537
546
|
}
|
|
538
547
|
if (spinner) spinner.text = `Uploading ${blocksToSync.length} blocks...`;
|
|
@@ -883,6 +892,15 @@ async function rankCommand(options) {
|
|
|
883
892
|
);
|
|
884
893
|
spinner.stop();
|
|
885
894
|
const localSnapshot = await localUsagePromise;
|
|
895
|
+
if (localSnapshot) {
|
|
896
|
+
fetch(`${config.apiUrl}/api/usage`, {
|
|
897
|
+
method: "POST",
|
|
898
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${config.token}` },
|
|
899
|
+
body: JSON.stringify({ usageSnapshot: localSnapshot }),
|
|
900
|
+
signal: AbortSignal.timeout(8e3)
|
|
901
|
+
}).catch(() => {
|
|
902
|
+
});
|
|
903
|
+
}
|
|
886
904
|
if (process.env.CCCLUB_DEBUG) {
|
|
887
905
|
console.error("[usage-debug] localSnapshot:", localSnapshot);
|
|
888
906
|
console.error("[usage-debug] config.userId:", config.userId);
|
|
@@ -1342,7 +1360,7 @@ async function hookCommand() {
|
|
|
1342
1360
|
}
|
|
1343
1361
|
|
|
1344
1362
|
// src/index.ts
|
|
1345
|
-
var VERSION = "0.2.
|
|
1363
|
+
var VERSION = "0.2.78";
|
|
1346
1364
|
startUpdateCheck(VERSION);
|
|
1347
1365
|
var program = new Command();
|
|
1348
1366
|
program.name("ccclub").description("Claude Code leaderboard among friends").version(VERSION, "-v, -V, --version");
|