ccclub 0.2.52 → 0.2.53

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 +26 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -441,22 +441,32 @@ async function doSync(firstSync = false, silent = false) {
441
441
  return;
442
442
  }
443
443
  if (spinner) spinner.text = `Uploading ${blocksToSync.length} blocks...`;
444
- const res = await fetch(`${config.apiUrl}/api/sync`, {
445
- method: "POST",
446
- headers: {
447
- "Content-Type": "application/json",
448
- Authorization: `Bearer ${config.token}`
449
- },
450
- body: JSON.stringify({ blocks: blocksToSync }),
451
- signal: AbortSignal.timeout(3e4)
452
- });
453
- if (!res.ok) {
454
- const errBody = await res.json().catch(() => ({ error: res.statusText }));
455
- if (spinner) spinner.fail(`Sync failed: ${errBody.error}`);
456
- if (silent) throw new Error(`sync failed: ${res.status}`);
457
- return;
444
+ const BATCH_SIZE = 400;
445
+ let totalSynced = 0;
446
+ for (let i = 0; i < blocksToSync.length; i += BATCH_SIZE) {
447
+ const batch = blocksToSync.slice(i, i + BATCH_SIZE);
448
+ if (spinner && blocksToSync.length > BATCH_SIZE) {
449
+ spinner.text = `Uploading blocks ${i + 1}\u2013${i + batch.length} of ${blocksToSync.length}...`;
450
+ }
451
+ const res = await fetch(`${config.apiUrl}/api/sync`, {
452
+ method: "POST",
453
+ headers: {
454
+ "Content-Type": "application/json",
455
+ Authorization: `Bearer ${config.token}`
456
+ },
457
+ body: JSON.stringify({ blocks: batch }),
458
+ signal: AbortSignal.timeout(3e4)
459
+ });
460
+ if (!res.ok) {
461
+ const errBody = await res.json().catch(() => ({ error: res.statusText }));
462
+ if (spinner) spinner.fail(`Sync failed: ${errBody.error}`);
463
+ if (silent) throw new Error(`sync failed: ${res.status}`);
464
+ return;
465
+ }
466
+ const batchData = await res.json();
467
+ totalSynced += batchData.synced;
458
468
  }
459
- const data = await res.json();
469
+ const data = { synced: totalSynced };
460
470
  const latest = blocksToSync[blocksToSync.length - 1];
461
471
  await writeFile3(lastSyncPath, latest.blockStart);
462
472
  await writeFile3(getSyncVersionPath(), SYNC_FORMAT_VERSION);
@@ -1129,7 +1139,7 @@ async function hookCommand() {
1129
1139
  }
1130
1140
 
1131
1141
  // src/index.ts
1132
- var VERSION = "0.2.52";
1142
+ var VERSION = "0.2.53";
1133
1143
  startUpdateCheck(VERSION);
1134
1144
  var program = new Command();
1135
1145
  program.name("ccclub").description("Compare Claude Code usage with friends").version(VERSION, "-v, -V, --version");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccclub",
3
- "version": "0.2.52",
3
+ "version": "0.2.53",
4
4
  "type": "module",
5
5
  "description": "See how much Claude Code you and your friends are using",
6
6
  "bin": {