ccgather 2.0.12 → 2.0.14
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 +18 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -140,17 +140,10 @@ function formatNumber(num) {
|
|
|
140
140
|
return num.toLocaleString();
|
|
141
141
|
}
|
|
142
142
|
function formatCost(cost) {
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const badges = {
|
|
148
|
-
max: `${colors.max("\u{1F680} MAX")}`,
|
|
149
|
-
pro: `${colors.pro("\u26A1 PRO")}`,
|
|
150
|
-
team: `${colors.team("\u{1F465} TEAM")}`,
|
|
151
|
-
free: `${colors.free("\u26AA FREE")}`
|
|
152
|
-
};
|
|
153
|
-
return badges[ccplan.toLowerCase()] || "";
|
|
143
|
+
if (cost >= 1e9) return `$${(cost / 1e9).toFixed(2)}B`;
|
|
144
|
+
if (cost >= 1e6) return `$${(cost / 1e6).toFixed(2)}M`;
|
|
145
|
+
if (cost >= 1e3) return `$${(cost / 1e3).toFixed(2)}K`;
|
|
146
|
+
return `$${cost.toFixed(2)}`;
|
|
154
147
|
}
|
|
155
148
|
function getLevelInfo(tokens) {
|
|
156
149
|
for (let i = LEVELS.length - 1; i >= 0; i--) {
|
|
@@ -198,10 +191,6 @@ function getLevelProgress(tokens) {
|
|
|
198
191
|
isMaxLevel: false
|
|
199
192
|
};
|
|
200
193
|
}
|
|
201
|
-
function countryCodeToFlag(countryCode) {
|
|
202
|
-
if (!countryCode || countryCode.length !== 2) return "\u{1F310}";
|
|
203
|
-
return countryCode.toUpperCase();
|
|
204
|
-
}
|
|
205
194
|
function error(message) {
|
|
206
195
|
return `${colors.error("\u2717")} ${message}`;
|
|
207
196
|
}
|
|
@@ -288,36 +277,19 @@ async function suspenseDots(message, durationMs = 600) {
|
|
|
288
277
|
process.stdout.write("\r" + " ".repeat(50) + "\r");
|
|
289
278
|
}
|
|
290
279
|
async function printAnimatedWelcomeBox(user) {
|
|
291
|
-
const lines = [];
|
|
292
280
|
const welcomeLine = `\u{1F44B} ${colors.white.bold(`Welcome back, ${user.username}!`)}`;
|
|
293
|
-
|
|
294
|
-
const levelInfo = user.level && user.levelName && user.levelIcon ? `${user.levelIcon} Level ${user.level} \u2022 ${user.levelName}` : "";
|
|
295
|
-
const ccplanBadge = user.ccplan ? getCCplanBadge(user.ccplan) : "";
|
|
296
|
-
if (levelInfo || ccplanBadge) {
|
|
297
|
-
lines.push(`${levelInfo}${ccplanBadge ? ` ${ccplanBadge}` : ""}`);
|
|
298
|
-
}
|
|
299
|
-
if (user.globalRank) {
|
|
300
|
-
lines.push(`\u{1F30D} Global Rank: ${colors.primary(`#${user.globalRank}`)}`);
|
|
301
|
-
}
|
|
302
|
-
if (user.countryRank && user.countryCode) {
|
|
303
|
-
const flag = countryCodeToFlag(user.countryCode);
|
|
304
|
-
lines.push(`${flag} Country Rank: ${colors.primary(`#${user.countryRank}`)}`);
|
|
305
|
-
}
|
|
306
|
-
const maxVisibleLength = Math.max(...lines.map((l) => getDisplayWidth(l)));
|
|
307
|
-
const boxWidth = Math.max(maxVisibleLength + 4, 47);
|
|
281
|
+
const boxWidth = Math.max(getDisplayWidth(welcomeLine) + 4, 40);
|
|
308
282
|
const top = colors.dim(` ${box.topLeft}${box.horizontal.repeat(boxWidth)}${box.topRight}`);
|
|
309
283
|
const bottom = colors.dim(
|
|
310
284
|
` ${box.bottomLeft}${box.horizontal.repeat(boxWidth)}${box.bottomRight}`
|
|
311
285
|
);
|
|
312
286
|
console.log(top);
|
|
313
287
|
await sleep(20);
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
await sleep(25);
|
|
320
|
-
}
|
|
288
|
+
const visibleLength = getDisplayWidth(welcomeLine);
|
|
289
|
+
const padding = boxWidth - 2 - visibleLength;
|
|
290
|
+
const paddedLine = `${box.vertical} ${welcomeLine}${" ".repeat(Math.max(0, padding))} ${box.vertical}`;
|
|
291
|
+
console.log(colors.dim(" ") + paddedLine);
|
|
292
|
+
await sleep(25);
|
|
321
293
|
console.log(bottom);
|
|
322
294
|
}
|
|
323
295
|
var import_chalk, import_string_width, VERSION, colors, LOGO, LOGO_COMPACT, TAGLINE, SLOGAN, boxRound, box, HEADER_WIDTH, LEVELS;
|
|
@@ -326,7 +298,7 @@ var init_ui = __esm({
|
|
|
326
298
|
"use strict";
|
|
327
299
|
import_chalk = __toESM(require("chalk"));
|
|
328
300
|
import_string_width = __toESM(require("string-width"));
|
|
329
|
-
VERSION = true ? "2.0.
|
|
301
|
+
VERSION = true ? "2.0.14" : "0.0.0";
|
|
330
302
|
colors = {
|
|
331
303
|
primary: import_chalk.default.hex("#DA7756"),
|
|
332
304
|
// Claude coral
|
|
@@ -1325,20 +1297,21 @@ async function submit(options) {
|
|
|
1325
1297
|
const levelProgress = getLevelProgress(usageData.totalTokens);
|
|
1326
1298
|
const currentLevel = levelProgress.current;
|
|
1327
1299
|
const summaryLines = [
|
|
1328
|
-
`${colors.muted("Total Cost")} ${colors.success(formatCost(usageData.totalCost))}`,
|
|
1329
|
-
`${colors.muted("Total Tokens")} ${colors.primary(formatNumber(usageData.totalTokens))}`,
|
|
1330
|
-
`${colors.muted("Period")} ${colors.warning(daysTrackedDisplay)}`,
|
|
1331
|
-
`${colors.muted("Level")} ${currentLevel.icon}
|
|
1300
|
+
`${colors.muted("Total Cost")} \u{1F4B0}${colors.success(formatCost(usageData.totalCost))}`,
|
|
1301
|
+
`${colors.muted("Total Tokens")} \u26A1${colors.primary(formatNumber(usageData.totalTokens))}`,
|
|
1302
|
+
`${colors.muted("Period")} \u{1F4C5}${colors.warning(daysTrackedDisplay)}`,
|
|
1303
|
+
`${colors.muted("Level")} ${currentLevel.icon}${currentLevel.color(`${currentLevel.name}`)}`
|
|
1332
1304
|
];
|
|
1333
1305
|
if (usageData.ccplan) {
|
|
1334
1306
|
const planColor = getPlanColor(usageData.ccplan);
|
|
1307
|
+
const planIcon = usageData.ccplan.toLowerCase() === "max" ? "\u{1F680}" : "";
|
|
1335
1308
|
summaryLines.push(
|
|
1336
|
-
`${colors.muted("Plan")} ${planColor(usageData.ccplan.toUpperCase())}
|
|
1309
|
+
`${colors.muted("Plan")} ${planIcon}${planColor(usageData.ccplan.toUpperCase())}`
|
|
1337
1310
|
);
|
|
1338
1311
|
}
|
|
1339
1312
|
if (usageData.hasOpusUsage) {
|
|
1340
1313
|
summaryLines.push(
|
|
1341
|
-
`${colors.muted("Models")} ${colors.max("\
|
|
1314
|
+
`${colors.muted("Models")} ${colors.max("\u2726Opus User")}`
|
|
1342
1315
|
);
|
|
1343
1316
|
}
|
|
1344
1317
|
console.log(createBox(summaryLines));
|