ccgather 1.3.45 → 1.3.47
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 +14 -84
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -145,14 +145,6 @@ function formatNumber(num) {
|
|
|
145
145
|
function formatCost(cost) {
|
|
146
146
|
return `$${cost.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
147
147
|
}
|
|
148
|
-
function getRankMedal(rank) {
|
|
149
|
-
if (rank === 1) return "\u{1F947}";
|
|
150
|
-
if (rank === 2) return "\u{1F948}";
|
|
151
|
-
if (rank === 3) return "\u{1F949}";
|
|
152
|
-
if (rank <= 10) return "\u{1F3C5}";
|
|
153
|
-
if (rank <= 100) return "\u{1F396}\uFE0F";
|
|
154
|
-
return "\u{1F4CA}";
|
|
155
|
-
}
|
|
156
148
|
function getCCplanBadge(ccplan) {
|
|
157
149
|
if (!ccplan) return "";
|
|
158
150
|
const badges = {
|
|
@@ -391,7 +383,7 @@ var init_ui = __esm({
|
|
|
391
383
|
"src/lib/ui.ts"() {
|
|
392
384
|
"use strict";
|
|
393
385
|
import_chalk = __toESM(require("chalk"));
|
|
394
|
-
VERSION = true ? "1.3.
|
|
386
|
+
VERSION = true ? "1.3.47" : "0.0.0";
|
|
395
387
|
colors = {
|
|
396
388
|
primary: import_chalk.default.hex("#DA7756"),
|
|
397
389
|
// Claude coral
|
|
@@ -1353,7 +1345,7 @@ async function submit(options) {
|
|
|
1353
1345
|
short: "Free"
|
|
1354
1346
|
},
|
|
1355
1347
|
{
|
|
1356
|
-
name: `${colors.dim("?")}
|
|
1348
|
+
name: `${colors.dim("?")} Can't remember ${colors.dim("(submit as Free)")}`,
|
|
1357
1349
|
value: "free_default",
|
|
1358
1350
|
short: "Free (default)"
|
|
1359
1351
|
}
|
|
@@ -1494,8 +1486,8 @@ async function submit(options) {
|
|
|
1494
1486
|
}
|
|
1495
1487
|
}
|
|
1496
1488
|
|
|
1497
|
-
// src/
|
|
1498
|
-
|
|
1489
|
+
// src/index.ts
|
|
1490
|
+
init_ui();
|
|
1499
1491
|
init_config();
|
|
1500
1492
|
|
|
1501
1493
|
// src/lib/api.ts
|
|
@@ -1530,75 +1522,7 @@ async function getStatus() {
|
|
|
1530
1522
|
return fetchApi("/cli/status");
|
|
1531
1523
|
}
|
|
1532
1524
|
|
|
1533
|
-
// src/commands/status.ts
|
|
1534
|
-
init_ui();
|
|
1535
|
-
async function status(options) {
|
|
1536
|
-
if (!isAuthenticated()) {
|
|
1537
|
-
console.log(`
|
|
1538
|
-
${error("Not authenticated.")}`);
|
|
1539
|
-
process.exit(1);
|
|
1540
|
-
}
|
|
1541
|
-
const spinner = (0, import_ora3.default)({
|
|
1542
|
-
text: "Fetching your stats...",
|
|
1543
|
-
color: "cyan"
|
|
1544
|
-
}).start();
|
|
1545
|
-
const result = await getStatus();
|
|
1546
|
-
if (!result.success) {
|
|
1547
|
-
spinner.fail(colors.error("Failed to fetch status"));
|
|
1548
|
-
console.log(`
|
|
1549
|
-
${error(result.error || "Unknown error")}
|
|
1550
|
-
`);
|
|
1551
|
-
process.exit(1);
|
|
1552
|
-
}
|
|
1553
|
-
const stats = result.data;
|
|
1554
|
-
const config = getConfig();
|
|
1555
|
-
const username = config.get("username");
|
|
1556
|
-
spinner.succeed(colors.success("Status retrieved"));
|
|
1557
|
-
console.log(header("Your CCgather Stats", "\u{1F4CA}"));
|
|
1558
|
-
const levelInfo = getLevelInfo(stats.totalTokens);
|
|
1559
|
-
const medal = getRankMedal(stats.rank);
|
|
1560
|
-
console.log();
|
|
1561
|
-
console.log(` \u{1F30D} ${colors.muted("Global")} ${medal} ${colors.white.bold(`#${stats.rank}`)}`);
|
|
1562
|
-
if (stats.countryRank && stats.countryCode) {
|
|
1563
|
-
const countryFlag = countryCodeToFlag(stats.countryCode);
|
|
1564
|
-
const countryMedal = getRankMedal(stats.countryRank);
|
|
1565
|
-
console.log(
|
|
1566
|
-
` ${countryFlag} ${colors.muted("Country")} ${countryMedal} ${colors.white.bold(`#${stats.countryRank}`)}`
|
|
1567
|
-
);
|
|
1568
|
-
}
|
|
1569
|
-
console.log(` ${colors.dim(`Top ${stats.percentile.toFixed(1)}% globally`)}`);
|
|
1570
|
-
console.log();
|
|
1571
|
-
console.log(
|
|
1572
|
-
` ${levelInfo.icon} ${levelInfo.color(`Level ${levelInfo.level} - ${levelInfo.name}`)}`
|
|
1573
|
-
);
|
|
1574
|
-
if (stats.tier) {
|
|
1575
|
-
const badge = getCCplanBadge(stats.tier);
|
|
1576
|
-
if (badge) {
|
|
1577
|
-
console.log(` ${badge}`);
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
console.log();
|
|
1581
|
-
const statsLines = [
|
|
1582
|
-
`${colors.muted("Total Tokens")} ${colors.primary(formatNumber(stats.totalTokens))}`,
|
|
1583
|
-
`${colors.muted("Total Spent")} ${colors.success(formatCost(stats.totalSpent))}`,
|
|
1584
|
-
`${colors.muted("CCplan")} ${colors.cyan(stats.tier || "Unknown")}`
|
|
1585
|
-
];
|
|
1586
|
-
console.log(createBox(statsLines));
|
|
1587
|
-
if (stats.badges && stats.badges.length > 0) {
|
|
1588
|
-
console.log();
|
|
1589
|
-
console.log(` ${colors.muted("Badges")}`);
|
|
1590
|
-
console.log(` ${stats.badges.join(" ")}`);
|
|
1591
|
-
}
|
|
1592
|
-
const leaderboardUrl = `https://ccgather.com/leaderboard?u=${username}`;
|
|
1593
|
-
console.log();
|
|
1594
|
-
console.log(colors.dim(" \u2500".repeat(25)));
|
|
1595
|
-
console.log(` ${colors.muted("View on leaderboard:")} ${link(leaderboardUrl)}`);
|
|
1596
|
-
console.log();
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
1525
|
// src/index.ts
|
|
1600
|
-
init_ui();
|
|
1601
|
-
init_config();
|
|
1602
1526
|
function isNewerVersion(v1, v2) {
|
|
1603
1527
|
const parts1 = v1.split(".").map(Number);
|
|
1604
1528
|
const parts2 = v2.split(".").map(Number);
|
|
@@ -1719,7 +1643,7 @@ async function showMenuOnly() {
|
|
|
1719
1643
|
message: "What would you like to do?",
|
|
1720
1644
|
choices: [
|
|
1721
1645
|
{ name: `\u{1F4E4} ${colors.white("Submit usage data")}`, value: "submit" },
|
|
1722
|
-
{ name: `\u{
|
|
1646
|
+
{ name: `\u{1F310} ${colors.white("Open leaderboard")}`, value: "leaderboard" },
|
|
1723
1647
|
{ name: `\u2699\uFE0F ${colors.white("Settings")}`, value: "settings" }
|
|
1724
1648
|
],
|
|
1725
1649
|
loop: false
|
|
@@ -1731,10 +1655,16 @@ async function showMenuOnly() {
|
|
|
1731
1655
|
await dotAnimation("Preparing", 400);
|
|
1732
1656
|
await submit({});
|
|
1733
1657
|
break;
|
|
1734
|
-
case "
|
|
1735
|
-
|
|
1736
|
-
|
|
1658
|
+
case "leaderboard": {
|
|
1659
|
+
const cfg = getConfig();
|
|
1660
|
+
const username = cfg.get("username");
|
|
1661
|
+
const leaderboardUrl = username ? `https://ccgather.com/leaderboard?u=${username}` : "https://ccgather.com/leaderboard";
|
|
1662
|
+
console.log(colors.dim(` Opening ${leaderboardUrl}...
|
|
1663
|
+
`));
|
|
1664
|
+
const open2 = (await import("open")).default;
|
|
1665
|
+
await open2(leaderboardUrl);
|
|
1737
1666
|
break;
|
|
1667
|
+
}
|
|
1738
1668
|
case "settings":
|
|
1739
1669
|
await showSettingsMenu();
|
|
1740
1670
|
break;
|