@caliber-ai/cli 0.16.3 → 0.16.5
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 +21 -6
- 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,14 +3409,21 @@ 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(
|
|
3419
|
+
execSync4(`npm install -g @caliber-ai/cli@${latest} --prefer-online`, { stdio: "pipe", timeout: 6e4 });
|
|
3420
|
+
const installed = getInstalledVersion();
|
|
3421
|
+
if (installed !== latest) {
|
|
3422
|
+
spinner.fail(`Update incomplete \u2014 got ${installed ?? "unknown"}, expected ${latest}`);
|
|
3423
|
+
console.log(chalk15.yellow(`Run ${chalk15.bold(`npm install -g @caliber-ai/cli@${latest}`)} manually.
|
|
3424
|
+
`));
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3414
3427
|
spinner.succeed(chalk15.green(`Updated to ${latest}`));
|
|
3415
3428
|
const args = process.argv.slice(2);
|
|
3416
3429
|
console.log(chalk15.dim(`
|
|
@@ -3421,11 +3434,13 @@ Restarting: caliber ${args.join(" ")}
|
|
|
3421
3434
|
env: { ...process.env, CALIBER_SKIP_UPDATE_CHECK: "1" }
|
|
3422
3435
|
});
|
|
3423
3436
|
process.exit(0);
|
|
3424
|
-
} catch {
|
|
3437
|
+
} catch (err) {
|
|
3425
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]}`));
|
|
3426
3441
|
console.log(
|
|
3427
3442
|
chalk15.yellow(
|
|
3428
|
-
`Run ${chalk15.bold(
|
|
3443
|
+
`Run ${chalk15.bold(`npm install -g @caliber-ai/cli@${latest}`)} manually to upgrade.
|
|
3429
3444
|
`
|
|
3430
3445
|
)
|
|
3431
3446
|
);
|