ccgather 2.0.0 → 2.0.1
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 +66 -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.1" : "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"));
|
|
@@ -1491,9 +1492,73 @@ async function getStatus() {
|
|
|
1491
1492
|
|
|
1492
1493
|
// src/index.ts
|
|
1493
1494
|
var program = new import_commander.Command();
|
|
1495
|
+
async function getLatestVersion() {
|
|
1496
|
+
try {
|
|
1497
|
+
const response = await fetch("https://registry.npmjs.org/ccgather/latest", {
|
|
1498
|
+
headers: { Accept: "application/json" },
|
|
1499
|
+
signal: AbortSignal.timeout(3e3)
|
|
1500
|
+
// 3 second timeout
|
|
1501
|
+
});
|
|
1502
|
+
if (!response.ok) return null;
|
|
1503
|
+
const data = await response.json();
|
|
1504
|
+
return data.version || null;
|
|
1505
|
+
} catch {
|
|
1506
|
+
return null;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
function compareVersions(v1, v2) {
|
|
1510
|
+
const parts1 = v1.split(".").map(Number);
|
|
1511
|
+
const parts2 = v2.split(".").map(Number);
|
|
1512
|
+
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
1513
|
+
const p1 = parts1[i] || 0;
|
|
1514
|
+
const p2 = parts2[i] || 0;
|
|
1515
|
+
if (p1 > p2) return 1;
|
|
1516
|
+
if (p1 < p2) return -1;
|
|
1517
|
+
}
|
|
1518
|
+
return 0;
|
|
1519
|
+
}
|
|
1520
|
+
async function checkForUpdates() {
|
|
1521
|
+
const latestVersion = await getLatestVersion();
|
|
1522
|
+
if (!latestVersion) return;
|
|
1523
|
+
if (compareVersions(latestVersion, VERSION) > 0) {
|
|
1524
|
+
console.log();
|
|
1525
|
+
console.log(
|
|
1526
|
+
` ${colors.warning("\u2B06")} ${colors.white("New version available!")} ${colors.dim(VERSION)} \u2192 ${colors.success(latestVersion)}`
|
|
1527
|
+
);
|
|
1528
|
+
console.log();
|
|
1529
|
+
const { shouldUpdate } = await import_inquirer3.default.prompt([
|
|
1530
|
+
{
|
|
1531
|
+
type: "confirm",
|
|
1532
|
+
name: "shouldUpdate",
|
|
1533
|
+
message: `Update to v${latestVersion}?`,
|
|
1534
|
+
default: true
|
|
1535
|
+
}
|
|
1536
|
+
]);
|
|
1537
|
+
if (shouldUpdate) {
|
|
1538
|
+
console.log();
|
|
1539
|
+
console.log(` ${colors.muted("Updating ccgather...")}`);
|
|
1540
|
+
try {
|
|
1541
|
+
(0, import_child_process2.execSync)("npm install -g ccgather@latest", {
|
|
1542
|
+
stdio: "inherit"
|
|
1543
|
+
});
|
|
1544
|
+
console.log();
|
|
1545
|
+
console.log(` ${colors.success("\u2713")} ${colors.white("Updated successfully!")}`);
|
|
1546
|
+
console.log(` ${colors.muted("Please restart ccgather to use the new version.")}`);
|
|
1547
|
+
console.log();
|
|
1548
|
+
process.exit(0);
|
|
1549
|
+
} catch {
|
|
1550
|
+
console.log();
|
|
1551
|
+
console.log(` ${colors.error("\u2717")} ${colors.muted("Update failed. Try manually:")}`);
|
|
1552
|
+
console.log(` ${colors.dim("npm install -g ccgather@latest")}`);
|
|
1553
|
+
console.log();
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1494
1558
|
program.name("ccgather").description("Submit your Claude Code usage to the CCgather leaderboard").version(VERSION);
|
|
1495
1559
|
async function showMainMenu() {
|
|
1496
1560
|
await printAnimatedHeader();
|
|
1561
|
+
await checkForUpdates();
|
|
1497
1562
|
if (!isAuthenticated()) {
|
|
1498
1563
|
console.log(colors.warning("\n \u{1F510} Authentication required\n"));
|
|
1499
1564
|
console.log(colors.dim(" To submit your Claude Code usage, you need to log in first.\n"));
|