ccgather 1.3.27 → 1.3.28
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 +29 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1169,11 +1169,33 @@ async function checkLatestVersion() {
|
|
|
1169
1169
|
return null;
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1172
|
+
async function promptForUpdate(latestVersion) {
|
|
1173
1173
|
console.log();
|
|
1174
1174
|
console.log(` ${import_chalk3.default.yellow("\u26A0")} ${import_chalk3.default.yellow("New version")} ${import_chalk3.default.green(latestVersion)} ${import_chalk3.default.yellow("available!")} ${import_chalk3.default.dim(`(current: ${VERSION})`)}`);
|
|
1175
|
-
console.log(` Run ${import_chalk3.default.cyan("npx ccgather@latest")} to update.`);
|
|
1176
1175
|
console.log();
|
|
1176
|
+
const { shouldUpdate } = await import_inquirer3.default.prompt([
|
|
1177
|
+
{
|
|
1178
|
+
type: "confirm",
|
|
1179
|
+
name: "shouldUpdate",
|
|
1180
|
+
message: `Update to ${import_chalk3.default.green(latestVersion)} now?`,
|
|
1181
|
+
default: true
|
|
1182
|
+
}
|
|
1183
|
+
]);
|
|
1184
|
+
if (shouldUpdate) {
|
|
1185
|
+
console.log();
|
|
1186
|
+
console.log(` ${import_chalk3.default.cyan("\u2192")} Running ${import_chalk3.default.cyan("npx ccgather@latest")}...`);
|
|
1187
|
+
console.log();
|
|
1188
|
+
const { spawn } = await import("child_process");
|
|
1189
|
+
const child = spawn("npx", ["ccgather@latest"], {
|
|
1190
|
+
stdio: "inherit",
|
|
1191
|
+
shell: true
|
|
1192
|
+
});
|
|
1193
|
+
child.on("close", (code) => {
|
|
1194
|
+
process.exit(code || 0);
|
|
1195
|
+
});
|
|
1196
|
+
return true;
|
|
1197
|
+
}
|
|
1198
|
+
return false;
|
|
1177
1199
|
}
|
|
1178
1200
|
var program = new import_commander.Command();
|
|
1179
1201
|
program.name("ccgather").description("Submit your Claude Code usage to the CCgather leaderboard").version(VERSION);
|
|
@@ -1181,7 +1203,11 @@ async function showMainMenu() {
|
|
|
1181
1203
|
await printAnimatedHeader();
|
|
1182
1204
|
const latestVersion = await checkLatestVersion();
|
|
1183
1205
|
if (latestVersion && latestVersion !== VERSION) {
|
|
1184
|
-
|
|
1206
|
+
const willUpdate = await promptForUpdate(latestVersion);
|
|
1207
|
+
if (willUpdate) {
|
|
1208
|
+
await new Promise(() => {
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1185
1211
|
}
|
|
1186
1212
|
if (!isAuthenticated()) {
|
|
1187
1213
|
console.log(colors.warning("\n \u{1F510} Authentication required\n"));
|