ccgather 1.3.18 → 1.3.19

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 +65 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -505,11 +505,11 @@ var import_meta = {};
505
505
  function getVersion() {
506
506
  try {
507
507
  const __dirname = (0, import_path.dirname)((0, import_url.fileURLToPath)(import_meta.url));
508
- const pkgPath = (0, import_path.join)(__dirname, "../../package.json");
508
+ const pkgPath = (0, import_path.join)(__dirname, "../package.json");
509
509
  const pkg2 = JSON.parse((0, import_fs.readFileSync)(pkgPath, "utf-8"));
510
510
  return pkg2.version;
511
511
  } catch {
512
- return "1.3.17";
512
+ return "1.3.18";
513
513
  }
514
514
  }
515
515
  var VERSION = getVersion();
@@ -805,11 +805,55 @@ async function submitToServer(data) {
805
805
  return { success: false, error: errorData.error || `HTTP ${response.status}` };
806
806
  }
807
807
  const result = await response.json();
808
- return { success: true, profileUrl: result.profileUrl };
808
+ return { ...result, success: true };
809
809
  } catch (err) {
810
810
  return { success: false, error: err instanceof Error ? err.message : "Unknown error" };
811
811
  }
812
812
  }
813
+ function getRarityColor(rarity) {
814
+ switch (rarity) {
815
+ case "legendary":
816
+ return colors.max;
817
+ // Gold
818
+ case "epic":
819
+ return colors.team;
820
+ // Purple
821
+ case "rare":
822
+ return colors.pro;
823
+ // Blue
824
+ default:
825
+ return colors.muted;
826
+ }
827
+ }
828
+ function displayNewBadges(badges) {
829
+ if (badges.length === 0) return;
830
+ console.log();
831
+ console.log(` ${colors.max("\u{1F389} NEW BADGE" + (badges.length > 1 ? "S" : "") + " UNLOCKED!")}`);
832
+ console.log();
833
+ for (const badge of badges) {
834
+ const rarityColor = getRarityColor(badge.rarity);
835
+ const rarityLabel = badge.rarity.toUpperCase();
836
+ console.log(` ${badge.icon} ${colors.white.bold(badge.name)} ${rarityColor(`[${rarityLabel}]`)}`);
837
+ console.log(` ${colors.muted(badge.description)}`);
838
+ if (badge.praise) {
839
+ console.log(` ${colors.cyan(`"${badge.praise}"`)}`);
840
+ }
841
+ console.log();
842
+ }
843
+ }
844
+ function displayBadgeProgress(progress, totalBadges) {
845
+ if (progress.length === 0) return;
846
+ console.log(` ${colors.muted("Badge Progress")} ${colors.dim(`(${totalBadges} earned)`)}`);
847
+ for (const p of progress) {
848
+ const barWidth = 16;
849
+ const filled = Math.round(p.percent / 100 * barWidth);
850
+ const empty = barWidth - filled;
851
+ const bar = colors.primary("\u2588".repeat(filled)) + colors.dim("\u2591".repeat(empty));
852
+ const badgeName = p.id.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
853
+ console.log(` ${colors.dim("\u2022")} ${colors.muted(badgeName.padEnd(18))} [${bar}] ${colors.white(`${p.percent}%`)}`);
854
+ }
855
+ console.log();
856
+ }
813
857
  async function submit(options) {
814
858
  console.log(header("Submit Usage Data", "\u{1F4E4}"));
815
859
  if (!isAuthenticated()) {
@@ -888,13 +932,28 @@ async function submit(options) {
888
932
  if (result.success) {
889
933
  submitSpinner.succeed(colors.success("Successfully submitted!"));
890
934
  console.log();
935
+ if (result.newBadges && result.newBadges.length > 0) {
936
+ displayNewBadges(result.newBadges);
937
+ }
938
+ if (result.badgeProgress && result.badgeProgress.length > 0) {
939
+ displayBadgeProgress(result.badgeProgress, result.totalBadges || 0);
940
+ }
891
941
  const leaderboardUrl = `https://ccgather.com/leaderboard?u=${username}`;
892
942
  const successLines = [
893
943
  `${colors.success("\u2713")} ${colors.white.bold("Submission Complete!")}`,
894
- "",
895
- `${colors.muted("Check your rank on the leaderboard:")}`,
896
- `${link(leaderboardUrl)}`
944
+ ""
897
945
  ];
946
+ if (result.rank) {
947
+ successLines.push(`${colors.muted("Global Rank:")} ${colors.primary(`#${result.rank}`)}`);
948
+ }
949
+ if (result.countryRank) {
950
+ successLines.push(`${colors.muted("Country Rank:")} ${colors.primary(`#${result.countryRank}`)}`);
951
+ }
952
+ if (result.rank || result.countryRank) {
953
+ successLines.push("");
954
+ }
955
+ successLines.push(`${colors.muted("Check your rank on the leaderboard:")}`);
956
+ successLines.push(`${link(leaderboardUrl)}`);
898
957
  console.log(createBox(successLines));
899
958
  console.log();
900
959
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccgather",
3
- "version": "1.3.18",
3
+ "version": "1.3.19",
4
4
  "description": "CLI tool for syncing Claude Code usage data to CCgather leaderboard",
5
5
  "bin": {
6
6
  "ccgather": "dist/index.js",