ccclub 0.2.38 → 0.2.39

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 +18 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -380,8 +380,8 @@ function needsFullSync() {
380
380
  }
381
381
  var THROTTLE_MS = 5 * 60 * 1e3;
382
382
  async function syncCommand(options) {
383
+ const timePath = getLastSyncTimePath();
383
384
  if (options.silent && !options.full) {
384
- const timePath = getLastSyncTimePath();
385
385
  if (existsSync3(timePath)) {
386
386
  try {
387
387
  const ts = parseInt(readFileSync2(timePath, "utf-8").trim(), 10);
@@ -394,10 +394,20 @@ async function syncCommand(options) {
394
394
  } catch {
395
395
  }
396
396
  }
397
- await doSync(options.full || false, options.silent);
397
+ try {
398
+ await doSync(options.full || false, options.silent);
399
+ } catch {
400
+ if (options.silent) {
401
+ try {
402
+ writeFileSync(timePath, "0");
403
+ } catch {
404
+ }
405
+ }
406
+ }
398
407
  }
399
408
  async function doSync(firstSync = false, silent = false) {
400
- const config = await requireConfig();
409
+ const config = silent ? await loadConfig() : await requireConfig();
410
+ if (!config) return;
401
411
  if (!firstSync && needsFullSync()) {
402
412
  firstSync = true;
403
413
  }
@@ -440,8 +450,9 @@ async function doSync(firstSync = false, silent = false) {
440
450
  signal: AbortSignal.timeout(3e4)
441
451
  });
442
452
  if (!res.ok) {
443
- const err = await res.json().catch(() => ({ error: res.statusText }));
444
- if (spinner) spinner.fail(`Sync failed: ${err.error}`);
453
+ const errBody = await res.json().catch(() => ({ error: res.statusText }));
454
+ if (spinner) spinner.fail(`Sync failed: ${errBody.error}`);
455
+ if (silent) throw new Error(`sync failed: ${res.status}`);
445
456
  return;
446
457
  }
447
458
  const data = await res.json();
@@ -457,6 +468,7 @@ async function doSync(firstSync = false, silent = false) {
457
468
  }
458
469
  } catch (err) {
459
470
  if (spinner) spinner.fail(`Sync error: ${err instanceof Error ? err.message : err}`);
471
+ if (silent) throw err;
460
472
  }
461
473
  }
462
474
 
@@ -1069,7 +1081,7 @@ async function hookCommand() {
1069
1081
  }
1070
1082
 
1071
1083
  // src/index.ts
1072
- var VERSION = "0.2.38";
1084
+ var VERSION = "0.2.39";
1073
1085
  startUpdateCheck(VERSION);
1074
1086
  var program = new Command();
1075
1087
  program.name("ccclub").description("CCClub - Compare Claude Code usage with friends").version(VERSION);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccclub",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
4
4
  "type": "module",
5
5
  "description": "See how much Claude Code you and your friends are using",
6
6
  "bin": {