@caliber-ai/cli 0.16.4 → 0.16.6
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/bin.js +16 -8
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -3369,8 +3369,14 @@ var __dirname_vc = path18.dirname(fileURLToPath4(import.meta.url));
|
|
|
3369
3369
|
var pkg4 = JSON.parse(
|
|
3370
3370
|
fs21.readFileSync(path18.resolve(__dirname_vc, "..", "package.json"), "utf-8")
|
|
3371
3371
|
);
|
|
3372
|
-
|
|
3373
|
-
|
|
3372
|
+
function getInstalledVersion() {
|
|
3373
|
+
try {
|
|
3374
|
+
const globalRoot = execSync4("npm root -g", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
3375
|
+
const pkgPath = path18.join(globalRoot, "@caliber-ai", "cli", "package.json");
|
|
3376
|
+
return JSON.parse(fs21.readFileSync(pkgPath, "utf-8")).version;
|
|
3377
|
+
} catch {
|
|
3378
|
+
return null;
|
|
3379
|
+
}
|
|
3374
3380
|
}
|
|
3375
3381
|
async function checkForUpdates() {
|
|
3376
3382
|
if (process.env.CALIBER_SKIP_UPDATE_CHECK) return;
|
|
@@ -3403,17 +3409,17 @@ Run ${chalk15.bold("npm install -g @caliber-ai/cli")} to upgrade.
|
|
|
3403
3409
|
chalk15.yellow(`
|
|
3404
3410
|
Update available: ${current} -> ${latest}`)
|
|
3405
3411
|
);
|
|
3406
|
-
const shouldUpdate = await
|
|
3412
|
+
const shouldUpdate = await confirm4({ message: "Would you like to update now? (Y/n)", default: true });
|
|
3407
3413
|
if (!shouldUpdate) {
|
|
3408
3414
|
console.log();
|
|
3409
3415
|
return;
|
|
3410
3416
|
}
|
|
3411
3417
|
const spinner = ora11("Updating @caliber-ai/cli...").start();
|
|
3412
3418
|
try {
|
|
3413
|
-
execSync4(`npm install -g @caliber-ai/cli@${latest}`, { stdio: "pipe" });
|
|
3414
|
-
const installed =
|
|
3419
|
+
execSync4(`npm install -g @caliber-ai/cli@${latest} --prefer-online`, { stdio: "pipe", timeout: 6e4 });
|
|
3420
|
+
const installed = getInstalledVersion();
|
|
3415
3421
|
if (installed !== latest) {
|
|
3416
|
-
spinner.fail(`Update incomplete \u2014
|
|
3422
|
+
spinner.fail(`Update incomplete \u2014 got ${installed ?? "unknown"}, expected ${latest}`);
|
|
3417
3423
|
console.log(chalk15.yellow(`Run ${chalk15.bold(`npm install -g @caliber-ai/cli@${latest}`)} manually.
|
|
3418
3424
|
`));
|
|
3419
3425
|
return;
|
|
@@ -3428,11 +3434,13 @@ Restarting: caliber ${args.join(" ")}
|
|
|
3428
3434
|
env: { ...process.env, CALIBER_SKIP_UPDATE_CHECK: "1" }
|
|
3429
3435
|
});
|
|
3430
3436
|
process.exit(0);
|
|
3431
|
-
} catch {
|
|
3437
|
+
} catch (err) {
|
|
3432
3438
|
spinner.fail("Update failed");
|
|
3439
|
+
const msg = err instanceof Error ? err.message : "";
|
|
3440
|
+
if (msg && !msg.includes("SIGTERM")) console.log(chalk15.dim(` ${msg.split("\n")[0]}`));
|
|
3433
3441
|
console.log(
|
|
3434
3442
|
chalk15.yellow(
|
|
3435
|
-
`Run ${chalk15.bold(
|
|
3443
|
+
`Run ${chalk15.bold(`npm install -g @caliber-ai/cli@${latest}`)} manually to upgrade.
|
|
3436
3444
|
`
|
|
3437
3445
|
)
|
|
3438
3446
|
);
|