@caliber-ai/cli 0.7.0 → 0.9.0
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 +229 -94
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -75,8 +75,8 @@ if (dsn) {
|
|
|
75
75
|
|
|
76
76
|
// src/cli.ts
|
|
77
77
|
import { Command } from "commander";
|
|
78
|
-
import
|
|
79
|
-
import
|
|
78
|
+
import fs20 from "fs";
|
|
79
|
+
import path17 from "path";
|
|
80
80
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
81
81
|
|
|
82
82
|
// src/commands/init.ts
|
|
@@ -935,9 +935,9 @@ async function getValidToken() {
|
|
|
935
935
|
}
|
|
936
936
|
return refreshed;
|
|
937
937
|
}
|
|
938
|
-
async function apiRequest(
|
|
938
|
+
async function apiRequest(path19, options = {}) {
|
|
939
939
|
let token = await getValidToken();
|
|
940
|
-
let resp = await fetch(`${API_URL}${
|
|
940
|
+
let resp = await fetch(`${API_URL}${path19}`, {
|
|
941
941
|
method: options.method || "GET",
|
|
942
942
|
headers: {
|
|
943
943
|
"Content-Type": "application/json",
|
|
@@ -951,7 +951,7 @@ async function apiRequest(path18, options = {}) {
|
|
|
951
951
|
throw new Error("Session expired. Run `caliber login` to re-authenticate.");
|
|
952
952
|
}
|
|
953
953
|
token = refreshed;
|
|
954
|
-
resp = await fetch(`${API_URL}${
|
|
954
|
+
resp = await fetch(`${API_URL}${path19}`, {
|
|
955
955
|
method: options.method || "GET",
|
|
956
956
|
headers: {
|
|
957
957
|
"Content-Type": "application/json",
|
|
@@ -967,9 +967,9 @@ async function apiRequest(path18, options = {}) {
|
|
|
967
967
|
const json = await resp.json();
|
|
968
968
|
return json.data;
|
|
969
969
|
}
|
|
970
|
-
async function apiStream(
|
|
970
|
+
async function apiStream(path19, body, onChunk, onComplete, onError, onStatus) {
|
|
971
971
|
let token = await getValidToken();
|
|
972
|
-
let resp = await fetch(`${API_URL}${
|
|
972
|
+
let resp = await fetch(`${API_URL}${path19}`, {
|
|
973
973
|
method: "POST",
|
|
974
974
|
headers: {
|
|
975
975
|
"Content-Type": "application/json",
|
|
@@ -983,7 +983,7 @@ async function apiStream(path18, body, onChunk, onComplete, onError, onStatus) {
|
|
|
983
983
|
throw new Error("Session expired. Run `caliber login` to re-authenticate.");
|
|
984
984
|
}
|
|
985
985
|
token = refreshed;
|
|
986
|
-
resp = await fetch(`${API_URL}${
|
|
986
|
+
resp = await fetch(`${API_URL}${path19}`, {
|
|
987
987
|
method: "POST",
|
|
988
988
|
headers: {
|
|
989
989
|
"Content-Type": "application/json",
|
|
@@ -2544,6 +2544,8 @@ async function diffCommand(options) {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
|
|
2546
2546
|
// src/commands/refresh.ts
|
|
2547
|
+
import fs19 from "fs";
|
|
2548
|
+
import path16 from "path";
|
|
2547
2549
|
import chalk11 from "chalk";
|
|
2548
2550
|
import ora9 from "ora";
|
|
2549
2551
|
|
|
@@ -2661,6 +2663,92 @@ function writeRefreshDocs(docs) {
|
|
|
2661
2663
|
function log(quiet, ...args) {
|
|
2662
2664
|
if (!quiet) console.log(...args);
|
|
2663
2665
|
}
|
|
2666
|
+
function discoverGitRepos(parentDir) {
|
|
2667
|
+
const repos = [];
|
|
2668
|
+
try {
|
|
2669
|
+
const entries = fs19.readdirSync(parentDir, { withFileTypes: true });
|
|
2670
|
+
for (const entry of entries) {
|
|
2671
|
+
if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
|
|
2672
|
+
const childPath = path16.join(parentDir, entry.name);
|
|
2673
|
+
if (fs19.existsSync(path16.join(childPath, ".git"))) {
|
|
2674
|
+
repos.push(childPath);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
} catch {
|
|
2678
|
+
}
|
|
2679
|
+
return repos.sort();
|
|
2680
|
+
}
|
|
2681
|
+
async function refreshSingleRepo(repoDir, options) {
|
|
2682
|
+
const quiet = !!options.quiet;
|
|
2683
|
+
const prefix = options.label ? `${chalk11.bold(options.label)} ` : "";
|
|
2684
|
+
const state = readState();
|
|
2685
|
+
const lastSha = state?.lastRefreshSha ?? null;
|
|
2686
|
+
const diff = collectDiff(lastSha);
|
|
2687
|
+
const currentSha = getCurrentHeadSha();
|
|
2688
|
+
if (!diff.hasChanges) {
|
|
2689
|
+
if (currentSha) {
|
|
2690
|
+
writeState({ lastRefreshSha: currentSha, lastRefreshTimestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
2691
|
+
}
|
|
2692
|
+
log(quiet, chalk11.dim(`${prefix}No changes since last refresh.`));
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
const spinner = quiet ? null : ora9(`${prefix}Analyzing changes...`).start();
|
|
2696
|
+
const existingDocs = readExistingConfigs(repoDir);
|
|
2697
|
+
const fingerprint = collectFingerprint(repoDir);
|
|
2698
|
+
const projectContext = {
|
|
2699
|
+
languages: fingerprint.languages,
|
|
2700
|
+
frameworks: fingerprint.frameworks,
|
|
2701
|
+
packageName: fingerprint.packageName
|
|
2702
|
+
};
|
|
2703
|
+
const response = await apiRequest("/api/setups/refresh", {
|
|
2704
|
+
method: "POST",
|
|
2705
|
+
body: {
|
|
2706
|
+
diff: {
|
|
2707
|
+
committed: diff.committedDiff,
|
|
2708
|
+
staged: diff.stagedDiff,
|
|
2709
|
+
unstaged: diff.unstagedDiff,
|
|
2710
|
+
changedFiles: diff.changedFiles,
|
|
2711
|
+
summary: diff.summary
|
|
2712
|
+
},
|
|
2713
|
+
existingDocs,
|
|
2714
|
+
projectContext
|
|
2715
|
+
}
|
|
2716
|
+
});
|
|
2717
|
+
if (!response.docsUpdated || response.docsUpdated.length === 0) {
|
|
2718
|
+
spinner?.succeed(`${prefix}No doc updates needed`);
|
|
2719
|
+
if (currentSha) {
|
|
2720
|
+
writeState({ lastRefreshSha: currentSha, lastRefreshTimestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
2721
|
+
}
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
if (options.dryRun) {
|
|
2725
|
+
spinner?.info(`${prefix}Dry run \u2014 would update:`);
|
|
2726
|
+
for (const doc of response.docsUpdated) {
|
|
2727
|
+
console.log(` ${chalk11.yellow("~")} ${doc}`);
|
|
2728
|
+
}
|
|
2729
|
+
if (response.changesSummary) {
|
|
2730
|
+
console.log(chalk11.dim(`
|
|
2731
|
+
${response.changesSummary}`));
|
|
2732
|
+
}
|
|
2733
|
+
return;
|
|
2734
|
+
}
|
|
2735
|
+
const written = writeRefreshDocs(response.updatedDocs);
|
|
2736
|
+
spinner?.succeed(`${prefix}Updated ${written.length} doc${written.length === 1 ? "" : "s"}`);
|
|
2737
|
+
for (const file of written) {
|
|
2738
|
+
log(quiet, ` ${chalk11.green("\u2713")} ${file}`);
|
|
2739
|
+
}
|
|
2740
|
+
if (response.changesSummary) {
|
|
2741
|
+
log(quiet, chalk11.dim(`
|
|
2742
|
+
${response.changesSummary}`));
|
|
2743
|
+
}
|
|
2744
|
+
if (currentSha) {
|
|
2745
|
+
writeState({ lastRefreshSha: currentSha, lastRefreshTimestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
2746
|
+
}
|
|
2747
|
+
trackEvent("refresh_completed", {
|
|
2748
|
+
docs_updated: written.length,
|
|
2749
|
+
changed_files: diff.changedFiles.length
|
|
2750
|
+
});
|
|
2751
|
+
}
|
|
2664
2752
|
async function refreshCommand(options) {
|
|
2665
2753
|
const quiet = !!options.quiet;
|
|
2666
2754
|
try {
|
|
@@ -2670,78 +2758,30 @@ async function refreshCommand(options) {
|
|
|
2670
2758
|
console.log(chalk11.red("Not authenticated. Run `caliber login` first."));
|
|
2671
2759
|
throw new Error("__exit__");
|
|
2672
2760
|
}
|
|
2673
|
-
if (
|
|
2674
|
-
|
|
2675
|
-
console.log(chalk11.red("Not inside a git repository."));
|
|
2676
|
-
throw new Error("__exit__");
|
|
2677
|
-
}
|
|
2678
|
-
const state = readState();
|
|
2679
|
-
const lastSha = state?.lastRefreshSha ?? null;
|
|
2680
|
-
const diff = collectDiff(lastSha);
|
|
2681
|
-
const currentSha = getCurrentHeadSha();
|
|
2682
|
-
if (!diff.hasChanges) {
|
|
2683
|
-
if (currentSha) {
|
|
2684
|
-
writeState({ lastRefreshSha: currentSha, lastRefreshTimestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
2685
|
-
}
|
|
2686
|
-
log(quiet, chalk11.dim("No changes since last refresh."));
|
|
2761
|
+
if (isGitRepo()) {
|
|
2762
|
+
await refreshSingleRepo(process.cwd(), options);
|
|
2687
2763
|
return;
|
|
2688
2764
|
}
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
frameworks: fingerprint.frameworks,
|
|
2695
|
-
packageName: fingerprint.packageName
|
|
2696
|
-
};
|
|
2697
|
-
const response = await apiRequest("/api/setups/refresh", {
|
|
2698
|
-
method: "POST",
|
|
2699
|
-
body: {
|
|
2700
|
-
diff: {
|
|
2701
|
-
committed: diff.committedDiff,
|
|
2702
|
-
staged: diff.stagedDiff,
|
|
2703
|
-
unstaged: diff.unstagedDiff,
|
|
2704
|
-
changedFiles: diff.changedFiles,
|
|
2705
|
-
summary: diff.summary
|
|
2706
|
-
},
|
|
2707
|
-
existingDocs,
|
|
2708
|
-
projectContext
|
|
2709
|
-
}
|
|
2710
|
-
});
|
|
2711
|
-
if (!response.docsUpdated || response.docsUpdated.length === 0) {
|
|
2712
|
-
spinner?.succeed("No doc updates needed");
|
|
2713
|
-
if (currentSha) {
|
|
2714
|
-
writeState({ lastRefreshSha: currentSha, lastRefreshTimestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
2715
|
-
}
|
|
2716
|
-
return;
|
|
2765
|
+
const repos = discoverGitRepos(process.cwd());
|
|
2766
|
+
if (repos.length === 0) {
|
|
2767
|
+
if (quiet) return;
|
|
2768
|
+
console.log(chalk11.red("Not inside a git repository and no git repos found in child directories."));
|
|
2769
|
+
throw new Error("__exit__");
|
|
2717
2770
|
}
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2771
|
+
log(quiet, chalk11.dim(`Found ${repos.length} git repo${repos.length === 1 ? "" : "s"}
|
|
2772
|
+
`));
|
|
2773
|
+
const originalDir = process.cwd();
|
|
2774
|
+
for (const repo of repos) {
|
|
2775
|
+
const repoName = path16.basename(repo);
|
|
2776
|
+
try {
|
|
2777
|
+
process.chdir(repo);
|
|
2778
|
+
await refreshSingleRepo(repo, { ...options, label: repoName });
|
|
2779
|
+
} catch (err) {
|
|
2780
|
+
if (err instanceof Error && err.message === "__exit__") continue;
|
|
2781
|
+
log(quiet, chalk11.yellow(`${repoName}: refresh failed \u2014 ${err instanceof Error ? err.message : "unknown error"}`));
|
|
2726
2782
|
}
|
|
2727
|
-
return;
|
|
2728
|
-
}
|
|
2729
|
-
const written = writeRefreshDocs(response.updatedDocs);
|
|
2730
|
-
spinner?.succeed(`Updated ${written.length} doc${written.length === 1 ? "" : "s"}`);
|
|
2731
|
-
for (const file of written) {
|
|
2732
|
-
log(quiet, ` ${chalk11.green("\u2713")} ${file}`);
|
|
2733
|
-
}
|
|
2734
|
-
if (response.changesSummary) {
|
|
2735
|
-
log(quiet, chalk11.dim(`
|
|
2736
|
-
${response.changesSummary}`));
|
|
2737
2783
|
}
|
|
2738
|
-
|
|
2739
|
-
writeState({ lastRefreshSha: currentSha, lastRefreshTimestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
2740
|
-
}
|
|
2741
|
-
trackEvent("refresh_completed", {
|
|
2742
|
-
docs_updated: written.length,
|
|
2743
|
-
changed_files: diff.changedFiles.length
|
|
2744
|
-
});
|
|
2784
|
+
process.chdir(originalDir);
|
|
2745
2785
|
} catch (err) {
|
|
2746
2786
|
if (err instanceof Error && err.message === "__exit__") throw err;
|
|
2747
2787
|
if (quiet) return;
|
|
@@ -2780,10 +2820,104 @@ async function hooksStatusCommand() {
|
|
|
2780
2820
|
}
|
|
2781
2821
|
}
|
|
2782
2822
|
|
|
2823
|
+
// src/commands/review.ts
|
|
2824
|
+
import chalk13 from "chalk";
|
|
2825
|
+
import readline3 from "readline";
|
|
2826
|
+
import ora10 from "ora";
|
|
2827
|
+
function prompt(question) {
|
|
2828
|
+
const rl = readline3.createInterface({ input: process.stdin, output: process.stdout });
|
|
2829
|
+
return new Promise((resolve2) => {
|
|
2830
|
+
rl.question(question, (answer) => {
|
|
2831
|
+
rl.close();
|
|
2832
|
+
resolve2(answer.trim());
|
|
2833
|
+
});
|
|
2834
|
+
});
|
|
2835
|
+
}
|
|
2836
|
+
async function promptRating() {
|
|
2837
|
+
console.log(chalk13.bold("\n How helpful was Caliber in setting up your coding agent?\n"));
|
|
2838
|
+
console.log(" 1. Not helpful at all");
|
|
2839
|
+
console.log(" 2. Slightly helpful");
|
|
2840
|
+
console.log(" 3. Moderately helpful");
|
|
2841
|
+
console.log(" 4. Very helpful");
|
|
2842
|
+
console.log(" 5. Extremely helpful");
|
|
2843
|
+
while (true) {
|
|
2844
|
+
const answer = await prompt(chalk13.cyan("\n Rating (1-5): "));
|
|
2845
|
+
const num = parseInt(answer, 10);
|
|
2846
|
+
if (num >= 1 && num <= 5) return num;
|
|
2847
|
+
console.log(chalk13.yellow(" Please enter a number between 1 and 5."));
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
async function promptRecommend() {
|
|
2851
|
+
console.log(chalk13.bold("\n Would you recommend Caliber to a colleague?\n"));
|
|
2852
|
+
console.log(" 1. Yes");
|
|
2853
|
+
console.log(" 2. No");
|
|
2854
|
+
console.log(" 3. Maybe");
|
|
2855
|
+
while (true) {
|
|
2856
|
+
const answer = await prompt(chalk13.cyan("\n Choose (1-3): "));
|
|
2857
|
+
const map = { "1": "yes", "2": "no", "3": "maybe" };
|
|
2858
|
+
if (map[answer]) return map[answer];
|
|
2859
|
+
console.log(chalk13.yellow(" Please enter 1, 2, or 3."));
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
function starRating(rating) {
|
|
2863
|
+
return "\u2605".repeat(rating) + "\u2606".repeat(5 - rating);
|
|
2864
|
+
}
|
|
2865
|
+
async function reviewCommand() {
|
|
2866
|
+
const auth2 = getStoredAuth();
|
|
2867
|
+
if (!auth2) {
|
|
2868
|
+
console.log(chalk13.red("\n Not authenticated. Run `caliber login` first.\n"));
|
|
2869
|
+
throw new Error("__exit__");
|
|
2870
|
+
}
|
|
2871
|
+
console.log(chalk13.hex("#6366f1").bold("\n Share your feedback\n"));
|
|
2872
|
+
console.log(chalk13.dim(" We'd love to hear how Caliber is working for you."));
|
|
2873
|
+
console.log(chalk13.dim(" This takes under 2 minutes.\n"));
|
|
2874
|
+
const rating = await promptRating();
|
|
2875
|
+
const bestPart = await prompt(chalk13.cyan("\n What did you find most useful? "));
|
|
2876
|
+
const biggestGap = await prompt(chalk13.cyan("\n What was missing or could be better? "));
|
|
2877
|
+
const wouldRecommend = await promptRecommend();
|
|
2878
|
+
const answers = { rating, bestPart, biggestGap, wouldRecommend };
|
|
2879
|
+
console.log(chalk13.bold("\n Your review:\n"));
|
|
2880
|
+
console.log(` Rating: ${starRating(answers.rating)} (${answers.rating}/5)`);
|
|
2881
|
+
console.log(` Most useful: ${answers.bestPart || chalk13.dim("(skipped)")}`);
|
|
2882
|
+
console.log(` Could be better: ${answers.biggestGap || chalk13.dim("(skipped)")}`);
|
|
2883
|
+
console.log(` Would recommend: ${answers.wouldRecommend}`);
|
|
2884
|
+
const confirm = await prompt(chalk13.cyan("\n Submit this review? (Y/n): "));
|
|
2885
|
+
if (confirm.toLowerCase() === "n") {
|
|
2886
|
+
console.log(chalk13.dim("\n Review cancelled.\n"));
|
|
2887
|
+
return;
|
|
2888
|
+
}
|
|
2889
|
+
const spinner = ora10("Submitting review...").start();
|
|
2890
|
+
try {
|
|
2891
|
+
await apiRequest("/api/reviews", {
|
|
2892
|
+
method: "POST",
|
|
2893
|
+
body: {
|
|
2894
|
+
rating: answers.rating,
|
|
2895
|
+
bestPart: answers.bestPart,
|
|
2896
|
+
biggestGap: answers.biggestGap,
|
|
2897
|
+
wouldRecommend: answers.wouldRecommend
|
|
2898
|
+
}
|
|
2899
|
+
});
|
|
2900
|
+
spinner.succeed("Review submitted");
|
|
2901
|
+
trackEvent("review_submitted", {
|
|
2902
|
+
rating: answers.rating,
|
|
2903
|
+
would_recommend: answers.wouldRecommend
|
|
2904
|
+
});
|
|
2905
|
+
console.log(chalk13.green.bold("\n Thank you for your feedback!\n"));
|
|
2906
|
+
} catch (err) {
|
|
2907
|
+
spinner.fail("Failed to submit review");
|
|
2908
|
+
trackEvent("error_occurred", {
|
|
2909
|
+
error_type: "review_submit_failed",
|
|
2910
|
+
error_message: err instanceof Error ? err.message : "Unknown error",
|
|
2911
|
+
command: "review"
|
|
2912
|
+
});
|
|
2913
|
+
throw new Error("__exit__");
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2783
2917
|
// src/cli.ts
|
|
2784
|
-
var __dirname2 =
|
|
2918
|
+
var __dirname2 = path17.dirname(fileURLToPath3(import.meta.url));
|
|
2785
2919
|
var pkg3 = JSON.parse(
|
|
2786
|
-
|
|
2920
|
+
fs20.readFileSync(path17.resolve(__dirname2, "..", "package.json"), "utf-8")
|
|
2787
2921
|
);
|
|
2788
2922
|
var program = new Command();
|
|
2789
2923
|
program.name("caliber").description("Configure your coding agent environment").version(pkg3.version);
|
|
@@ -2798,27 +2932,28 @@ program.command("health").description("Analyze context health and quality").opti
|
|
|
2798
2932
|
program.command("sync").description("Sync local config with server state").option("--platform <platform>", "Target platform: claude, cursor, or both").option("--dry-run", "Preview changes without writing files").action(syncCommand);
|
|
2799
2933
|
program.command("diff").description("Compare local config with server state").option("--platform <platform>", "Target platform: claude, cursor, or both").action(diffCommand);
|
|
2800
2934
|
program.command("refresh").description("Update docs based on recent code changes").option("--quiet", "Suppress output (for use in hooks)").option("--dry-run", "Preview changes without writing files").action(refreshCommand);
|
|
2935
|
+
program.command("review").description("Share feedback on Caliber").action(reviewCommand);
|
|
2801
2936
|
var hooks = program.command("hooks").description("Manage Claude Code session hooks");
|
|
2802
2937
|
hooks.command("install").description("Install auto-refresh SessionEnd hook").action(hooksInstallCommand);
|
|
2803
2938
|
hooks.command("remove").description("Remove auto-refresh SessionEnd hook").action(hooksRemoveCommand);
|
|
2804
2939
|
hooks.command("status").description("Check if auto-refresh hook is installed").action(hooksStatusCommand);
|
|
2805
2940
|
|
|
2806
2941
|
// src/utils/version-check.ts
|
|
2807
|
-
import
|
|
2808
|
-
import
|
|
2942
|
+
import fs21 from "fs";
|
|
2943
|
+
import path18 from "path";
|
|
2809
2944
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
2810
|
-
import
|
|
2945
|
+
import readline4 from "readline";
|
|
2811
2946
|
import { execSync as execSync4 } from "child_process";
|
|
2812
|
-
import
|
|
2813
|
-
import
|
|
2814
|
-
var __dirname_vc =
|
|
2947
|
+
import chalk14 from "chalk";
|
|
2948
|
+
import ora11 from "ora";
|
|
2949
|
+
var __dirname_vc = path18.dirname(fileURLToPath4(import.meta.url));
|
|
2815
2950
|
var pkg4 = JSON.parse(
|
|
2816
|
-
|
|
2951
|
+
fs21.readFileSync(path18.resolve(__dirname_vc, "..", "package.json"), "utf-8")
|
|
2817
2952
|
);
|
|
2818
2953
|
function promptYesNo(question) {
|
|
2819
|
-
const rl =
|
|
2954
|
+
const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
|
|
2820
2955
|
return new Promise((resolve2) => {
|
|
2821
|
-
rl.question(
|
|
2956
|
+
rl.question(chalk14.cyan(`${question} `), (answer) => {
|
|
2822
2957
|
rl.close();
|
|
2823
2958
|
const normalized = answer.trim().toLowerCase();
|
|
2824
2959
|
resolve2(normalized === "" || normalized === "y" || normalized === "yes");
|
|
@@ -2842,17 +2977,17 @@ async function checkForUpdates() {
|
|
|
2842
2977
|
const isInteractive = process.stdin.isTTY === true;
|
|
2843
2978
|
if (!isInteractive) {
|
|
2844
2979
|
console.log(
|
|
2845
|
-
|
|
2980
|
+
chalk14.yellow(
|
|
2846
2981
|
`
|
|
2847
2982
|
Update available: ${current} -> ${latest}
|
|
2848
|
-
Run ${
|
|
2983
|
+
Run ${chalk14.bold("npm install -g @caliber-ai/cli")} to upgrade.
|
|
2849
2984
|
`
|
|
2850
2985
|
)
|
|
2851
2986
|
);
|
|
2852
2987
|
return;
|
|
2853
2988
|
}
|
|
2854
2989
|
console.log(
|
|
2855
|
-
|
|
2990
|
+
chalk14.yellow(`
|
|
2856
2991
|
Update available: ${current} -> ${latest}`)
|
|
2857
2992
|
);
|
|
2858
2993
|
const shouldUpdate = await promptYesNo("Would you like to update now? (Y/n)");
|
|
@@ -2860,12 +2995,12 @@ Update available: ${current} -> ${latest}`)
|
|
|
2860
2995
|
console.log();
|
|
2861
2996
|
return;
|
|
2862
2997
|
}
|
|
2863
|
-
const spinner =
|
|
2998
|
+
const spinner = ora11("Updating @caliber-ai/cli...").start();
|
|
2864
2999
|
try {
|
|
2865
3000
|
execSync4("npm install -g @caliber-ai/cli --force", { stdio: "pipe" });
|
|
2866
|
-
spinner.succeed(
|
|
3001
|
+
spinner.succeed(chalk14.green(`Updated to ${latest}`));
|
|
2867
3002
|
const args = process.argv.slice(2);
|
|
2868
|
-
console.log(
|
|
3003
|
+
console.log(chalk14.dim(`
|
|
2869
3004
|
Restarting: caliber ${args.join(" ")}
|
|
2870
3005
|
`));
|
|
2871
3006
|
execSync4(`caliber ${args.map((a) => JSON.stringify(a)).join(" ")}`, {
|
|
@@ -2875,8 +3010,8 @@ Restarting: caliber ${args.join(" ")}
|
|
|
2875
3010
|
} catch {
|
|
2876
3011
|
spinner.fail("Update failed");
|
|
2877
3012
|
console.log(
|
|
2878
|
-
|
|
2879
|
-
`Run ${
|
|
3013
|
+
chalk14.yellow(
|
|
3014
|
+
`Run ${chalk14.bold("npm install -g @caliber-ai/cli")} manually to upgrade.
|
|
2880
3015
|
`
|
|
2881
3016
|
)
|
|
2882
3017
|
);
|