ccgather 2.0.0 → 2.0.2
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 +73 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -329,7 +329,7 @@ var init_ui = __esm({
|
|
|
329
329
|
"use strict";
|
|
330
330
|
import_chalk = __toESM(require("chalk"));
|
|
331
331
|
import_string_width = __toESM(require("string-width"));
|
|
332
|
-
VERSION = true ? "2.0.
|
|
332
|
+
VERSION = true ? "2.0.2" : "0.0.0";
|
|
333
333
|
colors = {
|
|
334
334
|
primary: import_chalk.default.hex("#DA7756"),
|
|
335
335
|
// Claude coral
|
|
@@ -558,6 +558,7 @@ var init_auth = __esm({
|
|
|
558
558
|
var import_commander = require("commander");
|
|
559
559
|
var import_inquirer3 = __toESM(require("inquirer"));
|
|
560
560
|
var import_chalk3 = __toESM(require("chalk"));
|
|
561
|
+
var import_child_process2 = require("child_process");
|
|
561
562
|
|
|
562
563
|
// src/commands/submit.ts
|
|
563
564
|
var import_ora2 = __toESM(require("ora"));
|
|
@@ -1438,6 +1439,13 @@ async function submit(options) {
|
|
|
1438
1439
|
console.log(` ${colors.dim("\u2500".repeat(40))}`);
|
|
1439
1440
|
console.log(` ${colors.muted("View full stats:")} ${link(leaderboardUrl)}`);
|
|
1440
1441
|
console.log();
|
|
1442
|
+
console.log(
|
|
1443
|
+
` ${colors.warning("\u{1F4A1}")} ${colors.muted("Claude Code keeps ~30 days of local data.")}`
|
|
1444
|
+
);
|
|
1445
|
+
console.log(
|
|
1446
|
+
` ${colors.muted("Submit regularly to preserve your full history!")}`
|
|
1447
|
+
);
|
|
1448
|
+
console.log();
|
|
1441
1449
|
} else {
|
|
1442
1450
|
submitSpinner.fail(colors.error("Failed to submit"));
|
|
1443
1451
|
console.log(`
|
|
@@ -1491,9 +1499,73 @@ async function getStatus() {
|
|
|
1491
1499
|
|
|
1492
1500
|
// src/index.ts
|
|
1493
1501
|
var program = new import_commander.Command();
|
|
1502
|
+
async function getLatestVersion() {
|
|
1503
|
+
try {
|
|
1504
|
+
const response = await fetch("https://registry.npmjs.org/ccgather/latest", {
|
|
1505
|
+
headers: { Accept: "application/json" },
|
|
1506
|
+
signal: AbortSignal.timeout(3e3)
|
|
1507
|
+
// 3 second timeout
|
|
1508
|
+
});
|
|
1509
|
+
if (!response.ok) return null;
|
|
1510
|
+
const data = await response.json();
|
|
1511
|
+
return data.version || null;
|
|
1512
|
+
} catch {
|
|
1513
|
+
return null;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
function compareVersions(v1, v2) {
|
|
1517
|
+
const parts1 = v1.split(".").map(Number);
|
|
1518
|
+
const parts2 = v2.split(".").map(Number);
|
|
1519
|
+
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
1520
|
+
const p1 = parts1[i] || 0;
|
|
1521
|
+
const p2 = parts2[i] || 0;
|
|
1522
|
+
if (p1 > p2) return 1;
|
|
1523
|
+
if (p1 < p2) return -1;
|
|
1524
|
+
}
|
|
1525
|
+
return 0;
|
|
1526
|
+
}
|
|
1527
|
+
async function checkForUpdates() {
|
|
1528
|
+
const latestVersion = await getLatestVersion();
|
|
1529
|
+
if (!latestVersion) return;
|
|
1530
|
+
if (compareVersions(latestVersion, VERSION) > 0) {
|
|
1531
|
+
console.log();
|
|
1532
|
+
console.log(
|
|
1533
|
+
` ${colors.warning("\u2B06")} ${colors.white("New version available!")} ${colors.dim(VERSION)} \u2192 ${colors.success(latestVersion)}`
|
|
1534
|
+
);
|
|
1535
|
+
console.log();
|
|
1536
|
+
const { shouldUpdate } = await import_inquirer3.default.prompt([
|
|
1537
|
+
{
|
|
1538
|
+
type: "confirm",
|
|
1539
|
+
name: "shouldUpdate",
|
|
1540
|
+
message: `Update to v${latestVersion}?`,
|
|
1541
|
+
default: true
|
|
1542
|
+
}
|
|
1543
|
+
]);
|
|
1544
|
+
if (shouldUpdate) {
|
|
1545
|
+
console.log();
|
|
1546
|
+
console.log(` ${colors.muted("Updating ccgather...")}`);
|
|
1547
|
+
try {
|
|
1548
|
+
(0, import_child_process2.execSync)("npm install -g ccgather@latest", {
|
|
1549
|
+
stdio: "inherit"
|
|
1550
|
+
});
|
|
1551
|
+
console.log();
|
|
1552
|
+
console.log(` ${colors.success("\u2713")} ${colors.white("Updated successfully!")}`);
|
|
1553
|
+
console.log(` ${colors.muted("Please restart ccgather to use the new version.")}`);
|
|
1554
|
+
console.log();
|
|
1555
|
+
process.exit(0);
|
|
1556
|
+
} catch {
|
|
1557
|
+
console.log();
|
|
1558
|
+
console.log(` ${colors.error("\u2717")} ${colors.muted("Update failed. Try manually:")}`);
|
|
1559
|
+
console.log(` ${colors.dim("npm install -g ccgather@latest")}`);
|
|
1560
|
+
console.log();
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1494
1565
|
program.name("ccgather").description("Submit your Claude Code usage to the CCgather leaderboard").version(VERSION);
|
|
1495
1566
|
async function showMainMenu() {
|
|
1496
1567
|
await printAnimatedHeader();
|
|
1568
|
+
await checkForUpdates();
|
|
1497
1569
|
if (!isAuthenticated()) {
|
|
1498
1570
|
console.log(colors.warning("\n \u{1F510} Authentication required\n"));
|
|
1499
1571
|
console.log(colors.dim(" To submit your Claude Code usage, you need to log in first.\n"));
|