@rely-ai/caliber 1.45.0 → 1.45.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/bin.js +555 -557
- package/package.json +2 -1
package/dist/bin.js
CHANGED
|
@@ -969,7 +969,7 @@ __export(review_exports, {
|
|
|
969
969
|
promptReviewMethod: () => promptReviewMethod,
|
|
970
970
|
promptWantsReview: () => promptWantsReview
|
|
971
971
|
});
|
|
972
|
-
import
|
|
972
|
+
import chalk9 from "chalk";
|
|
973
973
|
import fs30 from "fs";
|
|
974
974
|
import select4 from "@inquirer/select";
|
|
975
975
|
import { createTwoFilesPatch } from "diff";
|
|
@@ -1008,7 +1008,7 @@ async function openReview(method, stagedFiles) {
|
|
|
1008
1008
|
proposedPath: f.proposedPath
|
|
1009
1009
|
}))
|
|
1010
1010
|
);
|
|
1011
|
-
console.log(
|
|
1011
|
+
console.log(chalk9.dim(" Diffs opened in your editor.\n"));
|
|
1012
1012
|
return;
|
|
1013
1013
|
}
|
|
1014
1014
|
const fileInfos = stagedFiles.map((file) => {
|
|
@@ -1039,8 +1039,8 @@ async function openReview(method, stagedFiles) {
|
|
|
1039
1039
|
async function interactiveDiffExplorer(files) {
|
|
1040
1040
|
if (!process.stdin.isTTY) {
|
|
1041
1041
|
for (const f of files) {
|
|
1042
|
-
const icon = f.isNew ?
|
|
1043
|
-
const stats = f.isNew ?
|
|
1042
|
+
const icon = f.isNew ? chalk9.green("+") : chalk9.yellow("~");
|
|
1043
|
+
const stats = f.isNew ? chalk9.dim(`${f.lines} lines`) : `${chalk9.green(`+${f.added}`)} ${chalk9.red(`-${f.removed}`)}`;
|
|
1044
1044
|
console.log(` ${icon} ${f.relativePath} ${stats}`);
|
|
1045
1045
|
}
|
|
1046
1046
|
console.log("");
|
|
@@ -1056,47 +1056,47 @@ async function interactiveDiffExplorer(files) {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
function renderFileList() {
|
|
1058
1058
|
const lines = [];
|
|
1059
|
-
lines.push(
|
|
1059
|
+
lines.push(chalk9.bold(" Review changes"));
|
|
1060
1060
|
lines.push("");
|
|
1061
1061
|
for (let i = 0; i < files.length; i++) {
|
|
1062
1062
|
const f = files[i];
|
|
1063
|
-
const ptr = i === cursor ?
|
|
1064
|
-
const icon = f.isNew ?
|
|
1065
|
-
const stats = f.isNew ?
|
|
1063
|
+
const ptr = i === cursor ? chalk9.cyan(">") : " ";
|
|
1064
|
+
const icon = f.isNew ? chalk9.green("+") : chalk9.yellow("~");
|
|
1065
|
+
const stats = f.isNew ? chalk9.dim(`${f.lines} lines`) : `${chalk9.green(`+${f.added}`)} ${chalk9.red(`-${f.removed}`)}`;
|
|
1066
1066
|
lines.push(` ${ptr} ${icon} ${f.relativePath} ${stats}`);
|
|
1067
1067
|
}
|
|
1068
1068
|
lines.push("");
|
|
1069
|
-
lines.push(
|
|
1069
|
+
lines.push(chalk9.dim(" \u2191\u2193 navigate \u23CE view diff q done"));
|
|
1070
1070
|
return lines.join("\n");
|
|
1071
1071
|
}
|
|
1072
1072
|
function renderDiff(index) {
|
|
1073
1073
|
const f = files[index];
|
|
1074
1074
|
const lines = [];
|
|
1075
|
-
const header = f.isNew ? ` ${
|
|
1075
|
+
const header = f.isNew ? ` ${chalk9.green("+")} ${f.relativePath} ${chalk9.dim("(new file)")}` : ` ${chalk9.yellow("~")} ${f.relativePath} ${chalk9.green(`+${f.added}`)} ${chalk9.red(`-${f.removed}`)}`;
|
|
1076
1076
|
lines.push(header);
|
|
1077
|
-
lines.push(
|
|
1077
|
+
lines.push(chalk9.dim(" " + "\u2500".repeat(60)));
|
|
1078
1078
|
const patchLines = f.patch.split("\n");
|
|
1079
1079
|
const bodyLines = patchLines.slice(4);
|
|
1080
1080
|
const maxVisible = getTermHeight() - 4;
|
|
1081
1081
|
const visibleLines = bodyLines.slice(scrollOffset, scrollOffset + maxVisible);
|
|
1082
1082
|
for (const line of visibleLines) {
|
|
1083
1083
|
if (line.startsWith("+")) {
|
|
1084
|
-
lines.push(
|
|
1084
|
+
lines.push(chalk9.green(" " + line));
|
|
1085
1085
|
} else if (line.startsWith("-")) {
|
|
1086
|
-
lines.push(
|
|
1086
|
+
lines.push(chalk9.red(" " + line));
|
|
1087
1087
|
} else if (line.startsWith("@@")) {
|
|
1088
|
-
lines.push(
|
|
1088
|
+
lines.push(chalk9.cyan(" " + line));
|
|
1089
1089
|
} else {
|
|
1090
|
-
lines.push(
|
|
1090
|
+
lines.push(chalk9.dim(" " + line));
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
const totalBody = bodyLines.length;
|
|
1094
1094
|
if (totalBody > maxVisible) {
|
|
1095
1095
|
const pct = Math.round((scrollOffset + maxVisible) / totalBody * 100);
|
|
1096
|
-
lines.push(
|
|
1096
|
+
lines.push(chalk9.dim(` \u2500\u2500 ${Math.min(pct, 100)}% \u2500\u2500`));
|
|
1097
1097
|
}
|
|
1098
1098
|
lines.push("");
|
|
1099
|
-
lines.push(
|
|
1099
|
+
lines.push(chalk9.dim(" \u2191\u2193 scroll \u23B5/esc back to file list"));
|
|
1100
1100
|
return lines.join("\n");
|
|
1101
1101
|
}
|
|
1102
1102
|
function draw(initial) {
|
|
@@ -1249,7 +1249,7 @@ import { fileURLToPath } from "url";
|
|
|
1249
1249
|
|
|
1250
1250
|
// src/commands/init.ts
|
|
1251
1251
|
import path28 from "path";
|
|
1252
|
-
import
|
|
1252
|
+
import chalk13 from "chalk";
|
|
1253
1253
|
import fs35 from "fs";
|
|
1254
1254
|
|
|
1255
1255
|
// src/fingerprint/index.ts
|
|
@@ -3197,11 +3197,11 @@ function spawnOpenCode(args) {
|
|
|
3197
3197
|
});
|
|
3198
3198
|
}
|
|
3199
3199
|
}
|
|
3200
|
-
function runCommand(args,
|
|
3200
|
+
function runCommand(args, input2, timeoutMs) {
|
|
3201
3201
|
return new Promise((resolve3, reject) => {
|
|
3202
3202
|
const child = spawnOpenCode(args);
|
|
3203
3203
|
const stderrChunks = [];
|
|
3204
|
-
child.stdin.end(
|
|
3204
|
+
child.stdin.end(input2);
|
|
3205
3205
|
let stdoutData = Buffer.alloc(0);
|
|
3206
3206
|
child.stdout.on("data", (chunk) => {
|
|
3207
3207
|
stdoutData = Buffer.concat([stdoutData, chunk]);
|
|
@@ -3235,13 +3235,13 @@ function runCommand(args, input, timeoutMs) {
|
|
|
3235
3235
|
});
|
|
3236
3236
|
});
|
|
3237
3237
|
}
|
|
3238
|
-
function runCommandStream(args,
|
|
3238
|
+
function runCommandStream(args, input2, callbacks, timeoutMs) {
|
|
3239
3239
|
return new Promise((resolve3, reject) => {
|
|
3240
3240
|
const child = spawnOpenCode(args);
|
|
3241
3241
|
const stderrChunks = [];
|
|
3242
3242
|
let settled = false;
|
|
3243
3243
|
let lineBuffer = "";
|
|
3244
|
-
child.stdin.end(
|
|
3244
|
+
child.stdin.end(input2);
|
|
3245
3245
|
child.stdout.on("data", (chunk) => {
|
|
3246
3246
|
const text = chunk.toString("utf-8");
|
|
3247
3247
|
lineBuffer += text;
|
|
@@ -6909,17 +6909,15 @@ function getCurrentHeadSha() {
|
|
|
6909
6909
|
}
|
|
6910
6910
|
|
|
6911
6911
|
// src/utils/prompt.ts
|
|
6912
|
-
import
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
});
|
|
6922
|
-
});
|
|
6912
|
+
import input from "@inquirer/input";
|
|
6913
|
+
async function promptInput(question) {
|
|
6914
|
+
if (!process.stdin.isTTY) return "";
|
|
6915
|
+
try {
|
|
6916
|
+
const answer = await input({ message: question });
|
|
6917
|
+
return answer.trim();
|
|
6918
|
+
} catch {
|
|
6919
|
+
return "";
|
|
6920
|
+
}
|
|
6923
6921
|
}
|
|
6924
6922
|
|
|
6925
6923
|
// src/commands/init.ts
|
|
@@ -6927,7 +6925,7 @@ init_config();
|
|
|
6927
6925
|
|
|
6928
6926
|
// src/commands/interactive-provider-setup.ts
|
|
6929
6927
|
init_config();
|
|
6930
|
-
import
|
|
6928
|
+
import chalk2 from "chalk";
|
|
6931
6929
|
import select2 from "@inquirer/select";
|
|
6932
6930
|
import confirm from "@inquirer/confirm";
|
|
6933
6931
|
var IS_WINDOWS4 = process.platform === "win32";
|
|
@@ -6951,25 +6949,25 @@ async function runInteractiveProviderSetup(options) {
|
|
|
6951
6949
|
case "claude-cli": {
|
|
6952
6950
|
config.model = "default";
|
|
6953
6951
|
if (!isClaudeCliAvailable()) {
|
|
6954
|
-
console.log(
|
|
6952
|
+
console.log(chalk2.yellow("\n Claude Code CLI not found."));
|
|
6955
6953
|
console.log(
|
|
6956
|
-
|
|
6954
|
+
chalk2.dim(" Install it: ") + chalk2.hex("#83D1EB")("npm install -g @anthropic-ai/claude-code")
|
|
6957
6955
|
);
|
|
6958
6956
|
console.log(
|
|
6959
|
-
|
|
6957
|
+
chalk2.dim(" Then run ") + chalk2.hex("#83D1EB")("claude") + chalk2.dim(" once to log in.\n")
|
|
6960
6958
|
);
|
|
6961
6959
|
const proceed = await confirm({ message: "Continue anyway?" });
|
|
6962
6960
|
if (!proceed) throw new Error("__exit__");
|
|
6963
6961
|
} else if (!isClaudeCliLoggedIn()) {
|
|
6964
|
-
console.log(
|
|
6962
|
+
console.log(chalk2.yellow("\n Claude Code CLI found but not logged in."));
|
|
6965
6963
|
console.log(
|
|
6966
|
-
|
|
6964
|
+
chalk2.dim(" Run ") + chalk2.hex("#83D1EB")("claude") + chalk2.dim(" once to log in.\n")
|
|
6967
6965
|
);
|
|
6968
6966
|
const proceed = await confirm({ message: "Continue anyway?" });
|
|
6969
6967
|
if (!proceed) throw new Error("__exit__");
|
|
6970
6968
|
} else {
|
|
6971
6969
|
console.log(
|
|
6972
|
-
|
|
6970
|
+
chalk2.dim(
|
|
6973
6971
|
" Run `claude` once and log in with your Pro/Max/Team account if you haven't."
|
|
6974
6972
|
)
|
|
6975
6973
|
);
|
|
@@ -6978,10 +6976,10 @@ async function runInteractiveProviderSetup(options) {
|
|
|
6978
6976
|
}
|
|
6979
6977
|
case "opencode": {
|
|
6980
6978
|
if (!isOpenCodeAvailable()) {
|
|
6981
|
-
console.log(
|
|
6982
|
-
console.log(
|
|
6979
|
+
console.log(chalk2.yellow("\n OpenCode CLI not found."));
|
|
6980
|
+
console.log(chalk2.dim(" Install it from: ") + chalk2.hex("#83D1EB")("https://opencode.ai"));
|
|
6983
6981
|
console.log(
|
|
6984
|
-
|
|
6982
|
+
chalk2.dim(" Then run ") + chalk2.hex("#83D1EB")("opencode auth login") + chalk2.dim(" to authenticate.\n")
|
|
6985
6983
|
);
|
|
6986
6984
|
const proceed = await confirm({ message: "Continue anyway?" });
|
|
6987
6985
|
if (!proceed) throw new Error("__exit__");
|
|
@@ -6991,28 +6989,28 @@ async function runInteractiveProviderSetup(options) {
|
|
|
6991
6989
|
}
|
|
6992
6990
|
case "cursor": {
|
|
6993
6991
|
if (!isCursorAgentAvailable()) {
|
|
6994
|
-
console.log(
|
|
6992
|
+
console.log(chalk2.yellow("\n Cursor Agent CLI not found."));
|
|
6995
6993
|
if (IS_WINDOWS4) {
|
|
6996
6994
|
console.log(
|
|
6997
|
-
|
|
6995
|
+
chalk2.dim(" Install it from: ") + chalk2.hex("#83D1EB")("https://www.cursor.com/downloads")
|
|
6998
6996
|
);
|
|
6999
6997
|
console.log(
|
|
7000
|
-
|
|
6998
|
+
chalk2.dim(" Then run ") + chalk2.hex("#83D1EB")("agent login") + chalk2.dim(" in PowerShell to authenticate.\n")
|
|
7001
6999
|
);
|
|
7002
7000
|
} else {
|
|
7003
7001
|
console.log(
|
|
7004
|
-
|
|
7002
|
+
chalk2.dim(" Install it: ") + chalk2.hex("#83D1EB")("curl https://cursor.com/install -fsS | bash")
|
|
7005
7003
|
);
|
|
7006
7004
|
console.log(
|
|
7007
|
-
|
|
7005
|
+
chalk2.dim(" Then run ") + chalk2.hex("#83D1EB")("agent login") + chalk2.dim(" to authenticate.\n")
|
|
7008
7006
|
);
|
|
7009
7007
|
}
|
|
7010
7008
|
const proceed = await confirm({ message: "Continue anyway?" });
|
|
7011
7009
|
if (!proceed) throw new Error("__exit__");
|
|
7012
7010
|
} else if (!isCursorLoggedIn()) {
|
|
7013
|
-
console.log(
|
|
7011
|
+
console.log(chalk2.yellow("\n Cursor Agent CLI found but not logged in."));
|
|
7014
7012
|
console.log(
|
|
7015
|
-
|
|
7013
|
+
chalk2.dim(" Run ") + chalk2.hex("#83D1EB")("agent login") + chalk2.dim(" to authenticate.\n")
|
|
7016
7014
|
);
|
|
7017
7015
|
const proceed = await confirm({ message: "Continue anyway?" });
|
|
7018
7016
|
if (!proceed) throw new Error("__exit__");
|
|
@@ -7022,13 +7020,13 @@ async function runInteractiveProviderSetup(options) {
|
|
|
7022
7020
|
}
|
|
7023
7021
|
case "anthropic": {
|
|
7024
7022
|
console.log(
|
|
7025
|
-
|
|
7023
|
+
chalk2.dim(
|
|
7026
7024
|
" Get a key at https://console.anthropic.com (same account as Claude Pro/Team/Max)."
|
|
7027
7025
|
)
|
|
7028
7026
|
);
|
|
7029
7027
|
config.apiKey = await promptInput("Anthropic API key:");
|
|
7030
7028
|
if (!config.apiKey) {
|
|
7031
|
-
console.log(
|
|
7029
|
+
console.log(chalk2.red("API key is required."));
|
|
7032
7030
|
throw new Error("__exit__");
|
|
7033
7031
|
}
|
|
7034
7032
|
config.model = await promptInput(`Model (default: ${DEFAULT_MODELS.anthropic}):`) || DEFAULT_MODELS.anthropic;
|
|
@@ -7037,7 +7035,7 @@ async function runInteractiveProviderSetup(options) {
|
|
|
7037
7035
|
case "vertex": {
|
|
7038
7036
|
config.vertexProjectId = await promptInput("GCP Project ID:");
|
|
7039
7037
|
if (!config.vertexProjectId) {
|
|
7040
|
-
console.log(
|
|
7038
|
+
console.log(chalk2.red("Project ID is required."));
|
|
7041
7039
|
throw new Error("__exit__");
|
|
7042
7040
|
}
|
|
7043
7041
|
config.vertexRegion = await promptInput("Region (default: us-east5):") || "us-east5";
|
|
@@ -7048,7 +7046,7 @@ async function runInteractiveProviderSetup(options) {
|
|
|
7048
7046
|
case "openai": {
|
|
7049
7047
|
config.apiKey = await promptInput("API key:");
|
|
7050
7048
|
if (!config.apiKey) {
|
|
7051
|
-
console.log(
|
|
7049
|
+
console.log(chalk2.red("API key is required."));
|
|
7052
7050
|
throw new Error("__exit__");
|
|
7053
7051
|
}
|
|
7054
7052
|
config.baseUrl = await promptInput("Base URL (leave empty for OpenAI, or enter custom endpoint):") || void 0;
|
|
@@ -7056,10 +7054,10 @@ async function runInteractiveProviderSetup(options) {
|
|
|
7056
7054
|
break;
|
|
7057
7055
|
}
|
|
7058
7056
|
case "minimax": {
|
|
7059
|
-
console.log(
|
|
7057
|
+
console.log(chalk2.dim(" Get a key at https://platform.minimax.io"));
|
|
7060
7058
|
config.apiKey = await promptInput("MiniMax API key:");
|
|
7061
7059
|
if (!config.apiKey) {
|
|
7062
|
-
console.log(
|
|
7060
|
+
console.log(chalk2.red("API key is required."));
|
|
7063
7061
|
throw new Error("__exit__");
|
|
7064
7062
|
}
|
|
7065
7063
|
config.model = await promptInput(`Model (default: ${DEFAULT_MODELS.minimax}):`) || DEFAULT_MODELS.minimax;
|
|
@@ -8183,7 +8181,7 @@ function computeLocalScore(dir, targetAgent) {
|
|
|
8183
8181
|
|
|
8184
8182
|
// src/scoring/display.ts
|
|
8185
8183
|
init_resolve_caliber();
|
|
8186
|
-
import
|
|
8184
|
+
import chalk3 from "chalk";
|
|
8187
8185
|
var AGENT_DISPLAY_NAMES = {
|
|
8188
8186
|
claude: "Claude Code",
|
|
8189
8187
|
cursor: "Cursor",
|
|
@@ -8201,17 +8199,17 @@ var CATEGORY_ORDER = ["existence", "quality", "grounding", "accuracy", "freshnes
|
|
|
8201
8199
|
function gradeColor(grade) {
|
|
8202
8200
|
switch (grade) {
|
|
8203
8201
|
case "A":
|
|
8204
|
-
return
|
|
8202
|
+
return chalk3.green;
|
|
8205
8203
|
case "B":
|
|
8206
|
-
return
|
|
8204
|
+
return chalk3.greenBright;
|
|
8207
8205
|
case "C":
|
|
8208
|
-
return
|
|
8206
|
+
return chalk3.yellow;
|
|
8209
8207
|
case "D":
|
|
8210
|
-
return
|
|
8208
|
+
return chalk3.hex("#f97316");
|
|
8211
8209
|
case "F":
|
|
8212
|
-
return
|
|
8210
|
+
return chalk3.red;
|
|
8213
8211
|
default:
|
|
8214
|
-
return
|
|
8212
|
+
return chalk3.white;
|
|
8215
8213
|
}
|
|
8216
8214
|
}
|
|
8217
8215
|
var GRADIENT_COLORS = ["#ef4444", "#f97316", "#eab308", "#22c55e"];
|
|
@@ -8225,37 +8223,37 @@ function progressBar(score, max, width = 40) {
|
|
|
8225
8223
|
GRADIENT_COLORS.length - 1,
|
|
8226
8224
|
Math.floor(position * GRADIENT_COLORS.length)
|
|
8227
8225
|
);
|
|
8228
|
-
bar +=
|
|
8226
|
+
bar += chalk3.hex(GRADIENT_COLORS[colorIndex])("\u2593");
|
|
8229
8227
|
}
|
|
8230
|
-
bar +=
|
|
8228
|
+
bar += chalk3.gray("\u2591".repeat(empty));
|
|
8231
8229
|
return bar;
|
|
8232
8230
|
}
|
|
8233
8231
|
function formatCheck(check) {
|
|
8234
8232
|
const isPartial = !check.passed && check.earnedPoints > 0;
|
|
8235
8233
|
const isNegative = check.earnedPoints < 0;
|
|
8236
8234
|
const lostPoints = check.maxPoints - check.earnedPoints;
|
|
8237
|
-
const icon = check.passed ?
|
|
8235
|
+
const icon = check.passed ? chalk3.green("\u2713") : isPartial ? chalk3.yellow("~") : isNegative ? chalk3.red("\u2717") : chalk3.gray("\u2717");
|
|
8238
8236
|
let points;
|
|
8239
8237
|
if (check.passed) {
|
|
8240
|
-
points =
|
|
8238
|
+
points = chalk3.green(`+${check.earnedPoints}`.padStart(4));
|
|
8241
8239
|
} else if (isNegative) {
|
|
8242
|
-
points =
|
|
8240
|
+
points = chalk3.red(`${check.earnedPoints}`.padStart(4));
|
|
8243
8241
|
} else if (isPartial) {
|
|
8244
|
-
points =
|
|
8242
|
+
points = chalk3.yellow(`${check.earnedPoints}/${check.maxPoints}`.padStart(5));
|
|
8245
8243
|
} else {
|
|
8246
|
-
points =
|
|
8244
|
+
points = chalk3.gray(`0/${check.maxPoints}`.padStart(5));
|
|
8247
8245
|
}
|
|
8248
|
-
const name = check.passed ?
|
|
8249
|
-
const detail = check.detail ?
|
|
8246
|
+
const name = check.passed ? chalk3.white(check.name) : isNegative ? chalk3.red(check.name) : isPartial ? chalk3.white(check.name) : chalk3.gray(check.name);
|
|
8247
|
+
const detail = check.detail ? chalk3.gray(` (${check.detail})`) : "";
|
|
8250
8248
|
let suggestion = "";
|
|
8251
8249
|
if (!check.passed && check.suggestion) {
|
|
8252
|
-
const suggColor = isNegative ?
|
|
8250
|
+
const suggColor = isNegative ? chalk3.red : chalk3.yellow;
|
|
8253
8251
|
suggestion = suggColor(`
|
|
8254
8252
|
\u2192 ${check.suggestion}`);
|
|
8255
8253
|
}
|
|
8256
8254
|
let recovery = "";
|
|
8257
8255
|
if (isPartial && lostPoints > 0) {
|
|
8258
|
-
recovery =
|
|
8256
|
+
recovery = chalk3.yellow(`
|
|
8259
8257
|
\u2191 Fix this for +${lostPoints} more points`);
|
|
8260
8258
|
}
|
|
8261
8259
|
return ` ${icon} ${name.padEnd(38)}${points}${detail}${suggestion}${recovery}`;
|
|
@@ -8264,22 +8262,22 @@ function displayScore(result) {
|
|
|
8264
8262
|
const gc = gradeColor(result.grade);
|
|
8265
8263
|
const agentLabel = result.targetAgent.map((a) => AGENT_DISPLAY_NAMES[a] || a).join(" + ");
|
|
8266
8264
|
console.log("");
|
|
8267
|
-
console.log(
|
|
8265
|
+
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
8268
8266
|
console.log("");
|
|
8269
|
-
console.log(` ${
|
|
8267
|
+
console.log(` ${chalk3.bold("Agent Config Score")} ${gc(chalk3.bold(`${result.score} / ${result.maxScore}`))} Grade ${gc(chalk3.bold(result.grade))}`);
|
|
8270
8268
|
console.log(` ${progressBar(result.score, result.maxScore)}`);
|
|
8271
|
-
console.log(
|
|
8269
|
+
console.log(chalk3.dim(` Target: ${agentLabel}`));
|
|
8272
8270
|
console.log("");
|
|
8273
|
-
console.log(
|
|
8271
|
+
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
8274
8272
|
console.log("");
|
|
8275
8273
|
for (const category of CATEGORY_ORDER) {
|
|
8276
8274
|
const summary = result.categories[category];
|
|
8277
8275
|
const categoryChecks = result.checks.filter((c) => c.category === category);
|
|
8278
8276
|
const { icon, label } = CATEGORY_LABELS[category];
|
|
8279
8277
|
const gap = summary.max - summary.earned;
|
|
8280
|
-
const gapLabel = gap > 0 ?
|
|
8278
|
+
const gapLabel = gap > 0 ? chalk3.yellow(` (-${gap} available)`) : "";
|
|
8281
8279
|
console.log(
|
|
8282
|
-
|
|
8280
|
+
chalk3.gray(` ${icon} ${label}`) + chalk3.gray(" ".repeat(Math.max(1, 43 - label.length))) + chalk3.white(`${summary.earned}`) + chalk3.gray(` / ${summary.max}`) + gapLabel
|
|
8283
8281
|
);
|
|
8284
8282
|
for (const check of categoryChecks) {
|
|
8285
8283
|
console.log(formatCheck(check));
|
|
@@ -8291,16 +8289,16 @@ function displayScore(result) {
|
|
|
8291
8289
|
function formatTopImprovements(checks) {
|
|
8292
8290
|
const improvable = checks.filter((c) => c.earnedPoints < c.maxPoints).map((c) => ({ name: c.name, potential: c.maxPoints - c.earnedPoints, suggestion: c.suggestion })).sort((a, b) => b.potential - a.potential).slice(0, 5);
|
|
8293
8291
|
if (improvable.length === 0) return;
|
|
8294
|
-
console.log(
|
|
8292
|
+
console.log(chalk3.gray(" \u2500 TOP IMPROVEMENTS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
8295
8293
|
console.log("");
|
|
8296
8294
|
for (let i = 0; i < improvable.length; i++) {
|
|
8297
8295
|
const item = improvable[i];
|
|
8298
|
-
const num =
|
|
8299
|
-
const label =
|
|
8300
|
-
const pts =
|
|
8296
|
+
const num = chalk3.gray(`${i + 1}.`);
|
|
8297
|
+
const label = chalk3.white(item.name.padEnd(42));
|
|
8298
|
+
const pts = chalk3.yellow(`+${item.potential} pts`);
|
|
8301
8299
|
console.log(` ${num} ${label}${pts}`);
|
|
8302
8300
|
if (item.suggestion) {
|
|
8303
|
-
console.log(
|
|
8301
|
+
console.log(chalk3.gray(` ${item.suggestion}`));
|
|
8304
8302
|
}
|
|
8305
8303
|
}
|
|
8306
8304
|
console.log("");
|
|
@@ -8310,48 +8308,48 @@ function displayScoreSummary(result) {
|
|
|
8310
8308
|
const agentLabel = result.targetAgent.map((a) => AGENT_DISPLAY_NAMES[a] || a).join(" + ");
|
|
8311
8309
|
console.log("");
|
|
8312
8310
|
console.log(
|
|
8313
|
-
|
|
8311
|
+
chalk3.gray(" ") + gc(`${result.score}/${result.maxScore}`) + chalk3.gray(` (Grade ${result.grade})`) + chalk3.gray(` \xB7 ${agentLabel}`) + chalk3.gray(` \xB7 ${progressBar(result.score, result.maxScore, 20)}`)
|
|
8314
8312
|
);
|
|
8315
8313
|
const failing = result.checks.filter((c) => !c.passed);
|
|
8316
8314
|
if (failing.length > 0) {
|
|
8317
8315
|
const shown = failing.slice(0, 5);
|
|
8318
8316
|
for (const check of shown) {
|
|
8319
|
-
console.log(
|
|
8317
|
+
console.log(chalk3.gray(` \u2717 ${check.name}`));
|
|
8320
8318
|
}
|
|
8321
8319
|
const remaining = failing.length - shown.length;
|
|
8322
8320
|
const moreText = remaining > 0 ? ` (+${remaining} more)` : "";
|
|
8323
|
-
console.log(
|
|
8324
|
-
Run ${
|
|
8321
|
+
console.log(chalk3.dim(`
|
|
8322
|
+
Run ${chalk3.hex("#83D1EB")(`${resolveCaliber()} score`)} for details.${moreText}`));
|
|
8325
8323
|
}
|
|
8326
8324
|
console.log("");
|
|
8327
8325
|
}
|
|
8328
8326
|
function displayScoreDelta(before, after) {
|
|
8329
8327
|
const delta = after.score - before.score;
|
|
8330
8328
|
const deltaStr = delta >= 0 ? `+${delta}` : `${delta}`;
|
|
8331
|
-
const deltaColor = delta >= 0 ?
|
|
8329
|
+
const deltaColor = delta >= 0 ? chalk3.green : chalk3.red;
|
|
8332
8330
|
const beforeGc = gradeColor(before.grade);
|
|
8333
8331
|
const afterGc = gradeColor(after.grade);
|
|
8334
8332
|
console.log("");
|
|
8335
|
-
console.log(
|
|
8333
|
+
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
8336
8334
|
console.log("");
|
|
8337
8335
|
console.log(
|
|
8338
|
-
` Score: ${beforeGc(`${before.score}`)} ${
|
|
8336
|
+
` Score: ${beforeGc(`${before.score}`)} ${chalk3.gray("\u2192")} ${afterGc(`${after.score}`)} ${deltaColor(deltaStr + " pts")} ${beforeGc(before.grade)} ${chalk3.gray("\u2192")} ${afterGc(after.grade)}`
|
|
8339
8337
|
);
|
|
8340
|
-
console.log(` ${progressBar(before.score, before.maxScore, 19)} ${
|
|
8338
|
+
console.log(` ${progressBar(before.score, before.maxScore, 19)} ${chalk3.gray("\u2192")} ${progressBar(after.score, after.maxScore, 19)}`);
|
|
8341
8339
|
console.log("");
|
|
8342
|
-
console.log(
|
|
8340
|
+
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
8343
8341
|
console.log("");
|
|
8344
8342
|
const improved = after.checks.filter((ac) => {
|
|
8345
8343
|
const bc = before.checks.find((b) => b.id === ac.id);
|
|
8346
8344
|
return bc && ac.earnedPoints > bc.earnedPoints;
|
|
8347
8345
|
});
|
|
8348
8346
|
if (improved.length > 0) {
|
|
8349
|
-
console.log(
|
|
8347
|
+
console.log(chalk3.gray(" What improved:"));
|
|
8350
8348
|
for (const check of improved) {
|
|
8351
8349
|
const bc = before.checks.find((b) => b.id === check.id);
|
|
8352
8350
|
const gain = check.earnedPoints - bc.earnedPoints;
|
|
8353
8351
|
console.log(
|
|
8354
|
-
|
|
8352
|
+
chalk3.green(" +") + chalk3.white(` ${check.name.padEnd(50)}`) + chalk3.green(`+${gain}`)
|
|
8355
8353
|
);
|
|
8356
8354
|
}
|
|
8357
8355
|
console.log("");
|
|
@@ -8359,7 +8357,7 @@ function displayScoreDelta(before, after) {
|
|
|
8359
8357
|
}
|
|
8360
8358
|
|
|
8361
8359
|
// src/commands/recommend.ts
|
|
8362
|
-
import
|
|
8360
|
+
import chalk5 from "chalk";
|
|
8363
8361
|
import ora from "ora";
|
|
8364
8362
|
import select3 from "@inquirer/select";
|
|
8365
8363
|
import { mkdirSync, readFileSync as readFileSync4, readdirSync as readdirSync4, existsSync as existsSync8, writeFileSync } from "fs";
|
|
@@ -8368,7 +8366,7 @@ init_config();
|
|
|
8368
8366
|
|
|
8369
8367
|
// src/telemetry/index.ts
|
|
8370
8368
|
import { PostHog } from "posthog-node";
|
|
8371
|
-
import
|
|
8369
|
+
import chalk4 from "chalk";
|
|
8372
8370
|
|
|
8373
8371
|
// src/telemetry/config.ts
|
|
8374
8372
|
import fs27 from "fs";
|
|
@@ -8488,7 +8486,7 @@ function initTelemetry() {
|
|
|
8488
8486
|
});
|
|
8489
8487
|
if (!wasNoticeShown()) {
|
|
8490
8488
|
console.log(
|
|
8491
|
-
|
|
8489
|
+
chalk4.dim(" Caliber collects anonymous usage data to improve the product.") + "\n" + chalk4.dim(" Disable with --no-traces or CALIBER_TELEMETRY_DISABLED=1\n")
|
|
8492
8490
|
);
|
|
8493
8491
|
markNoticeShown();
|
|
8494
8492
|
}
|
|
@@ -8956,7 +8954,7 @@ async function searchSkills(fingerprint, targetPlatforms, onStatus) {
|
|
|
8956
8954
|
async function querySkills(query) {
|
|
8957
8955
|
const terms = query.split(/[\s,]+/).filter(Boolean);
|
|
8958
8956
|
if (terms.length === 0) {
|
|
8959
|
-
console.log(
|
|
8957
|
+
console.log(chalk5.yellow("Please provide search terms."));
|
|
8960
8958
|
throw new Error("__exit__");
|
|
8961
8959
|
}
|
|
8962
8960
|
const platforms = detectLocalPlatforms();
|
|
@@ -9004,7 +9002,7 @@ async function querySkills(query) {
|
|
|
9004
9002
|
const available = top.filter((r) => contentMap.has(r.slug));
|
|
9005
9003
|
fetchSpinner.succeed(`${available.length} available`);
|
|
9006
9004
|
if (!available.length) {
|
|
9007
|
-
console.log(
|
|
9005
|
+
console.log(chalk5.dim(" No installable skills found.\n"));
|
|
9008
9006
|
return;
|
|
9009
9007
|
}
|
|
9010
9008
|
console.log("");
|
|
@@ -9016,7 +9014,7 @@ async function querySkills(query) {
|
|
|
9016
9014
|
}
|
|
9017
9015
|
console.log("");
|
|
9018
9016
|
console.log(
|
|
9019
|
-
|
|
9017
|
+
chalk5.dim(
|
|
9020
9018
|
` Install with: ${resolveCaliber()} skills --install ${available.map((r) => r.slug).join(",")}`
|
|
9021
9019
|
)
|
|
9022
9020
|
);
|
|
@@ -9025,7 +9023,7 @@ async function querySkills(query) {
|
|
|
9025
9023
|
async function installBySlug(slugStr) {
|
|
9026
9024
|
const slugs = slugStr.split(",").map((s) => s.trim()).filter(Boolean);
|
|
9027
9025
|
if (slugs.length === 0) {
|
|
9028
|
-
console.log(
|
|
9026
|
+
console.log(chalk5.yellow("Please provide skill slugs to install."));
|
|
9029
9027
|
throw new Error("__exit__");
|
|
9030
9028
|
}
|
|
9031
9029
|
const platforms = detectLocalPlatforms();
|
|
@@ -9065,7 +9063,7 @@ async function recommendCommand(options) {
|
|
|
9065
9063
|
return;
|
|
9066
9064
|
}
|
|
9067
9065
|
if (!process.stdin.isTTY) {
|
|
9068
|
-
console.log(
|
|
9066
|
+
console.log(chalk5.dim(" Skills search requires an interactive terminal."));
|
|
9069
9067
|
return;
|
|
9070
9068
|
}
|
|
9071
9069
|
const proceed = await select3({
|
|
@@ -9076,7 +9074,7 @@ async function recommendCommand(options) {
|
|
|
9076
9074
|
]
|
|
9077
9075
|
});
|
|
9078
9076
|
if (!proceed) {
|
|
9079
|
-
console.log(
|
|
9077
|
+
console.log(chalk5.dim(" Cancelled.\n"));
|
|
9080
9078
|
return;
|
|
9081
9079
|
}
|
|
9082
9080
|
const state = readState();
|
|
@@ -9094,7 +9092,7 @@ async function searchAndInstallSkills(targetPlatforms) {
|
|
|
9094
9092
|
];
|
|
9095
9093
|
if (technologies.length === 0) {
|
|
9096
9094
|
console.log(
|
|
9097
|
-
|
|
9095
|
+
chalk5.yellow(
|
|
9098
9096
|
"Could not detect any languages or dependencies. Try running from a project root."
|
|
9099
9097
|
)
|
|
9100
9098
|
);
|
|
@@ -9114,7 +9112,7 @@ async function searchAndInstallSkills(targetPlatforms) {
|
|
|
9114
9112
|
return;
|
|
9115
9113
|
}
|
|
9116
9114
|
searchSpinner.succeed(
|
|
9117
|
-
`Found ${allCandidates.length} skills` + (filteredCount > 0 ?
|
|
9115
|
+
`Found ${allCandidates.length} skills` + (filteredCount > 0 ? chalk5.dim(` (${filteredCount} already installed)`) : "")
|
|
9118
9116
|
);
|
|
9119
9117
|
let results;
|
|
9120
9118
|
const config = loadConfig();
|
|
@@ -9152,7 +9150,7 @@ async function searchAndInstallSkills(targetPlatforms) {
|
|
|
9152
9150
|
}
|
|
9153
9151
|
const unavailableCount = results.length - available.length;
|
|
9154
9152
|
fetchSpinner.succeed(
|
|
9155
|
-
`${available.length} installable skill${available.length > 1 ? "s" : ""}` + (unavailableCount > 0 ?
|
|
9153
|
+
`${available.length} installable skill${available.length > 1 ? "s" : ""}` + (unavailableCount > 0 ? chalk5.dim(` (${unavailableCount} unavailable)`) : "")
|
|
9156
9154
|
);
|
|
9157
9155
|
const selected = await interactiveSelect(available);
|
|
9158
9156
|
if (selected?.length) {
|
|
@@ -9175,34 +9173,34 @@ async function interactiveSelect(recs) {
|
|
|
9175
9173
|
const nameWidth = Math.max(...recs.map((r) => r.name.length), 4) + 2;
|
|
9176
9174
|
const prefixWidth = 8;
|
|
9177
9175
|
const scoreWidth = 6;
|
|
9178
|
-
lines.push(
|
|
9176
|
+
lines.push(chalk5.bold(" Skills"));
|
|
9179
9177
|
lines.push("");
|
|
9180
9178
|
if (hasScores) {
|
|
9181
|
-
const header = " ".repeat(prefixWidth) +
|
|
9179
|
+
const header = " ".repeat(prefixWidth) + chalk5.dim("Score".padEnd(scoreWidth)) + chalk5.dim("Name".padEnd(nameWidth)) + chalk5.dim("Why");
|
|
9182
9180
|
lines.push(header);
|
|
9183
9181
|
} else {
|
|
9184
|
-
const header = " ".repeat(prefixWidth) +
|
|
9182
|
+
const header = " ".repeat(prefixWidth) + chalk5.dim("Name".padEnd(nameWidth)) + chalk5.dim("Technology".padEnd(18)) + chalk5.dim("Source");
|
|
9185
9183
|
lines.push(header);
|
|
9186
9184
|
}
|
|
9187
|
-
lines.push(
|
|
9185
|
+
lines.push(chalk5.dim(" " + "\u2500".repeat(Math.min(cols - 4, 90))));
|
|
9188
9186
|
for (let i = 0; i < recs.length; i++) {
|
|
9189
9187
|
const rec = recs[i];
|
|
9190
|
-
const check = selected.has(i) ?
|
|
9191
|
-
const ptr = i === cursor ?
|
|
9188
|
+
const check = selected.has(i) ? chalk5.green("[x]") : "[ ]";
|
|
9189
|
+
const ptr = i === cursor ? chalk5.cyan(">") : " ";
|
|
9192
9190
|
if (hasScores) {
|
|
9193
|
-
const scoreColor = rec.score >= 90 ?
|
|
9191
|
+
const scoreColor = rec.score >= 90 ? chalk5.green : rec.score >= 70 ? chalk5.yellow : chalk5.dim;
|
|
9194
9192
|
const reasonMax = Math.max(cols - prefixWidth - scoreWidth - nameWidth - 2, 20);
|
|
9195
9193
|
lines.push(
|
|
9196
|
-
` ${ptr} ${check} ${scoreColor(String(rec.score).padStart(3))} ${rec.name.padEnd(nameWidth)}${
|
|
9194
|
+
` ${ptr} ${check} ${scoreColor(String(rec.score).padStart(3))} ${rec.name.padEnd(nameWidth)}${chalk5.dim(rec.reason.slice(0, reasonMax))}`
|
|
9197
9195
|
);
|
|
9198
9196
|
} else {
|
|
9199
9197
|
lines.push(
|
|
9200
|
-
` ${ptr} ${check} ${rec.name.padEnd(nameWidth)}${rec.detected_technology.padEnd(16)} ${
|
|
9198
|
+
` ${ptr} ${check} ${rec.name.padEnd(nameWidth)}${rec.detected_technology.padEnd(16)} ${chalk5.dim(rec.source_url || "")}`
|
|
9201
9199
|
);
|
|
9202
9200
|
}
|
|
9203
9201
|
}
|
|
9204
9202
|
lines.push("");
|
|
9205
|
-
lines.push(
|
|
9203
|
+
lines.push(chalk5.dim(" \u2191\u2193 navigate \u23B5 toggle a all n none \u23CE install q cancel"));
|
|
9206
9204
|
return lines.join("\n");
|
|
9207
9205
|
}
|
|
9208
9206
|
function draw(initial) {
|
|
@@ -9251,7 +9249,7 @@ async function interactiveSelect(recs) {
|
|
|
9251
9249
|
case "\n":
|
|
9252
9250
|
cleanup();
|
|
9253
9251
|
if (selected.size === 0) {
|
|
9254
|
-
console.log(
|
|
9252
|
+
console.log(chalk5.dim("\n No skills selected.\n"));
|
|
9255
9253
|
resolve3(null);
|
|
9256
9254
|
} else {
|
|
9257
9255
|
resolve3(
|
|
@@ -9263,7 +9261,7 @@ async function interactiveSelect(recs) {
|
|
|
9263
9261
|
case "\x1B":
|
|
9264
9262
|
case "":
|
|
9265
9263
|
cleanup();
|
|
9266
|
-
console.log(
|
|
9264
|
+
console.log(chalk5.dim("\n Cancelled.\n"));
|
|
9267
9265
|
resolve3(null);
|
|
9268
9266
|
break;
|
|
9269
9267
|
}
|
|
@@ -9310,7 +9308,7 @@ async function installSkills(recs, platforms, contentMap) {
|
|
|
9310
9308
|
trackSkillsInstalled(installed.length);
|
|
9311
9309
|
spinner.succeed(`Installed ${installed.length} file${installed.length > 1 ? "s" : ""}`);
|
|
9312
9310
|
for (const p of installed) {
|
|
9313
|
-
console.log(
|
|
9311
|
+
console.log(chalk5.green(` \u2713 ${p}`));
|
|
9314
9312
|
}
|
|
9315
9313
|
} else {
|
|
9316
9314
|
spinner.fail("No skills were installed");
|
|
@@ -9323,26 +9321,26 @@ function printSkills(recs) {
|
|
|
9323
9321
|
const nameWidth = Math.max(...recs.map((r) => r.name.length), 4) + 2;
|
|
9324
9322
|
const scoreWidth = 6;
|
|
9325
9323
|
const prefixWidth = 2;
|
|
9326
|
-
console.log(
|
|
9324
|
+
console.log(chalk5.bold("\n Skills\n"));
|
|
9327
9325
|
if (hasScores) {
|
|
9328
9326
|
console.log(
|
|
9329
|
-
" ".repeat(prefixWidth) +
|
|
9327
|
+
" ".repeat(prefixWidth) + chalk5.dim("Score".padEnd(scoreWidth)) + chalk5.dim("Name".padEnd(nameWidth)) + chalk5.dim("Why")
|
|
9330
9328
|
);
|
|
9331
9329
|
} else {
|
|
9332
9330
|
console.log(
|
|
9333
|
-
" ".repeat(prefixWidth) +
|
|
9331
|
+
" ".repeat(prefixWidth) + chalk5.dim("Name".padEnd(nameWidth)) + chalk5.dim("Technology".padEnd(18)) + chalk5.dim("Source")
|
|
9334
9332
|
);
|
|
9335
9333
|
}
|
|
9336
|
-
console.log(
|
|
9334
|
+
console.log(chalk5.dim(" " + "\u2500".repeat(Math.min(cols - 4, 90))));
|
|
9337
9335
|
for (const rec of recs) {
|
|
9338
9336
|
if (hasScores) {
|
|
9339
9337
|
const reasonMax = Math.max(cols - prefixWidth - scoreWidth - nameWidth - 2, 20);
|
|
9340
9338
|
console.log(
|
|
9341
|
-
` ${String(rec.score).padStart(3)} ${rec.name.padEnd(nameWidth)}${
|
|
9339
|
+
` ${String(rec.score).padStart(3)} ${rec.name.padEnd(nameWidth)}${chalk5.dim(rec.reason.slice(0, reasonMax))}`
|
|
9342
9340
|
);
|
|
9343
9341
|
} else {
|
|
9344
9342
|
console.log(
|
|
9345
|
-
` ${rec.name.padEnd(nameWidth)}${rec.detected_technology.padEnd(16)} ${
|
|
9343
|
+
` ${rec.name.padEnd(nameWidth)}${rec.detected_technology.padEnd(16)} ${chalk5.dim(rec.source_url || "")}`
|
|
9346
9344
|
);
|
|
9347
9345
|
}
|
|
9348
9346
|
}
|
|
@@ -9822,10 +9820,10 @@ function formatMs(ms) {
|
|
|
9822
9820
|
}
|
|
9823
9821
|
|
|
9824
9822
|
// src/utils/parallel-tasks.ts
|
|
9825
|
-
import
|
|
9823
|
+
import chalk7 from "chalk";
|
|
9826
9824
|
|
|
9827
9825
|
// src/utils/waiting-content.ts
|
|
9828
|
-
import
|
|
9826
|
+
import chalk6 from "chalk";
|
|
9829
9827
|
|
|
9830
9828
|
// src/utils/waiting-cards.json
|
|
9831
9829
|
var waiting_cards_default = [
|
|
@@ -9913,8 +9911,8 @@ var waiting_cards_default = [
|
|
|
9913
9911
|
];
|
|
9914
9912
|
|
|
9915
9913
|
// src/utils/waiting-content.ts
|
|
9916
|
-
var ACCENT =
|
|
9917
|
-
var BRAND =
|
|
9914
|
+
var ACCENT = chalk6.hex("#83D1EB");
|
|
9915
|
+
var BRAND = chalk6.hex("#EB9D83");
|
|
9918
9916
|
var WAITING_CARDS = waiting_cards_default;
|
|
9919
9917
|
function highlightCommands(text) {
|
|
9920
9918
|
return text.replace(/`([^`]+)`/g, (_, cmd) => ACCENT(cmd));
|
|
@@ -9923,20 +9921,20 @@ function renderCard(card, index, total, cols) {
|
|
|
9923
9921
|
const prefix = " ";
|
|
9924
9922
|
const maxWidth = Math.min(cols - 8, 65);
|
|
9925
9923
|
const lines = [];
|
|
9926
|
-
lines.push(
|
|
9924
|
+
lines.push(chalk6.dim(`${prefix}${"\u2500".repeat(maxWidth)}`));
|
|
9927
9925
|
lines.push("");
|
|
9928
9926
|
const dots = Array.from(
|
|
9929
9927
|
{ length: total },
|
|
9930
|
-
(_, i) => i === index ? ACCENT("\u25CF") :
|
|
9928
|
+
(_, i) => i === index ? ACCENT("\u25CF") : chalk6.dim("\u25CB")
|
|
9931
9929
|
).join(" ");
|
|
9932
|
-
lines.push(`${prefix}${
|
|
9930
|
+
lines.push(`${prefix}${chalk6.dim("While you wait...")} ${dots}`);
|
|
9933
9931
|
lines.push("");
|
|
9934
|
-
lines.push(`${prefix}${BRAND(card.icon)} ${
|
|
9932
|
+
lines.push(`${prefix}${BRAND(card.icon)} ${chalk6.bold(card.title)}`);
|
|
9935
9933
|
for (const line of card.lines) {
|
|
9936
|
-
lines.push(`${prefix} ${
|
|
9934
|
+
lines.push(`${prefix} ${chalk6.dim(highlightCommands(line))}`);
|
|
9937
9935
|
}
|
|
9938
9936
|
lines.push("");
|
|
9939
|
-
lines.push(`${prefix}${
|
|
9937
|
+
lines.push(`${prefix}${chalk6.dim("\u2190 \u2192 navigate auto-advances every 15s")}`);
|
|
9940
9938
|
return lines;
|
|
9941
9939
|
}
|
|
9942
9940
|
|
|
@@ -10087,15 +10085,15 @@ var ParallelTaskDisplay = class {
|
|
|
10087
10085
|
statusIcon(task) {
|
|
10088
10086
|
switch (task.status) {
|
|
10089
10087
|
case "pending":
|
|
10090
|
-
return { char: "\u25CB", styled:
|
|
10088
|
+
return { char: "\u25CB", styled: chalk7.dim("\u25CB") };
|
|
10091
10089
|
case "running": {
|
|
10092
10090
|
const frame = SPINNER_FRAMES[this.spinnerFrame];
|
|
10093
|
-
return { char: frame, styled:
|
|
10091
|
+
return { char: frame, styled: chalk7.cyan(frame) };
|
|
10094
10092
|
}
|
|
10095
10093
|
case "done":
|
|
10096
|
-
return { char: "\u2713", styled:
|
|
10094
|
+
return { char: "\u2713", styled: chalk7.green("\u2713") };
|
|
10097
10095
|
case "failed":
|
|
10098
|
-
return { char: "\u2717", styled:
|
|
10096
|
+
return { char: "\u2717", styled: chalk7.red("\u2717") };
|
|
10099
10097
|
}
|
|
10100
10098
|
}
|
|
10101
10099
|
renderPipelineHeader() {
|
|
@@ -10103,14 +10101,14 @@ var ParallelTaskDisplay = class {
|
|
|
10103
10101
|
const branchTasks = this.tasks.filter((t) => t.pipelineLabel && t.pipelineRow === 1);
|
|
10104
10102
|
if (mainTasks.length === 0) return [];
|
|
10105
10103
|
const arrow = " \u2192 ";
|
|
10106
|
-
const styledArrow =
|
|
10104
|
+
const styledArrow = chalk7.dim(arrow);
|
|
10107
10105
|
const renderNode = (t) => {
|
|
10108
10106
|
const { char, styled: icon } = this.statusIcon(t);
|
|
10109
10107
|
const label = t.pipelineLabel;
|
|
10110
|
-
const styledLabel = t.status === "pending" ?
|
|
10108
|
+
const styledLabel = t.status === "pending" ? chalk7.dim(label) : label;
|
|
10111
10109
|
return {
|
|
10112
10110
|
plain: `[${char} ${label}]`,
|
|
10113
|
-
styled:
|
|
10111
|
+
styled: chalk7.dim("[") + icon + " " + styledLabel + chalk7.dim("]")
|
|
10114
10112
|
};
|
|
10115
10113
|
};
|
|
10116
10114
|
const mainNodes = mainTasks.map(renderNode);
|
|
@@ -10120,7 +10118,7 @@ var ParallelTaskDisplay = class {
|
|
|
10120
10118
|
const firstNodePlainWidth = mainNodes[0].plain.length;
|
|
10121
10119
|
const indent = " ".repeat(PREFIX.length + firstNodePlainWidth + arrow.length);
|
|
10122
10120
|
const branchNodes = branchTasks.map(renderNode);
|
|
10123
|
-
const branchLine = indent +
|
|
10121
|
+
const branchLine = indent + chalk7.dim("\u2198 ") + branchNodes.map((n) => n.styled).join(styledArrow) + chalk7.dim(" \u2197");
|
|
10124
10122
|
lines.push(branchLine);
|
|
10125
10123
|
}
|
|
10126
10124
|
return lines;
|
|
@@ -10147,16 +10145,16 @@ var ParallelTaskDisplay = class {
|
|
|
10147
10145
|
renderLine(task, index) {
|
|
10148
10146
|
const cols = process.stdout.columns || 80;
|
|
10149
10147
|
const elapsed = task.startTime ? this.formatTime((task.endTime ?? Date.now()) - task.startTime) : "";
|
|
10150
|
-
const timeStr = elapsed ? ` ${
|
|
10148
|
+
const timeStr = elapsed ? ` ${chalk7.dim(elapsed)}` : "";
|
|
10151
10149
|
const timePlain = elapsed ? ` ${elapsed}` : "";
|
|
10152
10150
|
const { styled: icon } = this.statusIcon(task);
|
|
10153
|
-
const nameStyle = task.status === "pending" ?
|
|
10154
|
-
const msgStyle = task.status === "failed" ?
|
|
10151
|
+
const nameStyle = task.status === "pending" ? chalk7.dim : chalk7.white;
|
|
10152
|
+
const msgStyle = task.status === "failed" ? chalk7.red : chalk7.dim;
|
|
10155
10153
|
if (!this.cachedConnectors) {
|
|
10156
10154
|
this.cachedConnectors = this.tasks.map((_, i) => this.getTreeConnector(i));
|
|
10157
10155
|
}
|
|
10158
10156
|
const connector = this.cachedConnectors[index];
|
|
10159
|
-
const connectorStyled = connector ?
|
|
10157
|
+
const connectorStyled = connector ? chalk7.dim(connector) : "";
|
|
10160
10158
|
const paddedName = task.name.padEnd(Math.max(0, NAME_COL_WIDTH - connector.length));
|
|
10161
10159
|
const usedByFixed = PREFIX.length + connector.length + 2 + NAME_COL_WIDTH + timePlain.length;
|
|
10162
10160
|
const msgMax = Math.max(cols - usedByFixed - 2, 10);
|
|
@@ -10175,7 +10173,7 @@ var ParallelTaskDisplay = class {
|
|
|
10175
10173
|
if (pipelineHeader.length > 0) {
|
|
10176
10174
|
lines.push(...pipelineHeader);
|
|
10177
10175
|
const cols = stdout.columns || 80;
|
|
10178
|
-
lines.push(PREFIX +
|
|
10176
|
+
lines.push(PREFIX + chalk7.dim("\u2500".repeat(Math.min(cols - PREFIX.length * 2, 55))));
|
|
10179
10177
|
}
|
|
10180
10178
|
lines.push(...taskLines);
|
|
10181
10179
|
const PREVIEW_STALE_MS = 3e3;
|
|
@@ -10184,7 +10182,7 @@ var ParallelTaskDisplay = class {
|
|
|
10184
10182
|
const cols = stdout.columns || 80;
|
|
10185
10183
|
const maxHeight = Math.min(Math.floor((stdout.rows || 24) / 3), 10);
|
|
10186
10184
|
const visibleLines = this.previewLines.slice(-maxHeight);
|
|
10187
|
-
lines.push(PREFIX +
|
|
10185
|
+
lines.push(PREFIX + chalk7.dim("\u2500".repeat(Math.min(cols - PREFIX.length * 2, 55))));
|
|
10188
10186
|
for (const line of visibleLines) {
|
|
10189
10187
|
lines.push(PREFIX + line.slice(0, cols - PREFIX.length));
|
|
10190
10188
|
}
|
|
@@ -10206,7 +10204,7 @@ var ParallelTaskDisplay = class {
|
|
|
10206
10204
|
};
|
|
10207
10205
|
|
|
10208
10206
|
// src/commands/init-prompts.ts
|
|
10209
|
-
import
|
|
10207
|
+
import chalk10 from "chalk";
|
|
10210
10208
|
import ora3 from "ora";
|
|
10211
10209
|
import select5 from "@inquirer/select";
|
|
10212
10210
|
import checkbox from "@inquirer/checkbox";
|
|
@@ -10295,7 +10293,7 @@ Return the complete updated AgentSetup JSON incorporating the user's changes. Re
|
|
|
10295
10293
|
}
|
|
10296
10294
|
|
|
10297
10295
|
// src/utils/spinner-messages.ts
|
|
10298
|
-
import
|
|
10296
|
+
import chalk8 from "chalk";
|
|
10299
10297
|
var GENERATION_MESSAGES = [
|
|
10300
10298
|
"Analyzing your project structure and dependencies...",
|
|
10301
10299
|
"Mapping out build commands and test workflows...",
|
|
@@ -10345,9 +10343,9 @@ var SpinnerMessages = class {
|
|
|
10345
10343
|
this.currentBaseMessage = this.messages[0];
|
|
10346
10344
|
this.updateSpinnerText();
|
|
10347
10345
|
if (this.showElapsedTime) {
|
|
10348
|
-
this.spinner.suffixText =
|
|
10346
|
+
this.spinner.suffixText = chalk8.dim(`(${this.formatElapsed()})`);
|
|
10349
10347
|
this.elapsedTimer = setInterval(() => {
|
|
10350
|
-
this.spinner.suffixText =
|
|
10348
|
+
this.spinner.suffixText = chalk8.dim(`(${this.formatElapsed()})`);
|
|
10351
10349
|
}, 1e3);
|
|
10352
10350
|
}
|
|
10353
10351
|
this.timer = setInterval(() => {
|
|
@@ -10465,9 +10463,9 @@ async function refineLoop(currentSetup, sessionHistory, summarizeSetup2, printSu
|
|
|
10465
10463
|
}
|
|
10466
10464
|
const isValid = await classifyRefineIntent(message);
|
|
10467
10465
|
if (!isValid) {
|
|
10468
|
-
console.log(
|
|
10469
|
-
console.log(
|
|
10470
|
-
console.log(
|
|
10466
|
+
console.log(chalk10.dim(" This doesn't look like a config change request."));
|
|
10467
|
+
console.log(chalk10.dim(" Describe what to add, remove, or modify in your configs."));
|
|
10468
|
+
console.log(chalk10.dim(' Type "done" to accept the current config.\n'));
|
|
10471
10469
|
continue;
|
|
10472
10470
|
}
|
|
10473
10471
|
const refineSpinner = ora3("Refining config...").start();
|
|
@@ -10484,16 +10482,16 @@ async function refineLoop(currentSetup, sessionHistory, summarizeSetup2, printSu
|
|
|
10484
10482
|
});
|
|
10485
10483
|
refineSpinner.succeed("Config updated");
|
|
10486
10484
|
printSummary(refined);
|
|
10487
|
-
console.log(
|
|
10485
|
+
console.log(chalk10.dim('Type "done" to accept, or describe more changes.'));
|
|
10488
10486
|
} else {
|
|
10489
10487
|
refineSpinner.fail("Refinement failed \u2014 could not parse AI response.");
|
|
10490
|
-
console.log(
|
|
10488
|
+
console.log(chalk10.dim('Try rephrasing your request, or type "done" to keep the current config.'));
|
|
10491
10489
|
}
|
|
10492
10490
|
}
|
|
10493
10491
|
}
|
|
10494
10492
|
|
|
10495
10493
|
// src/commands/init-display.ts
|
|
10496
|
-
import
|
|
10494
|
+
import chalk11 from "chalk";
|
|
10497
10495
|
import fs32 from "fs";
|
|
10498
10496
|
init_types();
|
|
10499
10497
|
function formatWhatChanged(setup) {
|
|
@@ -10545,26 +10543,26 @@ function printSetupSummary(setup) {
|
|
|
10545
10543
|
const fileDescriptions = setup.fileDescriptions;
|
|
10546
10544
|
const deletions = setup.deletions;
|
|
10547
10545
|
console.log("");
|
|
10548
|
-
console.log(
|
|
10546
|
+
console.log(chalk11.bold(" Your tailored config:\n"));
|
|
10549
10547
|
const getDescription = (filePath) => {
|
|
10550
10548
|
return fileDescriptions?.[filePath];
|
|
10551
10549
|
};
|
|
10552
10550
|
if (claude) {
|
|
10553
10551
|
if (claude.claudeMd) {
|
|
10554
|
-
const icon = fs32.existsSync("CLAUDE.md") ?
|
|
10552
|
+
const icon = fs32.existsSync("CLAUDE.md") ? chalk11.yellow("~") : chalk11.green("+");
|
|
10555
10553
|
const desc = getDescription("CLAUDE.md");
|
|
10556
|
-
console.log(` ${icon} ${
|
|
10557
|
-
if (desc) console.log(
|
|
10554
|
+
console.log(` ${icon} ${chalk11.bold("CLAUDE.md")}`);
|
|
10555
|
+
if (desc) console.log(chalk11.dim(` ${desc}`));
|
|
10558
10556
|
console.log("");
|
|
10559
10557
|
}
|
|
10560
10558
|
const skills = claude.skills;
|
|
10561
10559
|
if (Array.isArray(skills) && skills.length > 0) {
|
|
10562
10560
|
for (const skill of skills) {
|
|
10563
10561
|
const skillPath = `.claude/skills/${skill.name}/SKILL.md`;
|
|
10564
|
-
const icon = fs32.existsSync(skillPath) ?
|
|
10562
|
+
const icon = fs32.existsSync(skillPath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
10565
10563
|
const desc = getDescription(skillPath);
|
|
10566
|
-
console.log(` ${icon} ${
|
|
10567
|
-
console.log(
|
|
10564
|
+
console.log(` ${icon} ${chalk11.bold(skillPath)}`);
|
|
10565
|
+
console.log(chalk11.dim(` ${desc || skill.description || skill.name}`));
|
|
10568
10566
|
console.log("");
|
|
10569
10567
|
}
|
|
10570
10568
|
}
|
|
@@ -10572,20 +10570,20 @@ function printSetupSummary(setup) {
|
|
|
10572
10570
|
const codex = setup.codex;
|
|
10573
10571
|
if (codex) {
|
|
10574
10572
|
if (codex.agentsMd) {
|
|
10575
|
-
const icon = fs32.existsSync("AGENTS.md") ?
|
|
10573
|
+
const icon = fs32.existsSync("AGENTS.md") ? chalk11.yellow("~") : chalk11.green("+");
|
|
10576
10574
|
const desc = getDescription("AGENTS.md");
|
|
10577
|
-
console.log(` ${icon} ${
|
|
10578
|
-
if (desc) console.log(
|
|
10575
|
+
console.log(` ${icon} ${chalk11.bold("AGENTS.md")}`);
|
|
10576
|
+
if (desc) console.log(chalk11.dim(` ${desc}`));
|
|
10579
10577
|
console.log("");
|
|
10580
10578
|
}
|
|
10581
10579
|
const codexSkills = codex.skills;
|
|
10582
10580
|
if (Array.isArray(codexSkills) && codexSkills.length > 0) {
|
|
10583
10581
|
for (const skill of codexSkills) {
|
|
10584
10582
|
const skillPath = `.agents/skills/${skill.name}/SKILL.md`;
|
|
10585
|
-
const icon = fs32.existsSync(skillPath) ?
|
|
10583
|
+
const icon = fs32.existsSync(skillPath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
10586
10584
|
const desc = getDescription(skillPath);
|
|
10587
|
-
console.log(` ${icon} ${
|
|
10588
|
-
console.log(
|
|
10585
|
+
console.log(` ${icon} ${chalk11.bold(skillPath)}`);
|
|
10586
|
+
console.log(chalk11.dim(` ${desc || skill.description || skill.name}`));
|
|
10589
10587
|
console.log("");
|
|
10590
10588
|
}
|
|
10591
10589
|
}
|
|
@@ -10593,40 +10591,40 @@ function printSetupSummary(setup) {
|
|
|
10593
10591
|
const opencode = setup.opencode;
|
|
10594
10592
|
if (opencode) {
|
|
10595
10593
|
if (opencode.agentsMd && !codex?.agentsMd) {
|
|
10596
|
-
const icon = fs32.existsSync("AGENTS.md") ?
|
|
10594
|
+
const icon = fs32.existsSync("AGENTS.md") ? chalk11.yellow("~") : chalk11.green("+");
|
|
10597
10595
|
const desc = getDescription("AGENTS.md");
|
|
10598
|
-
console.log(` ${icon} ${
|
|
10599
|
-
if (desc) console.log(
|
|
10596
|
+
console.log(` ${icon} ${chalk11.bold("AGENTS.md")} ${chalk11.dim("(OpenCode)")}`);
|
|
10597
|
+
if (desc) console.log(chalk11.dim(` ${desc}`));
|
|
10600
10598
|
console.log("");
|
|
10601
10599
|
}
|
|
10602
10600
|
const opencodeSkills = opencode.skills;
|
|
10603
10601
|
if (Array.isArray(opencodeSkills) && opencodeSkills.length > 0) {
|
|
10604
10602
|
for (const skill of opencodeSkills) {
|
|
10605
10603
|
const skillPath = `.opencode/skills/${skill.name}/SKILL.md`;
|
|
10606
|
-
const icon = fs32.existsSync(skillPath) ?
|
|
10604
|
+
const icon = fs32.existsSync(skillPath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
10607
10605
|
const desc = getDescription(skillPath);
|
|
10608
|
-
console.log(` ${icon} ${
|
|
10609
|
-
console.log(
|
|
10606
|
+
console.log(` ${icon} ${chalk11.bold(skillPath)}`);
|
|
10607
|
+
console.log(chalk11.dim(` ${desc || skill.description || skill.name}`));
|
|
10610
10608
|
console.log("");
|
|
10611
10609
|
}
|
|
10612
10610
|
}
|
|
10613
10611
|
}
|
|
10614
10612
|
if (cursor) {
|
|
10615
10613
|
if (cursor.cursorrules) {
|
|
10616
|
-
const icon = fs32.existsSync(".cursorrules") ?
|
|
10614
|
+
const icon = fs32.existsSync(".cursorrules") ? chalk11.yellow("~") : chalk11.green("+");
|
|
10617
10615
|
const desc = getDescription(".cursorrules");
|
|
10618
|
-
console.log(` ${icon} ${
|
|
10619
|
-
if (desc) console.log(
|
|
10616
|
+
console.log(` ${icon} ${chalk11.bold(".cursorrules")}`);
|
|
10617
|
+
if (desc) console.log(chalk11.dim(` ${desc}`));
|
|
10620
10618
|
console.log("");
|
|
10621
10619
|
}
|
|
10622
10620
|
const cursorSkills = cursor.skills;
|
|
10623
10621
|
if (Array.isArray(cursorSkills) && cursorSkills.length > 0) {
|
|
10624
10622
|
for (const skill of cursorSkills) {
|
|
10625
10623
|
const skillPath = `.cursor/skills/${skill.name}/SKILL.md`;
|
|
10626
|
-
const icon = fs32.existsSync(skillPath) ?
|
|
10624
|
+
const icon = fs32.existsSync(skillPath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
10627
10625
|
const desc = getDescription(skillPath);
|
|
10628
|
-
console.log(` ${icon} ${
|
|
10629
|
-
console.log(
|
|
10626
|
+
console.log(` ${icon} ${chalk11.bold(skillPath)}`);
|
|
10627
|
+
console.log(chalk11.dim(` ${desc || skill.description || skill.name}`));
|
|
10630
10628
|
console.log("");
|
|
10631
10629
|
}
|
|
10632
10630
|
}
|
|
@@ -10634,14 +10632,14 @@ function printSetupSummary(setup) {
|
|
|
10634
10632
|
if (Array.isArray(rulesArr) && rulesArr.length > 0) {
|
|
10635
10633
|
for (const rule of rulesArr) {
|
|
10636
10634
|
const rulePath = `.cursor/rules/${rule.filename}`;
|
|
10637
|
-
const icon = fs32.existsSync(rulePath) ?
|
|
10635
|
+
const icon = fs32.existsSync(rulePath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
10638
10636
|
const desc = getDescription(rulePath);
|
|
10639
|
-
console.log(` ${icon} ${
|
|
10637
|
+
console.log(` ${icon} ${chalk11.bold(rulePath)}`);
|
|
10640
10638
|
if (desc) {
|
|
10641
|
-
console.log(
|
|
10639
|
+
console.log(chalk11.dim(` ${desc}`));
|
|
10642
10640
|
} else {
|
|
10643
10641
|
const firstLine = rule.content.split("\n").filter((l) => l.trim() && !l.trim().startsWith("#"))[0];
|
|
10644
|
-
if (firstLine) console.log(
|
|
10642
|
+
if (firstLine) console.log(chalk11.dim(` ${firstLine.trim().slice(0, 80)}`));
|
|
10645
10643
|
}
|
|
10646
10644
|
console.log("");
|
|
10647
10645
|
}
|
|
@@ -10649,53 +10647,53 @@ function printSetupSummary(setup) {
|
|
|
10649
10647
|
}
|
|
10650
10648
|
if (Array.isArray(deletions) && deletions.length > 0) {
|
|
10651
10649
|
for (const del of deletions) {
|
|
10652
|
-
console.log(` ${
|
|
10653
|
-
console.log(
|
|
10650
|
+
console.log(` ${chalk11.red("-")} ${chalk11.bold(del.filePath)}`);
|
|
10651
|
+
console.log(chalk11.dim(` ${del.reason}`));
|
|
10654
10652
|
console.log("");
|
|
10655
10653
|
}
|
|
10656
10654
|
}
|
|
10657
10655
|
console.log(
|
|
10658
|
-
` ${
|
|
10656
|
+
` ${chalk11.green("+")} ${chalk11.dim("new")} ${chalk11.yellow("~")} ${chalk11.dim("modified")} ${chalk11.red("-")} ${chalk11.dim("removed")}`
|
|
10659
10657
|
);
|
|
10660
10658
|
console.log("");
|
|
10661
10659
|
}
|
|
10662
10660
|
function displayTokenUsage() {
|
|
10663
10661
|
const summary = getUsageSummary();
|
|
10664
10662
|
if (summary.length === 0) {
|
|
10665
|
-
console.log(
|
|
10663
|
+
console.log(chalk11.dim(" Token tracking not available for this provider.\n"));
|
|
10666
10664
|
return;
|
|
10667
10665
|
}
|
|
10668
10666
|
const config = loadConfig();
|
|
10669
10667
|
const isEstimated = config != null && isSeatBased(config.provider);
|
|
10670
10668
|
const label = isEstimated ? "Estimated token usage:" : "Token usage:";
|
|
10671
|
-
console.log(
|
|
10669
|
+
console.log(chalk11.bold(` ${label}
|
|
10672
10670
|
`));
|
|
10673
10671
|
let totalIn = 0;
|
|
10674
10672
|
let totalOut = 0;
|
|
10675
10673
|
for (const m of summary) {
|
|
10676
10674
|
totalIn += m.inputTokens;
|
|
10677
10675
|
totalOut += m.outputTokens;
|
|
10678
|
-
const cacheInfo = m.cacheReadTokens > 0 || m.cacheWriteTokens > 0 ?
|
|
10676
|
+
const cacheInfo = m.cacheReadTokens > 0 || m.cacheWriteTokens > 0 ? chalk11.dim(
|
|
10679
10677
|
` (cache: ${m.cacheReadTokens.toLocaleString()} read, ${m.cacheWriteTokens.toLocaleString()} write)`
|
|
10680
10678
|
) : "";
|
|
10681
10679
|
console.log(
|
|
10682
|
-
` ${
|
|
10680
|
+
` ${chalk11.dim(m.model)}: ${m.inputTokens.toLocaleString()} in / ${m.outputTokens.toLocaleString()} out (${m.calls} call${m.calls === 1 ? "" : "s"})${cacheInfo}`
|
|
10683
10681
|
);
|
|
10684
10682
|
}
|
|
10685
10683
|
if (summary.length > 1) {
|
|
10686
10684
|
console.log(
|
|
10687
|
-
` ${
|
|
10685
|
+
` ${chalk11.dim("Total")}: ${totalIn.toLocaleString()} in / ${totalOut.toLocaleString()} out`
|
|
10688
10686
|
);
|
|
10689
10687
|
}
|
|
10690
10688
|
if (isEstimated) {
|
|
10691
|
-
console.log(
|
|
10689
|
+
console.log(chalk11.dim(" (Estimated from character count)"));
|
|
10692
10690
|
}
|
|
10693
10691
|
console.log("");
|
|
10694
10692
|
}
|
|
10695
10693
|
|
|
10696
10694
|
// src/commands/init-helpers.ts
|
|
10697
10695
|
init_config();
|
|
10698
|
-
import
|
|
10696
|
+
import chalk12 from "chalk";
|
|
10699
10697
|
import fs33 from "fs";
|
|
10700
10698
|
import path26 from "path";
|
|
10701
10699
|
function isFirstRun(dir) {
|
|
@@ -10796,7 +10794,7 @@ function writeErrorLog(config, rawOutput, error, stopReason) {
|
|
|
10796
10794
|
}
|
|
10797
10795
|
fs33.mkdirSync(path26.join(process.cwd(), ".caliber"), { recursive: true });
|
|
10798
10796
|
fs33.writeFileSync(logPath, lines.join("\n"));
|
|
10799
|
-
console.log(
|
|
10797
|
+
console.log(chalk12.dim(`
|
|
10800
10798
|
Error log written to .caliber/error-log.md`));
|
|
10801
10799
|
} catch {
|
|
10802
10800
|
}
|
|
@@ -10912,11 +10910,11 @@ function getScoreTrend(entries) {
|
|
|
10912
10910
|
// src/commands/init.ts
|
|
10913
10911
|
var IS_WINDOWS6 = process.platform === "win32";
|
|
10914
10912
|
function log(verbose, ...args) {
|
|
10915
|
-
if (verbose) console.log(
|
|
10913
|
+
if (verbose) console.log(chalk13.dim(` [verbose] ${args.map(String).join(" ")}`));
|
|
10916
10914
|
}
|
|
10917
10915
|
async function initCommand(options) {
|
|
10918
|
-
const brand =
|
|
10919
|
-
const title =
|
|
10916
|
+
const brand = chalk13.hex("#EB9D83");
|
|
10917
|
+
const title = chalk13.hex("#83D1EB");
|
|
10920
10918
|
const bin = resolveCaliber();
|
|
10921
10919
|
const firstRun = isFirstRun(process.cwd());
|
|
10922
10920
|
if (firstRun) {
|
|
@@ -10930,23 +10928,23 @@ async function initCommand(options) {
|
|
|
10930
10928
|
\u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
|
|
10931
10929
|
`)
|
|
10932
10930
|
);
|
|
10933
|
-
console.log(
|
|
10934
|
-
console.log(
|
|
10931
|
+
console.log(chalk13.dim(" Keep your AI agent configs in sync \u2014 automatically."));
|
|
10932
|
+
console.log(chalk13.dim(" Works across Claude Code, Cursor, Codex, and GitHub Copilot.\n"));
|
|
10935
10933
|
console.log(title.bold(" How it works:\n"));
|
|
10936
|
-
console.log(
|
|
10937
|
-
console.log(
|
|
10938
|
-
console.log(
|
|
10939
|
-
console.log(
|
|
10934
|
+
console.log(chalk13.dim(" 1. Connect Link your LLM provider and select your agents"));
|
|
10935
|
+
console.log(chalk13.dim(" 2. Setup Detect stack, install sync hooks & skills"));
|
|
10936
|
+
console.log(chalk13.dim(" 3. Generate Audit existing config or generate from scratch"));
|
|
10937
|
+
console.log(chalk13.dim(" 4. Finalize Review changes and score your setup\n"));
|
|
10940
10938
|
} else {
|
|
10941
|
-
console.log(brand.bold("\n CALIBER") +
|
|
10939
|
+
console.log(brand.bold("\n CALIBER") + chalk13.dim(" \u2014 setting up continuous sync\n"));
|
|
10942
10940
|
}
|
|
10943
10941
|
const platforms = detectPlatforms();
|
|
10944
10942
|
if (!platforms.claude && !platforms.cursor && !platforms.codex && !platforms.opencode) {
|
|
10945
10943
|
console.log(
|
|
10946
|
-
|
|
10944
|
+
chalk13.yellow(" \u26A0 No supported AI platforms detected (Claude, Cursor, Codex, OpenCode).")
|
|
10947
10945
|
);
|
|
10948
10946
|
console.log(
|
|
10949
|
-
|
|
10947
|
+
chalk13.yellow(
|
|
10950
10948
|
" Caliber will still generate config files, but they won't be auto-installed.\n"
|
|
10951
10949
|
)
|
|
10952
10950
|
);
|
|
@@ -10956,7 +10954,7 @@ async function initCommand(options) {
|
|
|
10956
10954
|
let config = loadConfig();
|
|
10957
10955
|
if (!config && options.agent?.includes("opencode")) {
|
|
10958
10956
|
if (isOpenCodeAvailable()) {
|
|
10959
|
-
console.log(
|
|
10957
|
+
console.log(chalk13.dim(" Detected: OpenCode (uses your existing subscription)\n"));
|
|
10960
10958
|
const autoConfig = { provider: "opencode", model: DEFAULT_MODELS.opencode };
|
|
10961
10959
|
writeConfigFile(autoConfig);
|
|
10962
10960
|
config = autoConfig;
|
|
@@ -10964,7 +10962,7 @@ async function initCommand(options) {
|
|
|
10964
10962
|
}
|
|
10965
10963
|
if (!config && !options.autoApprove) {
|
|
10966
10964
|
if (isClaudeCliAvailable() && isClaudeCliLoggedIn()) {
|
|
10967
|
-
console.log(
|
|
10965
|
+
console.log(chalk13.dim(" Detected: Claude Code CLI (uses your Pro/Max/Team subscription)\n"));
|
|
10968
10966
|
const useIt = await confirm2({ message: "Use Claude Code as your LLM provider?" });
|
|
10969
10967
|
if (useIt) {
|
|
10970
10968
|
const autoConfig = { provider: "claude-cli", model: "default" };
|
|
@@ -10972,7 +10970,7 @@ async function initCommand(options) {
|
|
|
10972
10970
|
config = autoConfig;
|
|
10973
10971
|
}
|
|
10974
10972
|
} else if (isCursorAgentAvailable() && isCursorLoggedIn()) {
|
|
10975
|
-
console.log(
|
|
10973
|
+
console.log(chalk13.dim(" Detected: Cursor (uses your existing subscription)\n"));
|
|
10976
10974
|
const useIt = await confirm2({ message: "Use Cursor as your LLM provider?" });
|
|
10977
10975
|
if (useIt) {
|
|
10978
10976
|
const autoConfig = { provider: "cursor", model: "sonnet-4.6" };
|
|
@@ -10998,13 +10996,13 @@ async function initCommand(options) {
|
|
|
10998
10996
|
}
|
|
10999
10997
|
}
|
|
11000
10998
|
if (!config) {
|
|
11001
|
-
console.log(
|
|
10999
|
+
console.log(chalk13.dim(" No LLM provider detected.\n"));
|
|
11002
11000
|
await runInteractiveProviderSetup({
|
|
11003
11001
|
selectMessage: "How do you want to use Caliber? (choose LLM provider)"
|
|
11004
11002
|
});
|
|
11005
11003
|
config = loadConfig();
|
|
11006
11004
|
if (!config) {
|
|
11007
|
-
console.log(
|
|
11005
|
+
console.log(chalk13.red(" Configuration cancelled or failed.\n"));
|
|
11008
11006
|
throw new Error("__exit__");
|
|
11009
11007
|
}
|
|
11010
11008
|
}
|
|
@@ -11013,7 +11011,7 @@ async function initCommand(options) {
|
|
|
11013
11011
|
const displayModel = getDisplayModel(config);
|
|
11014
11012
|
const fastModel = getFastModel();
|
|
11015
11013
|
const modelLine = fastModel ? ` Provider: ${config.provider} | Model: ${displayModel} | Scan: ${fastModel}` : ` Provider: ${config.provider} | Model: ${displayModel}`;
|
|
11016
|
-
console.log(
|
|
11014
|
+
console.log(chalk13.dim(modelLine + "\n"));
|
|
11017
11015
|
if (report) {
|
|
11018
11016
|
report.markStep("Provider connection");
|
|
11019
11017
|
report.addSection(
|
|
@@ -11032,10 +11030,10 @@ async function initCommand(options) {
|
|
|
11032
11030
|
const detected = detectAgents(process.cwd());
|
|
11033
11031
|
if (detected.length > 0 && (options.autoApprove || firstRun)) {
|
|
11034
11032
|
targetAgent = detected;
|
|
11035
|
-
console.log(
|
|
11033
|
+
console.log(chalk13.dim(` Coding agents in this repo: ${detected.join(", ")}
|
|
11036
11034
|
`));
|
|
11037
11035
|
} else if (detected.length > 0) {
|
|
11038
|
-
console.log(
|
|
11036
|
+
console.log(chalk13.dim(` Coding agents in this repo: ${detected.join(", ")}
|
|
11039
11037
|
`));
|
|
11040
11038
|
const useDetected = await confirm2({ message: "Generate configs for these agents?" });
|
|
11041
11039
|
targetAgent = useDetected ? detected : await promptAgent();
|
|
@@ -11043,29 +11041,29 @@ async function initCommand(options) {
|
|
|
11043
11041
|
targetAgent = options.autoApprove ? ["claude"] : await promptAgent();
|
|
11044
11042
|
}
|
|
11045
11043
|
}
|
|
11046
|
-
console.log(
|
|
11044
|
+
console.log(chalk13.dim(` Target: ${targetAgent.join(", ")}
|
|
11047
11045
|
`));
|
|
11048
11046
|
trackInitAgentSelected(targetAgent, agentAutoDetected);
|
|
11049
11047
|
console.log(title.bold(" Step 2/4 \u2014 Setup\n"));
|
|
11050
|
-
console.log(
|
|
11048
|
+
console.log(chalk13.dim(" Installing sync infrastructure...\n"));
|
|
11051
11049
|
const hookResult = installPreCommitHook();
|
|
11052
11050
|
if (hookResult.installed) {
|
|
11053
|
-
console.log(` ${
|
|
11051
|
+
console.log(` ${chalk13.green("\u2713")} Pre-commit hook installed \u2014 configs sync on every commit`);
|
|
11054
11052
|
} else if (hookResult.alreadyInstalled) {
|
|
11055
|
-
console.log(` ${
|
|
11053
|
+
console.log(` ${chalk13.green("\u2713")} Pre-commit hook \u2014 active`);
|
|
11056
11054
|
}
|
|
11057
11055
|
installStopHook();
|
|
11058
|
-
console.log(` ${
|
|
11056
|
+
console.log(` ${chalk13.green("\u2713")} Onboarding hook \u2014 nudges new team members to set up`);
|
|
11059
11057
|
installSessionStartHook();
|
|
11060
|
-
console.log(` ${
|
|
11058
|
+
console.log(` ${chalk13.green("\u2713")} Freshness hook \u2014 warns when configs are stale`);
|
|
11061
11059
|
if (IS_WINDOWS6) {
|
|
11062
11060
|
console.log(
|
|
11063
|
-
|
|
11061
|
+
chalk13.yellow(
|
|
11064
11062
|
"\n Note: hooks use shell syntax and require Git Bash (included with Git for Windows)."
|
|
11065
11063
|
)
|
|
11066
11064
|
);
|
|
11067
11065
|
console.log(
|
|
11068
|
-
|
|
11066
|
+
chalk13.dim(
|
|
11069
11067
|
" If hooks don't run, ensure Git for Windows is installed and git is using its bundled sh."
|
|
11070
11068
|
)
|
|
11071
11069
|
);
|
|
@@ -11082,23 +11080,23 @@ async function initCommand(options) {
|
|
|
11082
11080
|
const skillsWritten = ensureBuiltinSkills2();
|
|
11083
11081
|
if (skillsWritten.length > 0) {
|
|
11084
11082
|
console.log(
|
|
11085
|
-
` ${
|
|
11083
|
+
` ${chalk13.green("\u2713")} Agent skills installed \u2014 /setup-caliber, /find-skills, /save-learning`
|
|
11086
11084
|
);
|
|
11087
11085
|
} else {
|
|
11088
|
-
console.log(` ${
|
|
11086
|
+
console.log(` ${chalk13.green("\u2713")} Agent skills \u2014 already installed`);
|
|
11089
11087
|
}
|
|
11090
11088
|
const hasLearnableAgent = targetAgent.includes("claude") || targetAgent.includes("cursor");
|
|
11091
11089
|
if (hasLearnableAgent) {
|
|
11092
11090
|
if (targetAgent.includes("claude")) installLearningHooks();
|
|
11093
11091
|
if (targetAgent.includes("cursor")) installCursorLearningHooks();
|
|
11094
|
-
console.log(` ${
|
|
11092
|
+
console.log(` ${chalk13.green("\u2713")} Session learning enabled`);
|
|
11095
11093
|
trackInitLearnEnabled(true);
|
|
11096
11094
|
}
|
|
11097
11095
|
console.log("");
|
|
11098
|
-
console.log(
|
|
11099
|
-
console.log(
|
|
11096
|
+
console.log(chalk13.dim(" New team members can run /setup-caliber inside their coding agent"));
|
|
11097
|
+
console.log(chalk13.dim(" (Claude Code or Cursor) to get set up automatically.\n"));
|
|
11100
11098
|
const baselineScore = computeLocalScore(process.cwd(), targetAgent);
|
|
11101
|
-
console.log(
|
|
11099
|
+
console.log(chalk13.dim(" Current config score:"));
|
|
11102
11100
|
displayScoreSummary(baselineScore);
|
|
11103
11101
|
if (options.verbose) {
|
|
11104
11102
|
for (const c of baselineScore.checks) {
|
|
@@ -11136,20 +11134,20 @@ async function initCommand(options) {
|
|
|
11136
11134
|
let skipGeneration = false;
|
|
11137
11135
|
if (hasExistingConfig && baselineScore.score === 100) {
|
|
11138
11136
|
trackInitScoreComputed(baselineScore.score, passingCount, failingCount, true);
|
|
11139
|
-
console.log(
|
|
11137
|
+
console.log(chalk13.bold.green("\n Your config is already optimal.\n"));
|
|
11140
11138
|
skipGeneration = !options.force;
|
|
11141
11139
|
} else if (hasExistingConfig && !options.force && !options.autoApprove) {
|
|
11142
11140
|
trackInitScoreComputed(baselineScore.score, passingCount, failingCount, false);
|
|
11143
11141
|
console.log(
|
|
11144
|
-
|
|
11142
|
+
chalk13.dim("\n Sync infrastructure is ready. Caliber can also audit your existing")
|
|
11145
11143
|
);
|
|
11146
|
-
console.log(
|
|
11144
|
+
console.log(chalk13.dim(" configs and improve them using AI.\n"));
|
|
11147
11145
|
const auditAnswer = await promptInput(" Audit and improve your existing config? (Y/n) ");
|
|
11148
11146
|
skipGeneration = auditAnswer.toLowerCase() === "n";
|
|
11149
11147
|
} else if (!hasExistingConfig && !options.force && !options.autoApprove) {
|
|
11150
11148
|
trackInitScoreComputed(baselineScore.score, passingCount, failingCount, false);
|
|
11151
|
-
console.log(
|
|
11152
|
-
console.log(
|
|
11149
|
+
console.log(chalk13.dim("\n Sync infrastructure is ready. Caliber can also generate tailored"));
|
|
11150
|
+
console.log(chalk13.dim(" CLAUDE.md, Cursor rules, and Codex configs for your project.\n"));
|
|
11153
11151
|
const generateAnswer = await promptInput(" Generate agent configs? (Y/n) ");
|
|
11154
11152
|
skipGeneration = generateAnswer.toLowerCase() === "n";
|
|
11155
11153
|
} else {
|
|
@@ -11176,7 +11174,7 @@ async function initCommand(options) {
|
|
|
11176
11174
|
const updatedClaude = appendManagedBlocks2(claudeContent, "claude");
|
|
11177
11175
|
if (updatedClaude !== claudeContent || !fs35.existsSync(claudeMdPath)) {
|
|
11178
11176
|
fs35.writeFileSync(claudeMdPath, updatedClaude);
|
|
11179
|
-
console.log(` ${
|
|
11177
|
+
console.log(` ${chalk13.green("\u2713")} CLAUDE.md \u2014 added Caliber sync instructions`);
|
|
11180
11178
|
}
|
|
11181
11179
|
if (targetAgent.includes("cursor")) {
|
|
11182
11180
|
const rulesDir = path28.join(".cursor", "rules");
|
|
@@ -11189,7 +11187,7 @@ async function initCommand(options) {
|
|
|
11189
11187
|
]) {
|
|
11190
11188
|
fs35.writeFileSync(path28.join(rulesDir, rule.filename), rule.content);
|
|
11191
11189
|
}
|
|
11192
|
-
console.log(` ${
|
|
11190
|
+
console.log(` ${chalk13.green("\u2713")} Cursor rules \u2014 added Caliber sync rules`);
|
|
11193
11191
|
}
|
|
11194
11192
|
if (targetAgent.includes("github-copilot")) {
|
|
11195
11193
|
const copilotPath = path28.join(".github", "copilot-instructions.md");
|
|
@@ -11206,7 +11204,7 @@ async function initCommand(options) {
|
|
|
11206
11204
|
const updatedCopilot = appendManagedBlocks2(copilotContent, "copilot");
|
|
11207
11205
|
if (updatedCopilot !== copilotContent) {
|
|
11208
11206
|
fs35.writeFileSync(copilotPath, updatedCopilot);
|
|
11209
|
-
console.log(` ${
|
|
11207
|
+
console.log(` ${chalk13.green("\u2713")} Copilot instructions \u2014 added Caliber sync instructions`);
|
|
11210
11208
|
}
|
|
11211
11209
|
}
|
|
11212
11210
|
const sha2 = getCurrentHeadSha();
|
|
@@ -11216,16 +11214,16 @@ async function initCommand(options) {
|
|
|
11216
11214
|
targetAgent
|
|
11217
11215
|
});
|
|
11218
11216
|
trackInitCompleted("sync-only", baselineScore.score);
|
|
11219
|
-
console.log(
|
|
11220
|
-
console.log(
|
|
11217
|
+
console.log(chalk13.bold.green("\n Caliber sync is set up!\n"));
|
|
11218
|
+
console.log(chalk13.dim(" Your agent configs will sync automatically on every commit."));
|
|
11221
11219
|
console.log(
|
|
11222
|
-
|
|
11220
|
+
chalk13.dim(" Run ") + title(`${bin} init --force`) + chalk13.dim(" anytime to generate or improve configs.\n")
|
|
11223
11221
|
);
|
|
11224
11222
|
return;
|
|
11225
11223
|
}
|
|
11226
11224
|
console.log(title.bold("\n Step 3/4 \u2014 Generate\n"));
|
|
11227
11225
|
const genModelInfo = fastModel ? ` Using ${displayModel} for docs, ${fastModel} for skills` : ` Using ${displayModel}`;
|
|
11228
|
-
console.log(
|
|
11226
|
+
console.log(chalk13.dim(genModelInfo + "\n"));
|
|
11229
11227
|
if (report) report.markStep("Generation");
|
|
11230
11228
|
trackInitGenerationStarted(false);
|
|
11231
11229
|
const genStartTime = Date.now();
|
|
@@ -11354,7 +11352,7 @@ async function initCommand(options) {
|
|
|
11354
11352
|
onContent: (text) => {
|
|
11355
11353
|
const lines = text.split("\n").filter((l) => l.trim()).slice(-8);
|
|
11356
11354
|
if (lines.length > 0) {
|
|
11357
|
-
display.setPreviewContent(lines.map((l) => ` ${
|
|
11355
|
+
display.setPreviewContent(lines.map((l) => ` ${chalk13.dim(l.slice(0, 80))}`));
|
|
11358
11356
|
}
|
|
11359
11357
|
}
|
|
11360
11358
|
},
|
|
@@ -11437,7 +11435,7 @@ async function initCommand(options) {
|
|
|
11437
11435
|
} catch (err) {
|
|
11438
11436
|
display.stop();
|
|
11439
11437
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
11440
|
-
console.log(
|
|
11438
|
+
console.log(chalk13.red(`
|
|
11441
11439
|
Engine failed: ${msg}
|
|
11442
11440
|
`));
|
|
11443
11441
|
writeErrorLog(config, void 0, msg, "exception");
|
|
@@ -11449,15 +11447,15 @@ async function initCommand(options) {
|
|
|
11449
11447
|
const mins = Math.floor(elapsedMs / 6e4);
|
|
11450
11448
|
const secs = Math.floor(elapsedMs % 6e4 / 1e3);
|
|
11451
11449
|
const timeStr = mins > 0 ? `${mins}m ${secs}s` : `${secs}s`;
|
|
11452
|
-
console.log(
|
|
11450
|
+
console.log(chalk13.dim(`
|
|
11453
11451
|
Done in ${timeStr}
|
|
11454
11452
|
`));
|
|
11455
11453
|
if (!generatedSetup) {
|
|
11456
|
-
console.log(
|
|
11454
|
+
console.log(chalk13.red(" Failed to generate config."));
|
|
11457
11455
|
writeErrorLog(config, rawOutput, void 0, genStopReason);
|
|
11458
11456
|
if (rawOutput) {
|
|
11459
|
-
console.log(
|
|
11460
|
-
console.log(
|
|
11457
|
+
console.log(chalk13.dim("\nRaw LLM output (JSON parse failed):"));
|
|
11458
|
+
console.log(chalk13.dim(rawOutput.slice(0, 500)));
|
|
11461
11459
|
}
|
|
11462
11460
|
throw new Error("__exit__");
|
|
11463
11461
|
}
|
|
@@ -11476,19 +11474,19 @@ async function initCommand(options) {
|
|
|
11476
11474
|
const changes = formatWhatChanged(generatedSetup);
|
|
11477
11475
|
if (changes.length > 0) {
|
|
11478
11476
|
for (const line of changes) {
|
|
11479
|
-
console.log(` ${
|
|
11477
|
+
console.log(` ${chalk13.dim("\u2022")} ${line}`);
|
|
11480
11478
|
}
|
|
11481
11479
|
console.log("");
|
|
11482
11480
|
}
|
|
11483
11481
|
console.log(
|
|
11484
|
-
|
|
11485
|
-
` ${
|
|
11482
|
+
chalk13.dim(
|
|
11483
|
+
` ${chalk13.green(`${staged.newFiles} new`)} / ${chalk13.yellow(`${staged.modifiedFiles} modified`)} file${totalChanges !== 1 ? "s" : ""}`
|
|
11486
11484
|
)
|
|
11487
11485
|
);
|
|
11488
11486
|
if (skillSearchResult.results.length > 0) {
|
|
11489
11487
|
console.log(
|
|
11490
|
-
|
|
11491
|
-
` ${
|
|
11488
|
+
chalk13.dim(
|
|
11489
|
+
` ${chalk13.cyan(`${skillSearchResult.results.length}`)} community skills available to install
|
|
11492
11490
|
`
|
|
11493
11491
|
)
|
|
11494
11492
|
);
|
|
@@ -11498,7 +11496,7 @@ async function initCommand(options) {
|
|
|
11498
11496
|
const hasSkillResults = skillSearchResult.results.length > 0;
|
|
11499
11497
|
let action;
|
|
11500
11498
|
if (totalChanges === 0 && !hasSkillResults) {
|
|
11501
|
-
console.log(
|
|
11499
|
+
console.log(chalk13.dim(" No changes needed \u2014 your configs are already up to date.\n"));
|
|
11502
11500
|
cleanupStaging();
|
|
11503
11501
|
action = "accept";
|
|
11504
11502
|
} else if (options.autoApprove) {
|
|
@@ -11522,14 +11520,14 @@ async function initCommand(options) {
|
|
|
11522
11520
|
trackInitRefinementRound(refinementRound, !!generatedSetup);
|
|
11523
11521
|
if (!generatedSetup) {
|
|
11524
11522
|
cleanupStaging();
|
|
11525
|
-
console.log(
|
|
11523
|
+
console.log(chalk13.dim("Refinement cancelled. No files were modified."));
|
|
11526
11524
|
return;
|
|
11527
11525
|
}
|
|
11528
11526
|
const updatedFiles = collectSetupFiles(generatedSetup, targetAgent);
|
|
11529
11527
|
const restaged = stageFiles(updatedFiles, process.cwd());
|
|
11530
11528
|
console.log(
|
|
11531
|
-
|
|
11532
|
-
` ${
|
|
11529
|
+
chalk13.dim(
|
|
11530
|
+
` ${chalk13.green(`${restaged.newFiles} new`)} / ${chalk13.yellow(`${restaged.modifiedFiles} modified`)} file${restaged.newFiles + restaged.modifiedFiles !== 1 ? "s" : ""}
|
|
11533
11531
|
`
|
|
11534
11532
|
)
|
|
11535
11533
|
);
|
|
@@ -11541,11 +11539,11 @@ async function initCommand(options) {
|
|
|
11541
11539
|
}
|
|
11542
11540
|
cleanupStaging();
|
|
11543
11541
|
if (action === "decline") {
|
|
11544
|
-
console.log(
|
|
11542
|
+
console.log(chalk13.dim("Declined. No files were modified."));
|
|
11545
11543
|
return;
|
|
11546
11544
|
}
|
|
11547
11545
|
if (options.dryRun) {
|
|
11548
|
-
console.log(
|
|
11546
|
+
console.log(chalk13.yellow("\n[Dry run] Would write the following files:"));
|
|
11549
11547
|
console.log(JSON.stringify(generatedSetup, null, 2));
|
|
11550
11548
|
return;
|
|
11551
11549
|
}
|
|
@@ -11576,23 +11574,23 @@ ${agentRefs.join(" ")}
|
|
|
11576
11574
|
0,
|
|
11577
11575
|
result.deleted.length
|
|
11578
11576
|
);
|
|
11579
|
-
console.log(
|
|
11577
|
+
console.log(chalk13.bold("\nFiles created/updated:"));
|
|
11580
11578
|
for (const file of result.written) {
|
|
11581
|
-
console.log(` ${
|
|
11579
|
+
console.log(` ${chalk13.green("\u2713")} ${file}`);
|
|
11582
11580
|
}
|
|
11583
11581
|
if (result.deleted.length > 0) {
|
|
11584
|
-
console.log(
|
|
11582
|
+
console.log(chalk13.bold("\nFiles removed:"));
|
|
11585
11583
|
for (const file of result.deleted) {
|
|
11586
|
-
console.log(` ${
|
|
11584
|
+
console.log(` ${chalk13.red("\u2717")} ${file}`);
|
|
11587
11585
|
}
|
|
11588
11586
|
}
|
|
11589
11587
|
if (result.backupDir) {
|
|
11590
|
-
console.log(
|
|
11588
|
+
console.log(chalk13.dim(`
|
|
11591
11589
|
Backups saved to ${result.backupDir}`));
|
|
11592
11590
|
}
|
|
11593
11591
|
} catch (err) {
|
|
11594
11592
|
writeSpinner.fail("Failed to write files");
|
|
11595
|
-
console.error(
|
|
11593
|
+
console.error(chalk13.red(err instanceof Error ? err.message : "Unknown error"));
|
|
11596
11594
|
throw new Error("__exit__");
|
|
11597
11595
|
}
|
|
11598
11596
|
if (fingerprint) ensurePermissions(fingerprint);
|
|
@@ -11607,7 +11605,7 @@ ${agentRefs.join(" ")}
|
|
|
11607
11605
|
trackInitScoreRegression(baselineScore.score, afterScore.score);
|
|
11608
11606
|
console.log("");
|
|
11609
11607
|
console.log(
|
|
11610
|
-
|
|
11608
|
+
chalk13.yellow(
|
|
11611
11609
|
` Score would drop from ${baselineScore.score} to ${afterScore.score} \u2014 reverting changes.`
|
|
11612
11610
|
)
|
|
11613
11611
|
);
|
|
@@ -11615,7 +11613,7 @@ ${agentRefs.join(" ")}
|
|
|
11615
11613
|
const { restored, removed } = undoSetup();
|
|
11616
11614
|
if (restored.length > 0 || removed.length > 0) {
|
|
11617
11615
|
console.log(
|
|
11618
|
-
|
|
11616
|
+
chalk13.dim(
|
|
11619
11617
|
` Reverted ${restored.length + removed.length} file${restored.length + removed.length === 1 ? "" : "s"} from backup.`
|
|
11620
11618
|
)
|
|
11621
11619
|
);
|
|
@@ -11623,7 +11621,7 @@ ${agentRefs.join(" ")}
|
|
|
11623
11621
|
} catch {
|
|
11624
11622
|
}
|
|
11625
11623
|
console.log(
|
|
11626
|
-
|
|
11624
|
+
chalk13.dim(" Run ") + chalk13.hex("#83D1EB")(`${bin} init --force`) + chalk13.dim(" to override.\n")
|
|
11627
11625
|
);
|
|
11628
11626
|
return;
|
|
11629
11627
|
}
|
|
@@ -11654,7 +11652,7 @@ ${agentRefs.join(" ")}
|
|
|
11654
11652
|
}
|
|
11655
11653
|
let communitySkillsInstalled = 0;
|
|
11656
11654
|
if (skillSearchResult.results.length > 0 && !options.autoApprove) {
|
|
11657
|
-
console.log(
|
|
11655
|
+
console.log(chalk13.dim(" Community skills matched to your project:\n"));
|
|
11658
11656
|
const selected = await interactiveSelect(skillSearchResult.results);
|
|
11659
11657
|
if (selected?.length) {
|
|
11660
11658
|
await installSkills(selected, targetAgent, skillSearchResult.contentMap);
|
|
@@ -11663,32 +11661,32 @@ ${agentRefs.join(" ")}
|
|
|
11663
11661
|
}
|
|
11664
11662
|
}
|
|
11665
11663
|
trackInitHookSelected("config-instructions");
|
|
11666
|
-
const done =
|
|
11667
|
-
console.log(
|
|
11668
|
-
console.log(
|
|
11664
|
+
const done = chalk13.green("\u2713");
|
|
11665
|
+
console.log(chalk13.bold.green("\n Caliber is set up!\n"));
|
|
11666
|
+
console.log(chalk13.bold(" What's configured:\n"));
|
|
11669
11667
|
console.log(
|
|
11670
|
-
` ${done} Continuous sync ${
|
|
11668
|
+
` ${done} Continuous sync ${chalk13.dim("pre-commit hook keeps all agent configs in sync")}`
|
|
11671
11669
|
);
|
|
11672
11670
|
console.log(
|
|
11673
|
-
` ${done} Config generated ${title(`${bin} score`)} ${
|
|
11671
|
+
` ${done} Config generated ${title(`${bin} score`)} ${chalk13.dim("for full breakdown")}`
|
|
11674
11672
|
);
|
|
11675
11673
|
console.log(
|
|
11676
|
-
` ${done} Agent skills ${
|
|
11674
|
+
` ${done} Agent skills ${chalk13.dim("/setup-caliber for new team members")}`
|
|
11677
11675
|
);
|
|
11678
11676
|
if (hasLearnableAgent) {
|
|
11679
11677
|
console.log(
|
|
11680
|
-
` ${done} Session learning ${
|
|
11678
|
+
` ${done} Session learning ${chalk13.dim("agent learns from your feedback")}`
|
|
11681
11679
|
);
|
|
11682
11680
|
}
|
|
11683
11681
|
if (communitySkillsInstalled > 0) {
|
|
11684
11682
|
console.log(
|
|
11685
|
-
` ${done} Community skills ${
|
|
11683
|
+
` ${done} Community skills ${chalk13.dim(`${communitySkillsInstalled} skill${communitySkillsInstalled > 1 ? "s" : ""} installed for your stack`)}`
|
|
11686
11684
|
);
|
|
11687
11685
|
}
|
|
11688
|
-
console.log(
|
|
11689
|
-
console.log(
|
|
11690
|
-
console.log(
|
|
11691
|
-
console.log(
|
|
11686
|
+
console.log(chalk13.bold("\n What happens next:\n"));
|
|
11687
|
+
console.log(chalk13.dim(" Every commit will automatically sync your agent configs."));
|
|
11688
|
+
console.log(chalk13.dim(" New team members can run /setup-caliber to get set up instantly.\n"));
|
|
11689
|
+
console.log(chalk13.bold(" Explore:\n"));
|
|
11692
11690
|
console.log(` ${title(`${bin} score`)} Full scoring breakdown with improvement tips`);
|
|
11693
11691
|
console.log(` ${title(`${bin} skills`)} Find community skills for your stack`);
|
|
11694
11692
|
console.log(` ${title(`${bin} undo`)} Revert all changes from this run`);
|
|
@@ -11702,14 +11700,14 @@ ${agentRefs.join(" ")}
|
|
|
11702
11700
|
const reportPath = path28.join(process.cwd(), ".caliber", "debug-report.md");
|
|
11703
11701
|
report.write(reportPath);
|
|
11704
11702
|
console.log(
|
|
11705
|
-
|
|
11703
|
+
chalk13.dim(` Debug report written to ${path28.relative(process.cwd(), reportPath)}
|
|
11706
11704
|
`)
|
|
11707
11705
|
);
|
|
11708
11706
|
}
|
|
11709
11707
|
}
|
|
11710
11708
|
|
|
11711
11709
|
// src/commands/undo.ts
|
|
11712
|
-
import
|
|
11710
|
+
import chalk14 from "chalk";
|
|
11713
11711
|
import ora4 from "ora";
|
|
11714
11712
|
function undoCommand() {
|
|
11715
11713
|
const spinner = ora4("Reverting config changes...").start();
|
|
@@ -11722,26 +11720,26 @@ function undoCommand() {
|
|
|
11722
11720
|
trackUndoExecuted();
|
|
11723
11721
|
spinner.succeed("Config reverted successfully.\n");
|
|
11724
11722
|
if (restored.length > 0) {
|
|
11725
|
-
console.log(
|
|
11723
|
+
console.log(chalk14.cyan(" Restored from backup:"));
|
|
11726
11724
|
for (const file of restored) {
|
|
11727
|
-
console.log(` ${
|
|
11725
|
+
console.log(` ${chalk14.green("\u21A9")} ${file}`);
|
|
11728
11726
|
}
|
|
11729
11727
|
}
|
|
11730
11728
|
if (removed.length > 0) {
|
|
11731
|
-
console.log(
|
|
11729
|
+
console.log(chalk14.cyan(" Removed:"));
|
|
11732
11730
|
for (const file of removed) {
|
|
11733
|
-
console.log(` ${
|
|
11731
|
+
console.log(` ${chalk14.red("\u2717")} ${file}`);
|
|
11734
11732
|
}
|
|
11735
11733
|
}
|
|
11736
11734
|
console.log("");
|
|
11737
11735
|
} catch (err) {
|
|
11738
|
-
spinner.fail(
|
|
11736
|
+
spinner.fail(chalk14.red(err instanceof Error ? err.message : "Undo failed"));
|
|
11739
11737
|
throw new Error("__exit__");
|
|
11740
11738
|
}
|
|
11741
11739
|
}
|
|
11742
11740
|
|
|
11743
11741
|
// src/commands/status.ts
|
|
11744
|
-
import
|
|
11742
|
+
import chalk15 from "chalk";
|
|
11745
11743
|
import fs36 from "fs";
|
|
11746
11744
|
init_config();
|
|
11747
11745
|
init_resolve_caliber();
|
|
@@ -11757,29 +11755,29 @@ async function statusCommand(options) {
|
|
|
11757
11755
|
}, null, 2));
|
|
11758
11756
|
return;
|
|
11759
11757
|
}
|
|
11760
|
-
console.log(
|
|
11758
|
+
console.log(chalk15.bold("\nCaliber Status\n"));
|
|
11761
11759
|
if (config) {
|
|
11762
|
-
console.log(` LLM: ${
|
|
11760
|
+
console.log(` LLM: ${chalk15.green(config.provider)} (${config.model})`);
|
|
11763
11761
|
} else {
|
|
11764
11762
|
const bin = resolveCaliber();
|
|
11765
|
-
console.log(` LLM: ${
|
|
11763
|
+
console.log(` LLM: ${chalk15.yellow("Not configured")} \u2014 run ${chalk15.hex("#83D1EB")(`${bin} config`)}`);
|
|
11766
11764
|
}
|
|
11767
11765
|
if (!manifest) {
|
|
11768
|
-
console.log(` Config: ${
|
|
11769
|
-
console.log(
|
|
11766
|
+
console.log(` Config: ${chalk15.dim("No config applied")}`);
|
|
11767
|
+
console.log(chalk15.dim("\n Run ") + chalk15.hex("#83D1EB")(`${resolveCaliber()} init`) + chalk15.dim(" to get started.\n"));
|
|
11770
11768
|
return;
|
|
11771
11769
|
}
|
|
11772
|
-
console.log(` Files managed: ${
|
|
11770
|
+
console.log(` Files managed: ${chalk15.cyan(manifest.entries.length.toString())}`);
|
|
11773
11771
|
for (const entry of manifest.entries) {
|
|
11774
11772
|
const exists = fs36.existsSync(entry.path);
|
|
11775
|
-
const icon = exists ?
|
|
11773
|
+
const icon = exists ? chalk15.green("\u2713") : chalk15.red("\u2717");
|
|
11776
11774
|
console.log(` ${icon} ${entry.path} (${entry.action})`);
|
|
11777
11775
|
}
|
|
11778
11776
|
console.log("");
|
|
11779
11777
|
}
|
|
11780
11778
|
|
|
11781
11779
|
// src/commands/regenerate.ts
|
|
11782
|
-
import
|
|
11780
|
+
import chalk16 from "chalk";
|
|
11783
11781
|
import ora5 from "ora";
|
|
11784
11782
|
import select6 from "@inquirer/select";
|
|
11785
11783
|
init_review();
|
|
@@ -11789,12 +11787,12 @@ async function regenerateCommand(options) {
|
|
|
11789
11787
|
const bin = resolveCaliber();
|
|
11790
11788
|
const config = loadConfig();
|
|
11791
11789
|
if (!config) {
|
|
11792
|
-
console.log(
|
|
11790
|
+
console.log(chalk16.red("No LLM provider configured. Run ") + chalk16.hex("#83D1EB")(`${bin} config`) + chalk16.red(" first."));
|
|
11793
11791
|
throw new Error("__exit__");
|
|
11794
11792
|
}
|
|
11795
11793
|
const manifest = readManifest();
|
|
11796
11794
|
if (!manifest) {
|
|
11797
|
-
console.log(
|
|
11795
|
+
console.log(chalk16.yellow("No existing config found. Run ") + chalk16.hex("#83D1EB")(`${bin} init`) + chalk16.yellow(" first."));
|
|
11798
11796
|
throw new Error("__exit__");
|
|
11799
11797
|
}
|
|
11800
11798
|
const targetAgent = readState()?.targetAgent ?? ["claude", "cursor"];
|
|
@@ -11805,7 +11803,7 @@ async function regenerateCommand(options) {
|
|
|
11805
11803
|
const baselineScore = computeLocalScore(process.cwd(), targetAgent);
|
|
11806
11804
|
displayScoreSummary(baselineScore);
|
|
11807
11805
|
if (baselineScore.score === 100) {
|
|
11808
|
-
console.log(
|
|
11806
|
+
console.log(chalk16.green(" Your config is already at 100/100 \u2014 nothing to regenerate.\n"));
|
|
11809
11807
|
return;
|
|
11810
11808
|
}
|
|
11811
11809
|
const genSpinner = ora5("Regenerating config...").start();
|
|
@@ -11847,18 +11845,18 @@ async function regenerateCommand(options) {
|
|
|
11847
11845
|
const setupFiles = collectSetupFiles(generatedSetup, targetAgent);
|
|
11848
11846
|
const staged = stageFiles(setupFiles, process.cwd());
|
|
11849
11847
|
const totalChanges = staged.newFiles + staged.modifiedFiles;
|
|
11850
|
-
console.log(
|
|
11851
|
-
${
|
|
11848
|
+
console.log(chalk16.dim(`
|
|
11849
|
+
${chalk16.green(`${staged.newFiles} new`)} / ${chalk16.yellow(`${staged.modifiedFiles} modified`)} file${totalChanges !== 1 ? "s" : ""}
|
|
11852
11850
|
`));
|
|
11853
11851
|
if (totalChanges === 0) {
|
|
11854
|
-
console.log(
|
|
11852
|
+
console.log(chalk16.dim(" No changes needed \u2014 your configs are already up to date.\n"));
|
|
11855
11853
|
cleanupStaging();
|
|
11856
11854
|
return;
|
|
11857
11855
|
}
|
|
11858
11856
|
if (options.dryRun) {
|
|
11859
|
-
console.log(
|
|
11857
|
+
console.log(chalk16.yellow("[Dry run] Would write:"));
|
|
11860
11858
|
for (const f of staged.stagedFiles) {
|
|
11861
|
-
console.log(` ${f.isNew ?
|
|
11859
|
+
console.log(` ${f.isNew ? chalk16.green("+") : chalk16.yellow("~")} ${f.relativePath}`);
|
|
11862
11860
|
}
|
|
11863
11861
|
cleanupStaging();
|
|
11864
11862
|
return;
|
|
@@ -11877,7 +11875,7 @@ async function regenerateCommand(options) {
|
|
|
11877
11875
|
});
|
|
11878
11876
|
cleanupStaging();
|
|
11879
11877
|
if (action === "decline") {
|
|
11880
|
-
console.log(
|
|
11878
|
+
console.log(chalk16.dim("Regeneration cancelled. No files were modified."));
|
|
11881
11879
|
return;
|
|
11882
11880
|
}
|
|
11883
11881
|
const writeSpinner = ora5("Writing config files...").start();
|
|
@@ -11885,20 +11883,20 @@ async function regenerateCommand(options) {
|
|
|
11885
11883
|
const result = writeSetup(generatedSetup);
|
|
11886
11884
|
writeSpinner.succeed("Config files written");
|
|
11887
11885
|
for (const file of result.written) {
|
|
11888
|
-
console.log(` ${
|
|
11886
|
+
console.log(` ${chalk16.green("\u2713")} ${file}`);
|
|
11889
11887
|
}
|
|
11890
11888
|
if (result.deleted.length > 0) {
|
|
11891
11889
|
for (const file of result.deleted) {
|
|
11892
|
-
console.log(` ${
|
|
11890
|
+
console.log(` ${chalk16.red("\u2717")} ${file}`);
|
|
11893
11891
|
}
|
|
11894
11892
|
}
|
|
11895
11893
|
if (result.backupDir) {
|
|
11896
|
-
console.log(
|
|
11894
|
+
console.log(chalk16.dim(`
|
|
11897
11895
|
Backups saved to ${result.backupDir}`));
|
|
11898
11896
|
}
|
|
11899
11897
|
} catch (err) {
|
|
11900
11898
|
writeSpinner.fail("Failed to write files");
|
|
11901
|
-
console.error(
|
|
11899
|
+
console.error(chalk16.red(err instanceof Error ? err.message : "Unknown error"));
|
|
11902
11900
|
throw new Error("__exit__");
|
|
11903
11901
|
}
|
|
11904
11902
|
const sha = getCurrentHeadSha();
|
|
@@ -11910,21 +11908,21 @@ async function regenerateCommand(options) {
|
|
|
11910
11908
|
const afterScore = computeLocalScore(process.cwd(), targetAgent);
|
|
11911
11909
|
if (afterScore.score < baselineScore.score) {
|
|
11912
11910
|
console.log("");
|
|
11913
|
-
console.log(
|
|
11911
|
+
console.log(chalk16.yellow(` Score would drop from ${baselineScore.score} to ${afterScore.score} \u2014 reverting changes.`));
|
|
11914
11912
|
try {
|
|
11915
11913
|
const { restored, removed } = undoSetup();
|
|
11916
11914
|
if (restored.length > 0 || removed.length > 0) {
|
|
11917
|
-
console.log(
|
|
11915
|
+
console.log(chalk16.dim(` Reverted ${restored.length + removed.length} file${restored.length + removed.length === 1 ? "" : "s"} from backup.`));
|
|
11918
11916
|
}
|
|
11919
11917
|
} catch {
|
|
11920
11918
|
}
|
|
11921
|
-
console.log(
|
|
11919
|
+
console.log(chalk16.dim(" Run ") + chalk16.hex("#83D1EB")(`${bin} init --force`) + chalk16.dim(" to override.\n"));
|
|
11922
11920
|
return;
|
|
11923
11921
|
}
|
|
11924
11922
|
displayScoreDelta(baselineScore, afterScore);
|
|
11925
11923
|
trackRegenerateCompleted(action, Date.now());
|
|
11926
|
-
console.log(
|
|
11927
|
-
console.log(
|
|
11924
|
+
console.log(chalk16.bold.green(" Regeneration complete!"));
|
|
11925
|
+
console.log(chalk16.dim(" Run ") + chalk16.hex("#83D1EB")(`${bin} undo`) + chalk16.dim(" to revert changes.\n"));
|
|
11928
11926
|
}
|
|
11929
11927
|
|
|
11930
11928
|
// src/commands/score.ts
|
|
@@ -11932,7 +11930,7 @@ import fs37 from "fs";
|
|
|
11932
11930
|
import os7 from "os";
|
|
11933
11931
|
import path29 from "path";
|
|
11934
11932
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
11935
|
-
import
|
|
11933
|
+
import chalk17 from "chalk";
|
|
11936
11934
|
init_resolve_caliber();
|
|
11937
11935
|
var CONFIG_FILES = ["CLAUDE.md", "AGENTS.md", ".cursorrules", "CALIBER_LEARNINGS.md"];
|
|
11938
11936
|
var CONFIG_DIRS = [".claude", ".cursor"];
|
|
@@ -11986,7 +11984,7 @@ async function scoreCommand(options) {
|
|
|
11986
11984
|
const baseResult = scoreBaseRef(options.compare, target);
|
|
11987
11985
|
if (!baseResult) {
|
|
11988
11986
|
console.error(
|
|
11989
|
-
|
|
11987
|
+
chalk17.red(`Could not score ref "${options.compare}" \u2014 branch or ref not found.`)
|
|
11990
11988
|
);
|
|
11991
11989
|
process.exitCode = 1;
|
|
11992
11990
|
return;
|
|
@@ -12012,18 +12010,18 @@ async function scoreCommand(options) {
|
|
|
12012
12010
|
return;
|
|
12013
12011
|
}
|
|
12014
12012
|
displayScore(result);
|
|
12015
|
-
const separator2 =
|
|
12013
|
+
const separator2 = chalk17.gray(" " + "\u2500".repeat(53));
|
|
12016
12014
|
console.log(separator2);
|
|
12017
12015
|
if (delta > 0) {
|
|
12018
12016
|
console.log(
|
|
12019
|
-
|
|
12017
|
+
chalk17.green(` +${delta}`) + chalk17.gray(` from ${options.compare} (${baseResult.score}/100)`)
|
|
12020
12018
|
);
|
|
12021
12019
|
} else if (delta < 0) {
|
|
12022
12020
|
console.log(
|
|
12023
|
-
|
|
12021
|
+
chalk17.red(` ${delta}`) + chalk17.gray(` from ${options.compare} (${baseResult.score}/100)`)
|
|
12024
12022
|
);
|
|
12025
12023
|
} else {
|
|
12026
|
-
console.log(
|
|
12024
|
+
console.log(chalk17.gray(` No change from ${options.compare} (${baseResult.score}/100)`));
|
|
12027
12025
|
}
|
|
12028
12026
|
console.log("");
|
|
12029
12027
|
return;
|
|
@@ -12037,7 +12035,7 @@ async function scoreCommand(options) {
|
|
|
12037
12035
|
return;
|
|
12038
12036
|
}
|
|
12039
12037
|
displayScore(result);
|
|
12040
|
-
const separator =
|
|
12038
|
+
const separator = chalk17.gray(" " + "\u2500".repeat(53));
|
|
12041
12039
|
console.log(separator);
|
|
12042
12040
|
const bin = resolveCaliber();
|
|
12043
12041
|
const failing = result.checks.filter((c) => !c.passed && c.maxPoints > 0).sort((a, b) => b.maxPoints - b.earnedPoints - (a.maxPoints - a.earnedPoints));
|
|
@@ -12045,22 +12043,22 @@ async function scoreCommand(options) {
|
|
|
12045
12043
|
const topFix = failing[0];
|
|
12046
12044
|
const pts = topFix.maxPoints - topFix.earnedPoints;
|
|
12047
12045
|
console.log(
|
|
12048
|
-
|
|
12046
|
+
chalk17.gray(" Biggest gain: ") + chalk17.yellow(`+${pts} pts`) + chalk17.gray(` from "${topFix.name}"`) + (topFix.suggestion ? chalk17.gray(` \u2014 ${topFix.suggestion}`) : "")
|
|
12049
12047
|
);
|
|
12050
12048
|
console.log(
|
|
12051
|
-
|
|
12049
|
+
chalk17.gray(" Run ") + chalk17.hex("#83D1EB")(`${bin} init`) + chalk17.gray(" to generate or update your agent config files.")
|
|
12052
12050
|
);
|
|
12053
12051
|
} else if (failing.length > 0) {
|
|
12054
12052
|
console.log(
|
|
12055
|
-
|
|
12053
|
+
chalk17.green(" Looking good!") + chalk17.gray(
|
|
12056
12054
|
` ${failing.length} optional improvement${failing.length === 1 ? "" : "s"} available.`
|
|
12057
12055
|
)
|
|
12058
12056
|
);
|
|
12059
12057
|
console.log(
|
|
12060
|
-
|
|
12058
|
+
chalk17.gray(" Run ") + chalk17.hex("#83D1EB")(`${bin} init`) + chalk17.gray(" to improve, or ") + chalk17.hex("#83D1EB")(`${bin} regenerate`) + chalk17.gray(" to rebuild from scratch.")
|
|
12061
12059
|
);
|
|
12062
12060
|
} else {
|
|
12063
|
-
console.log(
|
|
12061
|
+
console.log(chalk17.green(" Perfect score! Your agent configs are fully optimized."));
|
|
12064
12062
|
}
|
|
12065
12063
|
console.log("");
|
|
12066
12064
|
}
|
|
@@ -12068,7 +12066,7 @@ async function scoreCommand(options) {
|
|
|
12068
12066
|
// src/commands/refresh.ts
|
|
12069
12067
|
import fs42 from "fs";
|
|
12070
12068
|
import path34 from "path";
|
|
12071
|
-
import
|
|
12069
|
+
import chalk18 from "chalk";
|
|
12072
12070
|
import ora6 from "ora";
|
|
12073
12071
|
import pLimit from "p-limit";
|
|
12074
12072
|
|
|
@@ -12729,7 +12727,7 @@ async function refreshDir(repoDir, dir, diff, options) {
|
|
|
12729
12727
|
const quiet = !!options.quiet;
|
|
12730
12728
|
const suppress = !!options.suppressSpinner;
|
|
12731
12729
|
const effectiveQuiet = quiet || suppress;
|
|
12732
|
-
const prefix = options.label ? `${
|
|
12730
|
+
const prefix = options.label ? `${chalk18.bold(options.label)} ` : "";
|
|
12733
12731
|
const absDir = dir === "." ? repoDir : path34.resolve(repoDir, dir);
|
|
12734
12732
|
const scope = dir === "." ? void 0 : dir;
|
|
12735
12733
|
const spinner = effectiveQuiet ? null : ora6(`${prefix}Analyzing changes...`).start();
|
|
@@ -12786,10 +12784,10 @@ async function refreshDir(repoDir, dir, diff, options) {
|
|
|
12786
12784
|
if (options.dryRun) {
|
|
12787
12785
|
spinner?.info(`${prefix}Dry run \u2014 would update:`);
|
|
12788
12786
|
for (const doc of response.docsUpdated) {
|
|
12789
|
-
console.log(` ${
|
|
12787
|
+
console.log(` ${chalk18.yellow("~")} ${doc}`);
|
|
12790
12788
|
}
|
|
12791
12789
|
if (response.changesSummary) {
|
|
12792
|
-
console.log(
|
|
12790
|
+
console.log(chalk18.dim(`
|
|
12793
12791
|
${response.changesSummary}`));
|
|
12794
12792
|
}
|
|
12795
12793
|
return { written: [], fileChanges: [], syncedAgents: [], changesSummary: null };
|
|
@@ -12830,7 +12828,7 @@ async function refreshDir(repoDir, dir, diff, options) {
|
|
|
12830
12828
|
);
|
|
12831
12829
|
log2(
|
|
12832
12830
|
effectiveQuiet,
|
|
12833
|
-
|
|
12831
|
+
chalk18.dim(` Config quality gate prevented a regression. No files were changed.`)
|
|
12834
12832
|
);
|
|
12835
12833
|
return { written: [], fileChanges: [], syncedAgents: [], changesSummary: null };
|
|
12836
12834
|
}
|
|
@@ -12843,18 +12841,18 @@ async function refreshDir(repoDir, dir, diff, options) {
|
|
|
12843
12841
|
if (!suppress) {
|
|
12844
12842
|
for (const file of written) {
|
|
12845
12843
|
const desc = fileChangesMap.get(file);
|
|
12846
|
-
const suffix = desc ?
|
|
12847
|
-
log2(effectiveQuiet, ` ${
|
|
12844
|
+
const suffix = desc ? chalk18.dim(` \u2014 ${desc}`) : "";
|
|
12845
|
+
log2(effectiveQuiet, ` ${chalk18.green("\u2713")} ${file}${suffix}`);
|
|
12848
12846
|
}
|
|
12849
12847
|
if (syncedAgents.length > 1) {
|
|
12850
12848
|
log2(
|
|
12851
12849
|
effectiveQuiet,
|
|
12852
|
-
|
|
12850
|
+
chalk18.cyan(`
|
|
12853
12851
|
${syncedAgents.length} agent formats in sync (${syncedAgents.join(", ")})`)
|
|
12854
12852
|
);
|
|
12855
12853
|
}
|
|
12856
12854
|
if (response.changesSummary) {
|
|
12857
|
-
log2(effectiveQuiet,
|
|
12855
|
+
log2(effectiveQuiet, chalk18.dim(`
|
|
12858
12856
|
${response.changesSummary}`));
|
|
12859
12857
|
}
|
|
12860
12858
|
}
|
|
@@ -12862,7 +12860,7 @@ async function refreshDir(repoDir, dir, diff, options) {
|
|
|
12862
12860
|
}
|
|
12863
12861
|
async function refreshSingleRepo(repoDir, options) {
|
|
12864
12862
|
const quiet = !!options.quiet;
|
|
12865
|
-
const prefix = options.label ? `${
|
|
12863
|
+
const prefix = options.label ? `${chalk18.bold(options.label)} ` : "";
|
|
12866
12864
|
const state = readState();
|
|
12867
12865
|
const lastSha = state?.lastRefreshSha ?? null;
|
|
12868
12866
|
const currentSha = getCurrentHeadSha();
|
|
@@ -12871,7 +12869,7 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
12871
12869
|
if (elapsed < REFRESH_COOLDOWN_MS && elapsed > 0) {
|
|
12872
12870
|
log2(
|
|
12873
12871
|
quiet,
|
|
12874
|
-
|
|
12872
|
+
chalk18.dim(`${prefix}Skipped \u2014 last refresh was ${Math.round(elapsed / 1e3)}s ago.`)
|
|
12875
12873
|
);
|
|
12876
12874
|
return;
|
|
12877
12875
|
}
|
|
@@ -12881,14 +12879,14 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
12881
12879
|
if (currentSha) {
|
|
12882
12880
|
writeState({ lastRefreshSha: currentSha, lastRefreshTimestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
12883
12881
|
}
|
|
12884
|
-
log2(quiet,
|
|
12882
|
+
log2(quiet, chalk18.dim(`${prefix}No changes since last refresh.`));
|
|
12885
12883
|
return;
|
|
12886
12884
|
}
|
|
12887
12885
|
const configDirs = discoverConfigDirs(repoDir);
|
|
12888
12886
|
if (configDirs.length <= 1) {
|
|
12889
12887
|
await refreshDir(repoDir, ".", diff, options);
|
|
12890
12888
|
} else {
|
|
12891
|
-
log2(quiet,
|
|
12889
|
+
log2(quiet, chalk18.dim(`${prefix}Found configs in ${configDirs.length} directories
|
|
12892
12890
|
`));
|
|
12893
12891
|
const dirsWithChanges = configDirs.map((dir) => ({ dir, scopedDiff: scopeDiffToDir(diff, dir, configDirs) })).filter(({ scopedDiff }) => scopedDiff.hasChanges);
|
|
12894
12892
|
const parallelSpinner = quiet ? null : ora6(
|
|
@@ -12916,7 +12914,7 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
12916
12914
|
hadFailure = true;
|
|
12917
12915
|
log2(
|
|
12918
12916
|
quiet,
|
|
12919
|
-
|
|
12917
|
+
chalk18.yellow(
|
|
12920
12918
|
` ${dirLabel}: refresh failed \u2014 ${result.reason instanceof Error ? result.reason.message : "unknown error"}`
|
|
12921
12919
|
)
|
|
12922
12920
|
);
|
|
@@ -12925,20 +12923,20 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
12925
12923
|
const fileChangesMap = new Map(fileChanges.map((fc) => [fc.file, fc.description]));
|
|
12926
12924
|
for (const file of written) {
|
|
12927
12925
|
const desc = fileChangesMap.get(file);
|
|
12928
|
-
const suffix = desc ?
|
|
12929
|
-
log2(quiet, ` ${
|
|
12926
|
+
const suffix = desc ? chalk18.dim(` \u2014 ${desc}`) : "";
|
|
12927
|
+
log2(quiet, ` ${chalk18.green("\u2713")} ${dirLabel}/${file}${suffix}`);
|
|
12930
12928
|
}
|
|
12931
12929
|
if (syncedAgents.length > 1) {
|
|
12932
12930
|
log2(
|
|
12933
12931
|
quiet,
|
|
12934
|
-
|
|
12932
|
+
chalk18.cyan(
|
|
12935
12933
|
`
|
|
12936
12934
|
${syncedAgents.length} agent formats in sync (${syncedAgents.join(", ")})`
|
|
12937
12935
|
)
|
|
12938
12936
|
);
|
|
12939
12937
|
}
|
|
12940
12938
|
if (changesSummary) {
|
|
12941
|
-
log2(quiet,
|
|
12939
|
+
log2(quiet, chalk18.dim(`
|
|
12942
12940
|
${changesSummary}`));
|
|
12943
12941
|
}
|
|
12944
12942
|
}
|
|
@@ -12949,7 +12947,7 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
12949
12947
|
}
|
|
12950
12948
|
const builtinWritten = ensureBuiltinSkills();
|
|
12951
12949
|
for (const file of builtinWritten) {
|
|
12952
|
-
log2(quiet, ` ${
|
|
12950
|
+
log2(quiet, ` ${chalk18.green("\u2713")} ${file} ${chalk18.dim("(built-in)")}`);
|
|
12953
12951
|
}
|
|
12954
12952
|
clearRefreshError();
|
|
12955
12953
|
if (currentSha) {
|
|
@@ -12965,11 +12963,11 @@ async function refreshCommand(options) {
|
|
|
12965
12963
|
if (!quiet) {
|
|
12966
12964
|
const lastError = readRefreshError();
|
|
12967
12965
|
if (lastError) {
|
|
12968
|
-
console.log(
|
|
12966
|
+
console.log(chalk18.yellow(`
|
|
12969
12967
|
\u26A0 Last refresh failed (${lastError.timestamp}):`));
|
|
12970
|
-
console.log(
|
|
12968
|
+
console.log(chalk18.dim(` ${lastError.error}`));
|
|
12971
12969
|
console.log(
|
|
12972
|
-
|
|
12970
|
+
chalk18.dim(
|
|
12973
12971
|
` Run with --debug for full details, or report at https://github.com/caliber-ai-org/ai-setup/issues
|
|
12974
12972
|
`
|
|
12975
12973
|
)
|
|
@@ -12982,7 +12980,7 @@ async function refreshCommand(options) {
|
|
|
12982
12980
|
if (!config) {
|
|
12983
12981
|
if (quiet) return;
|
|
12984
12982
|
console.log(
|
|
12985
|
-
|
|
12983
|
+
chalk18.red("No LLM provider configured. Run ") + chalk18.hex("#83D1EB")(`${resolveCaliber()} config`) + chalk18.red(" (e.g. choose Cursor) or set an API key.")
|
|
12986
12984
|
);
|
|
12987
12985
|
throw new Error("__exit__");
|
|
12988
12986
|
}
|
|
@@ -12995,11 +12993,11 @@ async function refreshCommand(options) {
|
|
|
12995
12993
|
if (repos.length === 0) {
|
|
12996
12994
|
if (quiet) return;
|
|
12997
12995
|
console.log(
|
|
12998
|
-
|
|
12996
|
+
chalk18.red("Not inside a git repository and no git repos found in child directories.")
|
|
12999
12997
|
);
|
|
13000
12998
|
throw new Error("__exit__");
|
|
13001
12999
|
}
|
|
13002
|
-
log2(quiet,
|
|
13000
|
+
log2(quiet, chalk18.dim(`Found ${repos.length} git repo${repos.length === 1 ? "" : "s"}
|
|
13003
13001
|
`));
|
|
13004
13002
|
const originalDir = process.cwd();
|
|
13005
13003
|
for (const repo of repos) {
|
|
@@ -13012,7 +13010,7 @@ async function refreshCommand(options) {
|
|
|
13012
13010
|
writeRefreshError(err);
|
|
13013
13011
|
log2(
|
|
13014
13012
|
quiet,
|
|
13015
|
-
|
|
13013
|
+
chalk18.yellow(
|
|
13016
13014
|
`${repoName}: refresh failed \u2014 ${err instanceof Error ? err.message : "unknown error"}`
|
|
13017
13015
|
)
|
|
13018
13016
|
);
|
|
@@ -13025,13 +13023,13 @@ async function refreshCommand(options) {
|
|
|
13025
13023
|
writeRefreshError(err);
|
|
13026
13024
|
if (quiet) return;
|
|
13027
13025
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
13028
|
-
console.log(
|
|
13026
|
+
console.log(chalk18.red(`Refresh failed: ${msg}`));
|
|
13029
13027
|
throw new Error("__exit__");
|
|
13030
13028
|
}
|
|
13031
13029
|
}
|
|
13032
13030
|
|
|
13033
13031
|
// src/commands/hooks.ts
|
|
13034
|
-
import
|
|
13032
|
+
import chalk19 from "chalk";
|
|
13035
13033
|
import fs43 from "fs";
|
|
13036
13034
|
var HOOKS = [
|
|
13037
13035
|
{
|
|
@@ -13068,41 +13066,41 @@ var HOOKS = [
|
|
|
13068
13066
|
}
|
|
13069
13067
|
];
|
|
13070
13068
|
function printStatus() {
|
|
13071
|
-
console.log(
|
|
13069
|
+
console.log(chalk19.bold("\n Hooks\n"));
|
|
13072
13070
|
for (const hook of HOOKS) {
|
|
13073
13071
|
const installed = hook.isInstalled();
|
|
13074
|
-
const icon = installed ?
|
|
13075
|
-
const state = installed ?
|
|
13072
|
+
const icon = installed ? chalk19.green("\u2713") : chalk19.dim("\u2717");
|
|
13073
|
+
const state = installed ? chalk19.green("enabled") : chalk19.dim("disabled");
|
|
13076
13074
|
console.log(` ${icon} ${hook.label.padEnd(26)} ${state}`);
|
|
13077
|
-
console.log(
|
|
13075
|
+
console.log(chalk19.dim(` ${hook.description}`));
|
|
13078
13076
|
}
|
|
13079
13077
|
console.log("");
|
|
13080
13078
|
}
|
|
13081
13079
|
async function hooksCommand(options) {
|
|
13082
13080
|
if (!options.install && !options.remove) {
|
|
13083
13081
|
console.log(
|
|
13084
|
-
|
|
13082
|
+
chalk19.dim("\n Note: caliber now adds refresh instructions directly to config files.")
|
|
13085
13083
|
);
|
|
13086
13084
|
console.log(
|
|
13087
|
-
|
|
13085
|
+
chalk19.dim(" These hooks are available for non-agent workflows (manual commits).\n")
|
|
13088
13086
|
);
|
|
13089
13087
|
}
|
|
13090
13088
|
if (options.install) {
|
|
13091
13089
|
for (const hook of HOOKS) {
|
|
13092
13090
|
const result = hook.install();
|
|
13093
13091
|
if (result.alreadyInstalled) {
|
|
13094
|
-
console.log(
|
|
13092
|
+
console.log(chalk19.dim(` ${hook.label} already enabled.`));
|
|
13095
13093
|
} else {
|
|
13096
|
-
console.log(
|
|
13094
|
+
console.log(chalk19.green(" \u2713") + ` ${hook.label} enabled`);
|
|
13097
13095
|
}
|
|
13098
13096
|
}
|
|
13099
13097
|
if (fs43.existsSync(".claude")) {
|
|
13100
13098
|
const r = installLearningHooks();
|
|
13101
|
-
if (r.installed) console.log(
|
|
13099
|
+
if (r.installed) console.log(chalk19.green(" \u2713") + " Claude Code learning hooks enabled");
|
|
13102
13100
|
}
|
|
13103
13101
|
if (fs43.existsSync(".cursor")) {
|
|
13104
13102
|
const r = installCursorLearningHooks();
|
|
13105
|
-
if (r.installed) console.log(
|
|
13103
|
+
if (r.installed) console.log(chalk19.green(" \u2713") + " Cursor learning hooks enabled");
|
|
13106
13104
|
}
|
|
13107
13105
|
return;
|
|
13108
13106
|
}
|
|
@@ -13110,9 +13108,9 @@ async function hooksCommand(options) {
|
|
|
13110
13108
|
for (const hook of HOOKS) {
|
|
13111
13109
|
const result = hook.remove();
|
|
13112
13110
|
if (result.notFound) {
|
|
13113
|
-
console.log(
|
|
13111
|
+
console.log(chalk19.dim(` ${hook.label} already disabled.`));
|
|
13114
13112
|
} else {
|
|
13115
|
-
console.log(
|
|
13113
|
+
console.log(chalk19.green(" \u2713") + ` ${hook.label} removed`);
|
|
13116
13114
|
}
|
|
13117
13115
|
}
|
|
13118
13116
|
return;
|
|
@@ -13127,18 +13125,18 @@ async function hooksCommand(options) {
|
|
|
13127
13125
|
const states = HOOKS.map((h) => h.isInstalled());
|
|
13128
13126
|
function render() {
|
|
13129
13127
|
const lines = [];
|
|
13130
|
-
lines.push(
|
|
13128
|
+
lines.push(chalk19.bold(" Hooks"));
|
|
13131
13129
|
lines.push("");
|
|
13132
13130
|
for (let i = 0; i < HOOKS.length; i++) {
|
|
13133
13131
|
const hook = HOOKS[i];
|
|
13134
13132
|
const enabled = states[i];
|
|
13135
|
-
const toggle = enabled ?
|
|
13136
|
-
const ptr = i === cursor ?
|
|
13133
|
+
const toggle = enabled ? chalk19.green("[on] ") : chalk19.dim("[off]");
|
|
13134
|
+
const ptr = i === cursor ? chalk19.cyan(">") : " ";
|
|
13137
13135
|
lines.push(` ${ptr} ${toggle} ${hook.label}`);
|
|
13138
|
-
lines.push(
|
|
13136
|
+
lines.push(chalk19.dim(` ${hook.description}`));
|
|
13139
13137
|
}
|
|
13140
13138
|
lines.push("");
|
|
13141
|
-
lines.push(
|
|
13139
|
+
lines.push(chalk19.dim(" \u2191\u2193 navigate \u23B5 toggle a all on n all off \u23CE apply q cancel"));
|
|
13142
13140
|
return lines.join("\n");
|
|
13143
13141
|
}
|
|
13144
13142
|
function draw(initial) {
|
|
@@ -13169,16 +13167,16 @@ async function hooksCommand(options) {
|
|
|
13169
13167
|
const wantEnabled = states[i];
|
|
13170
13168
|
if (wantEnabled && !wasInstalled) {
|
|
13171
13169
|
hook.install();
|
|
13172
|
-
console.log(
|
|
13170
|
+
console.log(chalk19.green(" \u2713") + ` ${hook.label} enabled`);
|
|
13173
13171
|
changed++;
|
|
13174
13172
|
} else if (!wantEnabled && wasInstalled) {
|
|
13175
13173
|
hook.remove();
|
|
13176
|
-
console.log(
|
|
13174
|
+
console.log(chalk19.green(" \u2713") + ` ${hook.label} disabled`);
|
|
13177
13175
|
changed++;
|
|
13178
13176
|
}
|
|
13179
13177
|
}
|
|
13180
13178
|
if (changed === 0) {
|
|
13181
|
-
console.log(
|
|
13179
|
+
console.log(chalk19.dim(" No changes."));
|
|
13182
13180
|
}
|
|
13183
13181
|
console.log("");
|
|
13184
13182
|
}
|
|
@@ -13214,7 +13212,7 @@ async function hooksCommand(options) {
|
|
|
13214
13212
|
case "\x1B":
|
|
13215
13213
|
case "":
|
|
13216
13214
|
cleanup();
|
|
13217
|
-
console.log(
|
|
13215
|
+
console.log(chalk19.dim("\n Cancelled.\n"));
|
|
13218
13216
|
resolve3();
|
|
13219
13217
|
break;
|
|
13220
13218
|
}
|
|
@@ -13225,52 +13223,52 @@ async function hooksCommand(options) {
|
|
|
13225
13223
|
|
|
13226
13224
|
// src/commands/config.ts
|
|
13227
13225
|
init_config();
|
|
13228
|
-
import
|
|
13226
|
+
import chalk20 from "chalk";
|
|
13229
13227
|
async function configCommand() {
|
|
13230
13228
|
const existing = loadConfig();
|
|
13231
13229
|
if (existing) {
|
|
13232
13230
|
const displayModel = getDisplayModel(existing);
|
|
13233
13231
|
const fastModel = getFastModel();
|
|
13234
|
-
console.log(
|
|
13235
|
-
console.log(` Provider: ${
|
|
13236
|
-
console.log(` Model: ${
|
|
13232
|
+
console.log(chalk20.bold("\nCurrent Configuration\n"));
|
|
13233
|
+
console.log(` Provider: ${chalk20.cyan(existing.provider)}`);
|
|
13234
|
+
console.log(` Model: ${chalk20.cyan(displayModel)}`);
|
|
13237
13235
|
if (fastModel) {
|
|
13238
|
-
console.log(` Scan: ${
|
|
13236
|
+
console.log(` Scan: ${chalk20.cyan(fastModel)}`);
|
|
13239
13237
|
}
|
|
13240
13238
|
if (existing.apiKey) {
|
|
13241
13239
|
const masked = existing.apiKey.slice(0, 8) + "..." + existing.apiKey.slice(-4);
|
|
13242
|
-
console.log(` API Key: ${
|
|
13240
|
+
console.log(` API Key: ${chalk20.dim(masked)}`);
|
|
13243
13241
|
}
|
|
13244
13242
|
if (existing.provider === "cursor") {
|
|
13245
|
-
console.log(` Seat: ${
|
|
13243
|
+
console.log(` Seat: ${chalk20.dim("Cursor (agent acp)")}`);
|
|
13246
13244
|
}
|
|
13247
13245
|
if (existing.provider === "claude-cli") {
|
|
13248
|
-
console.log(` Seat: ${
|
|
13246
|
+
console.log(` Seat: ${chalk20.dim("Claude Code (claude -p)")}`);
|
|
13249
13247
|
}
|
|
13250
13248
|
if (existing.baseUrl) {
|
|
13251
|
-
console.log(` Base URL: ${
|
|
13249
|
+
console.log(` Base URL: ${chalk20.dim(existing.baseUrl)}`);
|
|
13252
13250
|
}
|
|
13253
13251
|
if (existing.vertexProjectId) {
|
|
13254
|
-
console.log(` Vertex Project: ${
|
|
13255
|
-
console.log(` Vertex Region: ${
|
|
13252
|
+
console.log(` Vertex Project: ${chalk20.dim(existing.vertexProjectId)}`);
|
|
13253
|
+
console.log(` Vertex Region: ${chalk20.dim(existing.vertexRegion || "us-east5")}`);
|
|
13256
13254
|
}
|
|
13257
|
-
console.log(` Source: ${
|
|
13255
|
+
console.log(` Source: ${chalk20.dim(process.env.ANTHROPIC_API_KEY || process.env.OPENAI_API_KEY || process.env.VERTEX_PROJECT_ID || process.env.CALIBER_USE_CURSOR_SEAT || process.env.CALIBER_USE_CLAUDE_CLI ? "environment variables" : getConfigFilePath())}`);
|
|
13258
13256
|
console.log("");
|
|
13259
13257
|
}
|
|
13260
13258
|
await runInteractiveProviderSetup();
|
|
13261
13259
|
const updated = loadConfig();
|
|
13262
13260
|
if (updated) trackConfigProviderSet(updated.provider);
|
|
13263
|
-
console.log(
|
|
13264
|
-
console.log(
|
|
13261
|
+
console.log(chalk20.green("\n\u2713 Configuration saved"));
|
|
13262
|
+
console.log(chalk20.dim(` ${getConfigFilePath()}
|
|
13265
13263
|
`));
|
|
13266
|
-
console.log(
|
|
13267
|
-
console.log(
|
|
13264
|
+
console.log(chalk20.dim(" You can also set environment variables instead:"));
|
|
13265
|
+
console.log(chalk20.dim(" ANTHROPIC_API_KEY, OPENAI_API_KEY, VERTEX_PROJECT_ID, CALIBER_USE_CURSOR_SEAT=1, or CALIBER_USE_CLAUDE_CLI=1\n"));
|
|
13268
13266
|
}
|
|
13269
13267
|
|
|
13270
13268
|
// src/commands/learn.ts
|
|
13271
13269
|
import fs47 from "fs";
|
|
13272
13270
|
import path38 from "path";
|
|
13273
|
-
import
|
|
13271
|
+
import chalk22 from "chalk";
|
|
13274
13272
|
|
|
13275
13273
|
// src/learner/stdin.ts
|
|
13276
13274
|
var STDIN_TIMEOUT_MS = 5e3;
|
|
@@ -13470,7 +13468,7 @@ function releaseFinalizeLock() {
|
|
|
13470
13468
|
// src/lib/notifications.ts
|
|
13471
13469
|
import fs45 from "fs";
|
|
13472
13470
|
import path36 from "path";
|
|
13473
|
-
import
|
|
13471
|
+
import chalk21 from "chalk";
|
|
13474
13472
|
function notificationFilePath() {
|
|
13475
13473
|
return path36.join(getLearningDir(), "last-finalize-summary.json");
|
|
13476
13474
|
}
|
|
@@ -13490,13 +13488,13 @@ function checkPendingNotifications() {
|
|
|
13490
13488
|
if (!summary.newItemCount || summary.newItemCount === 0) return;
|
|
13491
13489
|
const wasteLabel = summary.wasteTokens > 0 ? ` (~${summary.wasteTokens.toLocaleString()} wasted tokens captured)` : "";
|
|
13492
13490
|
console.log(
|
|
13493
|
-
|
|
13491
|
+
chalk21.dim(`caliber: learned ${summary.newItemCount} new pattern${summary.newItemCount === 1 ? "" : "s"} from your last session${wasteLabel}`)
|
|
13494
13492
|
);
|
|
13495
13493
|
for (const item of summary.newItems.slice(0, 3)) {
|
|
13496
|
-
console.log(
|
|
13494
|
+
console.log(chalk21.dim(` + ${item.replace(/^- /, "").slice(0, 80)}`));
|
|
13497
13495
|
}
|
|
13498
13496
|
if (summary.newItems.length > 3) {
|
|
13499
|
-
console.log(
|
|
13497
|
+
console.log(chalk21.dim(` ... and ${summary.newItems.length - 3} more`));
|
|
13500
13498
|
}
|
|
13501
13499
|
console.log("");
|
|
13502
13500
|
} catch {
|
|
@@ -13993,7 +13991,7 @@ async function learnFinalizeCommand(options) {
|
|
|
13993
13991
|
const { isCaliberRunning: isCaliberRunning2 } = await Promise.resolve().then(() => (init_lock(), lock_exports));
|
|
13994
13992
|
if (isCaliberRunning2()) {
|
|
13995
13993
|
if (!isAuto)
|
|
13996
|
-
console.log(
|
|
13994
|
+
console.log(chalk22.dim("caliber: skipping finalize \u2014 another caliber process is running"));
|
|
13997
13995
|
return;
|
|
13998
13996
|
}
|
|
13999
13997
|
}
|
|
@@ -14002,7 +14000,7 @@ async function learnFinalizeCommand(options) {
|
|
|
14002
14000
|
}
|
|
14003
14001
|
if (!acquireFinalizeLock()) {
|
|
14004
14002
|
if (!isAuto)
|
|
14005
|
-
console.log(
|
|
14003
|
+
console.log(chalk22.dim("caliber: skipping finalize \u2014 another finalize is in progress"));
|
|
14006
14004
|
return;
|
|
14007
14005
|
}
|
|
14008
14006
|
let analyzed = false;
|
|
@@ -14011,7 +14009,7 @@ async function learnFinalizeCommand(options) {
|
|
|
14011
14009
|
if (!config) {
|
|
14012
14010
|
if (isAuto) return;
|
|
14013
14011
|
console.log(
|
|
14014
|
-
|
|
14012
|
+
chalk22.yellow(
|
|
14015
14013
|
`caliber: no LLM provider configured \u2014 run \`${resolveCaliber()} config\` first`
|
|
14016
14014
|
)
|
|
14017
14015
|
);
|
|
@@ -14024,7 +14022,7 @@ async function learnFinalizeCommand(options) {
|
|
|
14024
14022
|
if (allEvents.length < threshold) {
|
|
14025
14023
|
if (!isAuto)
|
|
14026
14024
|
console.log(
|
|
14027
|
-
|
|
14025
|
+
chalk22.dim(
|
|
14028
14026
|
`caliber: ${allEvents.length}/${threshold} events recorded \u2014 need more before analysis`
|
|
14029
14027
|
)
|
|
14030
14028
|
);
|
|
@@ -14038,7 +14036,7 @@ async function learnFinalizeCommand(options) {
|
|
|
14038
14036
|
if (events.length < threshold) {
|
|
14039
14037
|
if (!isAuto)
|
|
14040
14038
|
console.log(
|
|
14041
|
-
|
|
14039
|
+
chalk22.dim(
|
|
14042
14040
|
`caliber: ${events.length}/${threshold} new events since last analysis \u2014 need more`
|
|
14043
14041
|
)
|
|
14044
14042
|
);
|
|
@@ -14078,12 +14076,12 @@ async function learnFinalizeCommand(options) {
|
|
|
14078
14076
|
} else {
|
|
14079
14077
|
const wasteLabel = waste.totalWasteTokens > 0 ? ` (~${waste.totalWasteTokens.toLocaleString()} wasted tokens captured)` : "";
|
|
14080
14078
|
console.log(
|
|
14081
|
-
|
|
14079
|
+
chalk22.dim(
|
|
14082
14080
|
`caliber: learned ${result.newItemCount} new pattern${result.newItemCount === 1 ? "" : "s"}${wasteLabel}`
|
|
14083
14081
|
)
|
|
14084
14082
|
);
|
|
14085
14083
|
for (const item of result.newItems) {
|
|
14086
|
-
console.log(
|
|
14084
|
+
console.log(chalk22.dim(` + ${item.replace(/^- /, "").slice(0, 80)}`));
|
|
14087
14085
|
}
|
|
14088
14086
|
}
|
|
14089
14087
|
const wastePerLearning = Math.round(waste.totalWasteTokens / result.newItemCount);
|
|
@@ -14177,7 +14175,7 @@ async function learnFinalizeCommand(options) {
|
|
|
14177
14175
|
const staleLearnings = findStaleLearnings(roiStats);
|
|
14178
14176
|
if (staleLearnings.length > 0 && !isAuto) {
|
|
14179
14177
|
console.log(
|
|
14180
|
-
|
|
14178
|
+
chalk22.yellow(
|
|
14181
14179
|
`caliber: ${staleLearnings.length} learning${staleLearnings.length === 1 ? "" : "s"} never activated \u2014 run \`${resolveCaliber()} learn list --verbose\` to review`
|
|
14182
14180
|
)
|
|
14183
14181
|
);
|
|
@@ -14186,7 +14184,7 @@ async function learnFinalizeCommand(options) {
|
|
|
14186
14184
|
if (!isAuto && t.estimatedSavingsTokens > 0) {
|
|
14187
14185
|
const totalLearnings = existingLearnedItems + newLearningsProduced;
|
|
14188
14186
|
console.log(
|
|
14189
|
-
|
|
14187
|
+
chalk22.dim(
|
|
14190
14188
|
`caliber: ${totalLearnings} learnings active \u2014 est. ~${t.estimatedSavingsTokens.toLocaleString()} tokens saved across ${t.totalSessionsWithLearnings} sessions`
|
|
14191
14189
|
)
|
|
14192
14190
|
);
|
|
@@ -14194,7 +14192,7 @@ async function learnFinalizeCommand(options) {
|
|
|
14194
14192
|
} catch (err) {
|
|
14195
14193
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
14196
14194
|
if (options?.force && !isAuto) {
|
|
14197
|
-
console.error(
|
|
14195
|
+
console.error(chalk22.red("caliber: finalize failed \u2014"), errorMsg);
|
|
14198
14196
|
}
|
|
14199
14197
|
writeFinalizeError(errorMsg);
|
|
14200
14198
|
} finally {
|
|
@@ -14217,51 +14215,51 @@ async function learnInstallCommand() {
|
|
|
14217
14215
|
if (fs47.existsSync(".claude")) {
|
|
14218
14216
|
const r = installLearningHooks();
|
|
14219
14217
|
if (r.installed) {
|
|
14220
|
-
console.log(
|
|
14218
|
+
console.log(chalk22.green("\u2713") + " Claude Code learning hooks installed");
|
|
14221
14219
|
anyInstalled = true;
|
|
14222
14220
|
} else if (r.alreadyInstalled) {
|
|
14223
|
-
console.log(
|
|
14221
|
+
console.log(chalk22.dim(" Claude Code hooks already installed"));
|
|
14224
14222
|
}
|
|
14225
14223
|
}
|
|
14226
14224
|
if (fs47.existsSync(".cursor")) {
|
|
14227
14225
|
const r = installCursorLearningHooks();
|
|
14228
14226
|
if (r.installed) {
|
|
14229
|
-
console.log(
|
|
14227
|
+
console.log(chalk22.green("\u2713") + " Cursor learning hooks installed");
|
|
14230
14228
|
anyInstalled = true;
|
|
14231
14229
|
} else if (r.alreadyInstalled) {
|
|
14232
|
-
console.log(
|
|
14230
|
+
console.log(chalk22.dim(" Cursor hooks already installed"));
|
|
14233
14231
|
}
|
|
14234
14232
|
}
|
|
14235
14233
|
if (!fs47.existsSync(".claude") && !fs47.existsSync(".cursor")) {
|
|
14236
|
-
console.log(
|
|
14234
|
+
console.log(chalk22.yellow("No .claude/ or .cursor/ directory found."));
|
|
14237
14235
|
console.log(
|
|
14238
|
-
|
|
14236
|
+
chalk22.dim(` Run \`${resolveCaliber()} init\` first, or create the directory manually.`)
|
|
14239
14237
|
);
|
|
14240
14238
|
return;
|
|
14241
14239
|
}
|
|
14242
14240
|
if (anyInstalled) {
|
|
14243
14241
|
console.log(
|
|
14244
|
-
|
|
14242
|
+
chalk22.dim(
|
|
14245
14243
|
` Tool usage will be recorded and learnings extracted after \u2265${MIN_EVENTS_FOR_ANALYSIS} events.`
|
|
14246
14244
|
)
|
|
14247
14245
|
);
|
|
14248
|
-
console.log(
|
|
14246
|
+
console.log(chalk22.dim(" Learnings written to CALIBER_LEARNINGS.md."));
|
|
14249
14247
|
}
|
|
14250
14248
|
}
|
|
14251
14249
|
async function learnRemoveCommand() {
|
|
14252
14250
|
let anyRemoved = false;
|
|
14253
14251
|
const r1 = removeLearningHooks();
|
|
14254
14252
|
if (r1.removed) {
|
|
14255
|
-
console.log(
|
|
14253
|
+
console.log(chalk22.green("\u2713") + " Claude Code learning hooks removed");
|
|
14256
14254
|
anyRemoved = true;
|
|
14257
14255
|
}
|
|
14258
14256
|
const r2 = removeCursorLearningHooks();
|
|
14259
14257
|
if (r2.removed) {
|
|
14260
|
-
console.log(
|
|
14258
|
+
console.log(chalk22.green("\u2713") + " Cursor learning hooks removed");
|
|
14261
14259
|
anyRemoved = true;
|
|
14262
14260
|
}
|
|
14263
14261
|
if (!anyRemoved) {
|
|
14264
|
-
console.log(
|
|
14262
|
+
console.log(chalk22.dim("No learning hooks found."));
|
|
14265
14263
|
}
|
|
14266
14264
|
}
|
|
14267
14265
|
async function learnStatusCommand() {
|
|
@@ -14269,51 +14267,51 @@ async function learnStatusCommand() {
|
|
|
14269
14267
|
const cursorInstalled = areCursorLearningHooksInstalled();
|
|
14270
14268
|
const state = readState2();
|
|
14271
14269
|
const eventCount = getEventCount();
|
|
14272
|
-
console.log(
|
|
14270
|
+
console.log(chalk22.bold("Session Learning Status"));
|
|
14273
14271
|
console.log();
|
|
14274
14272
|
if (claudeInstalled) {
|
|
14275
|
-
console.log(
|
|
14273
|
+
console.log(chalk22.green("\u2713") + " Claude Code hooks " + chalk22.green("installed"));
|
|
14276
14274
|
} else {
|
|
14277
|
-
console.log(
|
|
14275
|
+
console.log(chalk22.dim("\u2717") + " Claude Code hooks " + chalk22.dim("not installed"));
|
|
14278
14276
|
}
|
|
14279
14277
|
if (cursorInstalled) {
|
|
14280
|
-
console.log(
|
|
14278
|
+
console.log(chalk22.green("\u2713") + " Cursor hooks " + chalk22.green("installed"));
|
|
14281
14279
|
} else {
|
|
14282
|
-
console.log(
|
|
14280
|
+
console.log(chalk22.dim("\u2717") + " Cursor hooks " + chalk22.dim("not installed"));
|
|
14283
14281
|
}
|
|
14284
14282
|
if (!claudeInstalled && !cursorInstalled) {
|
|
14285
14283
|
console.log(
|
|
14286
|
-
|
|
14284
|
+
chalk22.dim(` Run \`${resolveCaliber()} learn install\` to enable session learning.`)
|
|
14287
14285
|
);
|
|
14288
14286
|
}
|
|
14289
14287
|
console.log();
|
|
14290
|
-
console.log(`Events recorded: ${
|
|
14291
|
-
console.log(`Threshold for analysis: ${
|
|
14288
|
+
console.log(`Events recorded: ${chalk22.cyan(String(eventCount))}`);
|
|
14289
|
+
console.log(`Threshold for analysis: ${chalk22.cyan(String(MIN_EVENTS_FOR_ANALYSIS))}`);
|
|
14292
14290
|
if (state.lastAnalysisTimestamp) {
|
|
14293
|
-
console.log(`Last analysis: ${
|
|
14291
|
+
console.log(`Last analysis: ${chalk22.cyan(state.lastAnalysisTimestamp)}`);
|
|
14294
14292
|
} else {
|
|
14295
|
-
console.log(`Last analysis: ${
|
|
14293
|
+
console.log(`Last analysis: ${chalk22.dim("none")}`);
|
|
14296
14294
|
}
|
|
14297
14295
|
const lastError = readFinalizeError();
|
|
14298
14296
|
if (lastError) {
|
|
14299
|
-
console.log(`Last error: ${
|
|
14300
|
-
console.log(
|
|
14297
|
+
console.log(`Last error: ${chalk22.red(lastError.error)}`);
|
|
14298
|
+
console.log(chalk22.dim(` at ${lastError.timestamp}`));
|
|
14301
14299
|
const logPath = path38.join(getLearningDir(), LEARNING_FINALIZE_LOG);
|
|
14302
14300
|
if (fs47.existsSync(logPath)) {
|
|
14303
|
-
console.log(
|
|
14301
|
+
console.log(chalk22.dim(` Full log: ${logPath}`));
|
|
14304
14302
|
}
|
|
14305
14303
|
}
|
|
14306
14304
|
const learnedSection = readLearnedSection();
|
|
14307
14305
|
if (learnedSection) {
|
|
14308
14306
|
const lineCount = learnedSection.split("\n").filter(Boolean).length;
|
|
14309
14307
|
console.log(`
|
|
14310
|
-
Learned items in CALIBER_LEARNINGS.md: ${
|
|
14308
|
+
Learned items in CALIBER_LEARNINGS.md: ${chalk22.cyan(String(lineCount))}`);
|
|
14311
14309
|
}
|
|
14312
14310
|
const roiStats = readROIStats();
|
|
14313
14311
|
const roiSummary = formatROISummary(roiStats);
|
|
14314
14312
|
if (roiSummary) {
|
|
14315
14313
|
console.log();
|
|
14316
|
-
console.log(
|
|
14314
|
+
console.log(chalk22.bold(roiSummary.split("\n")[0]));
|
|
14317
14315
|
for (const line of roiSummary.split("\n").slice(1)) {
|
|
14318
14316
|
console.log(line);
|
|
14319
14317
|
}
|
|
@@ -14339,26 +14337,26 @@ function getAllLearnings() {
|
|
|
14339
14337
|
async function learnListCommand(options) {
|
|
14340
14338
|
const items = getAllLearnings();
|
|
14341
14339
|
if (items.length === 0) {
|
|
14342
|
-
console.log(
|
|
14340
|
+
console.log(chalk22.dim(`No learnings yet. Run \`${resolveCaliber()} learn install\` to start.`));
|
|
14343
14341
|
return;
|
|
14344
14342
|
}
|
|
14345
14343
|
const roiStats = options?.verbose ? readROIStats() : null;
|
|
14346
|
-
console.log(
|
|
14344
|
+
console.log(chalk22.bold(`
|
|
14347
14345
|
Learnings (${items.length})
|
|
14348
14346
|
`));
|
|
14349
14347
|
for (const item of items) {
|
|
14350
|
-
const tag = item.source === "personal" ?
|
|
14348
|
+
const tag = item.source === "personal" ? chalk22.magenta("[personal]") : chalk22.blue("[project]");
|
|
14351
14349
|
const display = item.text.replace(/^- /, "").slice(0, 100);
|
|
14352
|
-
console.log(` ${
|
|
14350
|
+
console.log(` ${chalk22.dim(String(item.index + 1).padStart(2, " "))}. ${tag} ${display}`);
|
|
14353
14351
|
if (options?.verbose && roiStats) {
|
|
14354
14352
|
const match = roiStats.learnings.find((l) => display.includes(l.summary.slice(0, 40)));
|
|
14355
14353
|
if (match) {
|
|
14356
14354
|
const activations = match.activationCount ?? 0;
|
|
14357
14355
|
const stale = activations === 0 && roiStats.sessions.length >= 10;
|
|
14358
|
-
const activationLabel = stale ?
|
|
14356
|
+
const activationLabel = stale ? chalk22.yellow(`${activations} activations [stale]`) : chalk22.dim(`${activations} activation${activations === 1 ? "" : "s"}`);
|
|
14359
14357
|
console.log(` ${activationLabel}`);
|
|
14360
14358
|
if (match.explanation) {
|
|
14361
|
-
console.log(` ${
|
|
14359
|
+
console.log(` ${chalk22.dim("Why: " + match.explanation.slice(0, 80))}`);
|
|
14362
14360
|
}
|
|
14363
14361
|
}
|
|
14364
14362
|
}
|
|
@@ -14369,7 +14367,7 @@ async function learnDeleteCommand(indexStr) {
|
|
|
14369
14367
|
const index = parseInt(indexStr, 10);
|
|
14370
14368
|
if (isNaN(index) || index < 1) {
|
|
14371
14369
|
console.log(
|
|
14372
|
-
|
|
14370
|
+
chalk22.red(
|
|
14373
14371
|
`Invalid index: "${indexStr}". Use a number from \`${resolveCaliber()} learn list\`.`
|
|
14374
14372
|
)
|
|
14375
14373
|
);
|
|
@@ -14378,13 +14376,13 @@ async function learnDeleteCommand(indexStr) {
|
|
|
14378
14376
|
const items = getAllLearnings();
|
|
14379
14377
|
const targetIdx = index - 1;
|
|
14380
14378
|
if (targetIdx >= items.length) {
|
|
14381
|
-
console.log(
|
|
14379
|
+
console.log(chalk22.red(`Index ${index} is out of range. You have ${items.length} learnings.`));
|
|
14382
14380
|
return;
|
|
14383
14381
|
}
|
|
14384
14382
|
const item = items[targetIdx];
|
|
14385
14383
|
const filePath = item.source === "personal" ? PERSONAL_LEARNINGS_FILE : "CALIBER_LEARNINGS.md";
|
|
14386
14384
|
if (!fs47.existsSync(filePath)) {
|
|
14387
|
-
console.log(
|
|
14385
|
+
console.log(chalk22.red("Learnings file not found."));
|
|
14388
14386
|
return;
|
|
14389
14387
|
}
|
|
14390
14388
|
const content = fs47.readFileSync(filePath, "utf-8");
|
|
@@ -14403,7 +14401,7 @@ async function learnDeleteCommand(indexStr) {
|
|
|
14403
14401
|
}
|
|
14404
14402
|
}
|
|
14405
14403
|
if (lineToRemove === -1) {
|
|
14406
|
-
console.log(
|
|
14404
|
+
console.log(chalk22.red("Could not locate learning in file."));
|
|
14407
14405
|
return;
|
|
14408
14406
|
}
|
|
14409
14407
|
const bulletToRemove = lines[lineToRemove];
|
|
@@ -14419,24 +14417,24 @@ async function learnDeleteCommand(indexStr) {
|
|
|
14419
14417
|
roiStats.learnings.splice(roiIdx, 1);
|
|
14420
14418
|
writeROIStats(roiStats);
|
|
14421
14419
|
}
|
|
14422
|
-
console.log(
|
|
14420
|
+
console.log(chalk22.green("\u2713") + ` Removed: ${bulletToRemove.replace(/^- /, "").slice(0, 80)}`);
|
|
14423
14421
|
}
|
|
14424
14422
|
async function learnAddCommand(content, options) {
|
|
14425
14423
|
if (!content.trim()) {
|
|
14426
|
-
console.log(
|
|
14424
|
+
console.log(chalk22.yellow("Please provide learning content."));
|
|
14427
14425
|
throw new Error("__exit__");
|
|
14428
14426
|
}
|
|
14429
14427
|
const scope = options.personal ? "personal" : "project";
|
|
14430
14428
|
const result = addLearning(content.trim(), scope);
|
|
14431
14429
|
if (result.added) {
|
|
14432
|
-
console.log(
|
|
14430
|
+
console.log(chalk22.green("\u2713") + ` Learning saved to ${result.file}`);
|
|
14433
14431
|
} else {
|
|
14434
|
-
console.log(
|
|
14432
|
+
console.log(chalk22.dim(" Similar learning already exists \u2014 skipped."));
|
|
14435
14433
|
}
|
|
14436
14434
|
}
|
|
14437
14435
|
|
|
14438
14436
|
// src/commands/insights.ts
|
|
14439
|
-
import
|
|
14437
|
+
import chalk23 from "chalk";
|
|
14440
14438
|
init_resolve_caliber();
|
|
14441
14439
|
var MIN_SESSIONS_FULL = 20;
|
|
14442
14440
|
function buildInsightsData(stats) {
|
|
@@ -14477,85 +14475,85 @@ function buildInsightsData(stats) {
|
|
|
14477
14475
|
};
|
|
14478
14476
|
}
|
|
14479
14477
|
function displayColdStart(score) {
|
|
14480
|
-
console.log(
|
|
14478
|
+
console.log(chalk23.bold("\n Agent Insights\n"));
|
|
14481
14479
|
const hooksInstalled = areLearningHooksInstalled() || areCursorLearningHooksInstalled();
|
|
14482
14480
|
if (!hooksInstalled) {
|
|
14483
|
-
console.log(
|
|
14484
|
-
console.log(
|
|
14485
|
-
console.log(
|
|
14486
|
-
console.log(
|
|
14481
|
+
console.log(chalk23.yellow(" Learning hooks not installed."));
|
|
14482
|
+
console.log(chalk23.dim(" Session learning captures patterns from your AI coding sessions \u2014 what"));
|
|
14483
|
+
console.log(chalk23.dim(" fails, what works, corrections you make \u2014 so your agents improve over time.\n"));
|
|
14484
|
+
console.log(chalk23.dim(" Run ") + chalk23.cyan(`${resolveCaliber()} learn install`) + chalk23.dim(" to enable."));
|
|
14487
14485
|
} else {
|
|
14488
|
-
console.log(
|
|
14489
|
-
console.log(
|
|
14490
|
-
console.log(
|
|
14486
|
+
console.log(chalk23.dim(" Learning hooks are active. Use your AI agent and insights"));
|
|
14487
|
+
console.log(chalk23.dim(" will appear automatically after each session.\n"));
|
|
14488
|
+
console.log(chalk23.dim(` Progress: 0/${MIN_SESSIONS_FULL} sessions \u2014 full insights unlock at ${MIN_SESSIONS_FULL}`));
|
|
14491
14489
|
}
|
|
14492
|
-
console.log(
|
|
14490
|
+
console.log(chalk23.dim(`
|
|
14493
14491
|
Config score: ${score.score}/100 (${score.grade})`));
|
|
14494
14492
|
console.log("");
|
|
14495
14493
|
}
|
|
14496
14494
|
function displayEarlyData(data, score) {
|
|
14497
|
-
console.log(
|
|
14495
|
+
console.log(chalk23.bold("\n Agent Insights") + chalk23.yellow(" (early data)\n"));
|
|
14498
14496
|
const remaining = MIN_SESSIONS_FULL - data.totalSessions;
|
|
14499
|
-
console.log(
|
|
14497
|
+
console.log(chalk23.dim(` ${data.totalSessions}/${MIN_SESSIONS_FULL} sessions tracked \u2014 ${remaining} more for full insights.
|
|
14500
14498
|
`));
|
|
14501
|
-
console.log(` Sessions tracked: ${
|
|
14502
|
-
console.log(` Learnings accumulated: ${
|
|
14499
|
+
console.log(` Sessions tracked: ${chalk23.cyan(String(data.totalSessions))}`);
|
|
14500
|
+
console.log(` Learnings accumulated: ${chalk23.cyan(String(data.learningCount))}`);
|
|
14503
14501
|
if (data.totalWasteTokens > 0) {
|
|
14504
|
-
console.log(` Waste captured: ${
|
|
14502
|
+
console.log(` Waste captured: ${chalk23.cyan(data.totalWasteTokens.toLocaleString())} tokens`);
|
|
14505
14503
|
}
|
|
14506
14504
|
if (data.failureRateImprovement !== null && data.failureRateImprovement > 0) {
|
|
14507
|
-
console.log(` Failure rate trend: ${
|
|
14505
|
+
console.log(` Failure rate trend: ${chalk23.green(`${data.failureRateImprovement}% fewer`)} failures with learnings ${chalk23.dim("(early signal)")}`);
|
|
14508
14506
|
} else if (data.totalSessions > 0 && data.failureRateImprovement === null) {
|
|
14509
|
-
console.log(` Failure rate trend: ${
|
|
14507
|
+
console.log(` Failure rate trend: ${chalk23.dim("collecting data (need 3+ sessions in each group)")}`);
|
|
14510
14508
|
}
|
|
14511
14509
|
if (data.taskSuccessRate !== null) {
|
|
14512
|
-
console.log(` Task success rate: ${
|
|
14510
|
+
console.log(` Task success rate: ${chalk23.cyan(`${data.taskSuccessRate}%`)} ${chalk23.dim(`(${data.taskCount} tasks)`)}`);
|
|
14513
14511
|
}
|
|
14514
|
-
console.log(` Config score: ${
|
|
14512
|
+
console.log(` Config score: ${chalk23.cyan(`${score.score}/100`)} (${score.grade})`);
|
|
14515
14513
|
console.log("");
|
|
14516
14514
|
}
|
|
14517
14515
|
function displayFullInsights(data, score) {
|
|
14518
|
-
console.log(
|
|
14519
|
-
console.log(
|
|
14516
|
+
console.log(chalk23.bold("\n Agent Insights\n"));
|
|
14517
|
+
console.log(chalk23.bold(" Agent Health"));
|
|
14520
14518
|
if (data.taskSuccessRate !== null) {
|
|
14521
|
-
const color = data.taskSuccessRate >= 80 ?
|
|
14519
|
+
const color = data.taskSuccessRate >= 80 ? chalk23.green : data.taskSuccessRate >= 60 ? chalk23.yellow : chalk23.red;
|
|
14522
14520
|
console.log(` Task success rate: ${color(`${data.taskSuccessRate}%`)} across ${data.taskCount} tasks`);
|
|
14523
14521
|
if (data.taskCorrectionCount > 0) {
|
|
14524
|
-
console.log(` Corrections needed: ${
|
|
14522
|
+
console.log(` Corrections needed: ${chalk23.yellow(String(data.taskCorrectionCount))} tasks required user correction`);
|
|
14525
14523
|
}
|
|
14526
14524
|
}
|
|
14527
|
-
console.log(` Sessions tracked: ${
|
|
14528
|
-
console.log(
|
|
14529
|
-
console.log(` Learnings active: ${
|
|
14525
|
+
console.log(` Sessions tracked: ${chalk23.cyan(String(data.totalSessions))}`);
|
|
14526
|
+
console.log(chalk23.bold("\n Learning Impact"));
|
|
14527
|
+
console.log(` Learnings active: ${chalk23.cyan(String(data.learningCount))}`);
|
|
14530
14528
|
if (data.failureRateWith !== null && data.failureRateWithout !== null) {
|
|
14531
|
-
console.log(` Failure rate: ${
|
|
14529
|
+
console.log(` Failure rate: ${chalk23.red(data.failureRateWithout.toFixed(1))}/session ${chalk23.dim("\u2192")} ${chalk23.green(data.failureRateWith.toFixed(1))}/session with learnings`);
|
|
14532
14530
|
if (data.failureRateImprovement !== null && data.failureRateImprovement > 0) {
|
|
14533
|
-
console.log(` Improvement: ${
|
|
14531
|
+
console.log(` Improvement: ${chalk23.green(`${data.failureRateImprovement}%`)} fewer failures`);
|
|
14534
14532
|
} else if (data.failureRateImprovement === null) {
|
|
14535
|
-
console.log(` Improvement: ${
|
|
14533
|
+
console.log(` Improvement: ${chalk23.dim("collecting data (need 3+ sessions in each group)")}`);
|
|
14536
14534
|
}
|
|
14537
14535
|
}
|
|
14538
14536
|
if (data.totalWasteTokens > 0 || data.estimatedSavingsTokens > 0) {
|
|
14539
|
-
console.log(
|
|
14537
|
+
console.log(chalk23.bold("\n Efficiency"));
|
|
14540
14538
|
if (data.totalWasteTokens > 0) {
|
|
14541
|
-
console.log(` Waste captured: ${
|
|
14539
|
+
console.log(` Waste captured: ${chalk23.cyan(data.totalWasteTokens.toLocaleString())} tokens`);
|
|
14542
14540
|
}
|
|
14543
14541
|
if (data.estimatedSavingsTokens > 0) {
|
|
14544
|
-
console.log(` Estimated savings: ~${
|
|
14542
|
+
console.log(` Estimated savings: ~${chalk23.green(data.estimatedSavingsTokens.toLocaleString())} tokens`);
|
|
14545
14543
|
}
|
|
14546
14544
|
if (data.estimatedSavingsSeconds > 0) {
|
|
14547
|
-
console.log(` Time saved: ~${
|
|
14545
|
+
console.log(` Time saved: ~${chalk23.green(formatDuration(data.estimatedSavingsSeconds))}`);
|
|
14548
14546
|
}
|
|
14549
14547
|
}
|
|
14550
|
-
console.log(
|
|
14551
|
-
console.log(` Score: ${
|
|
14548
|
+
console.log(chalk23.bold("\n Config Quality"));
|
|
14549
|
+
console.log(` Score: ${chalk23.cyan(`${score.score}/100`)} (${score.grade})`);
|
|
14552
14550
|
const history = readScoreHistory();
|
|
14553
14551
|
const trend = getScoreTrend(history);
|
|
14554
14552
|
if (trend) {
|
|
14555
|
-
const trendColor = trend.direction === "up" ?
|
|
14553
|
+
const trendColor = trend.direction === "up" ? chalk23.green : trend.direction === "down" ? chalk23.red : chalk23.gray;
|
|
14556
14554
|
const arrow = trend.direction === "up" ? "\u2191" : trend.direction === "down" ? "\u2193" : "\u2192";
|
|
14557
14555
|
const sign = trend.delta > 0 ? "+" : "";
|
|
14558
|
-
console.log(` Trend: ${trendColor(`${arrow} ${sign}${trend.delta} pts`)} ${
|
|
14556
|
+
console.log(` Trend: ${trendColor(`${arrow} ${sign}${trend.delta} pts`)} ${chalk23.dim(`over ${trend.entries} checks`)}`);
|
|
14559
14557
|
}
|
|
14560
14558
|
console.log("");
|
|
14561
14559
|
}
|
|
@@ -14585,36 +14583,36 @@ async function insightsCommand(options) {
|
|
|
14585
14583
|
// src/commands/sources.ts
|
|
14586
14584
|
import fs48 from "fs";
|
|
14587
14585
|
import path39 from "path";
|
|
14588
|
-
import
|
|
14586
|
+
import chalk24 from "chalk";
|
|
14589
14587
|
init_resolve_caliber();
|
|
14590
14588
|
async function sourcesListCommand() {
|
|
14591
14589
|
const dir = process.cwd();
|
|
14592
14590
|
const configSources = loadSourcesConfig(dir);
|
|
14593
14591
|
const workspaces = getDetectedWorkspaces(dir);
|
|
14594
14592
|
if (configSources.length === 0 && workspaces.length === 0) {
|
|
14595
|
-
console.log(
|
|
14596
|
-
console.log(
|
|
14597
|
-
console.log(
|
|
14593
|
+
console.log(chalk24.dim("\n No sources configured.\n"));
|
|
14594
|
+
console.log(chalk24.dim(" Add a source: ") + chalk24.hex("#83D1EB")(`${resolveCaliber()} sources add <path>`));
|
|
14595
|
+
console.log(chalk24.dim(" Or add to .caliber/sources.json manually.\n"));
|
|
14598
14596
|
return;
|
|
14599
14597
|
}
|
|
14600
|
-
console.log(
|
|
14598
|
+
console.log(chalk24.bold("\n External Sources\n"));
|
|
14601
14599
|
if (configSources.length > 0) {
|
|
14602
14600
|
for (const source of configSources) {
|
|
14603
14601
|
const sourcePath = source.path || source.url || "";
|
|
14604
14602
|
const exists = source.path ? fs48.existsSync(path39.resolve(dir, source.path)) : false;
|
|
14605
|
-
const status = exists ?
|
|
14603
|
+
const status = exists ? chalk24.green("reachable") : chalk24.red("not found");
|
|
14606
14604
|
const hasSummary = source.path && fs48.existsSync(path39.join(path39.resolve(dir, source.path), ".caliber", "summary.json"));
|
|
14607
|
-
console.log(` ${
|
|
14608
|
-
console.log(` Type: ${source.type} Status: ${status}${hasSummary ? " " +
|
|
14609
|
-
if (source.description) console.log(` ${
|
|
14605
|
+
console.log(` ${chalk24.bold(source.role || source.type)} ${chalk24.dim(sourcePath)}`);
|
|
14606
|
+
console.log(` Type: ${source.type} Status: ${status}${hasSummary ? " " + chalk24.cyan("has summary.json") : ""}`);
|
|
14607
|
+
if (source.description) console.log(` ${chalk24.dim(source.description)}`);
|
|
14610
14608
|
console.log("");
|
|
14611
14609
|
}
|
|
14612
14610
|
}
|
|
14613
14611
|
if (workspaces.length > 0) {
|
|
14614
|
-
console.log(
|
|
14612
|
+
console.log(chalk24.dim(" Auto-detected workspaces:"));
|
|
14615
14613
|
for (const ws of workspaces) {
|
|
14616
14614
|
const exists = fs48.existsSync(path39.resolve(dir, ws));
|
|
14617
|
-
console.log(` ${exists ?
|
|
14615
|
+
console.log(` ${exists ? chalk24.green("\u25CF") : chalk24.red("\u25CF")} ${ws}`);
|
|
14618
14616
|
}
|
|
14619
14617
|
console.log("");
|
|
14620
14618
|
}
|
|
@@ -14623,14 +14621,14 @@ async function sourcesAddCommand(sourcePath) {
|
|
|
14623
14621
|
const dir = process.cwd();
|
|
14624
14622
|
const absPath = path39.resolve(dir, sourcePath);
|
|
14625
14623
|
if (!fs48.existsSync(absPath)) {
|
|
14626
|
-
console.log(
|
|
14624
|
+
console.log(chalk24.red(`
|
|
14627
14625
|
Path not found: ${sourcePath}
|
|
14628
14626
|
`));
|
|
14629
14627
|
throw new Error("__exit__");
|
|
14630
14628
|
}
|
|
14631
14629
|
const type = detectSourceType(absPath);
|
|
14632
14630
|
if (isInsideDir(absPath, dir)) {
|
|
14633
|
-
console.log(
|
|
14631
|
+
console.log(chalk24.red(`
|
|
14634
14632
|
Cannot add a path inside the current project as a source.
|
|
14635
14633
|
`));
|
|
14636
14634
|
throw new Error("__exit__");
|
|
@@ -14640,7 +14638,7 @@ async function sourcesAddCommand(sourcePath) {
|
|
|
14640
14638
|
(s) => s.path && path39.resolve(dir, s.path) === absPath
|
|
14641
14639
|
);
|
|
14642
14640
|
if (alreadyConfigured) {
|
|
14643
|
-
console.log(
|
|
14641
|
+
console.log(chalk24.yellow(`
|
|
14644
14642
|
Already configured: ${sourcePath}
|
|
14645
14643
|
`));
|
|
14646
14644
|
return;
|
|
@@ -14657,7 +14655,7 @@ async function sourcesAddCommand(sourcePath) {
|
|
|
14657
14655
|
};
|
|
14658
14656
|
existing.push(newSource);
|
|
14659
14657
|
writeSourcesConfig(dir, existing);
|
|
14660
|
-
console.log(
|
|
14658
|
+
console.log(chalk24.green(`
|
|
14661
14659
|
\u2713 Added ${sourcePath} as ${type} source (${role})
|
|
14662
14660
|
`));
|
|
14663
14661
|
}
|
|
@@ -14668,18 +14666,18 @@ async function sourcesRemoveCommand(name) {
|
|
|
14668
14666
|
(s) => s.path?.includes(name) || s.role === name
|
|
14669
14667
|
);
|
|
14670
14668
|
if (idx === -1) {
|
|
14671
|
-
console.log(
|
|
14669
|
+
console.log(chalk24.red(`
|
|
14672
14670
|
Source not found: ${name}
|
|
14673
14671
|
`));
|
|
14674
|
-
console.log(
|
|
14672
|
+
console.log(chalk24.dim(" Available sources:"));
|
|
14675
14673
|
for (const s of existing) {
|
|
14676
|
-
console.log(
|
|
14674
|
+
console.log(chalk24.dim(` ${s.path || s.url} (${s.role || s.type})`));
|
|
14677
14675
|
}
|
|
14678
14676
|
throw new Error("__exit__");
|
|
14679
14677
|
}
|
|
14680
14678
|
const removed = existing.splice(idx, 1)[0];
|
|
14681
14679
|
writeSourcesConfig(dir, existing);
|
|
14682
|
-
console.log(
|
|
14680
|
+
console.log(chalk24.green(`
|
|
14683
14681
|
\u2713 Removed ${removed.path || removed.url} (${removed.role || removed.type})
|
|
14684
14682
|
`));
|
|
14685
14683
|
}
|
|
@@ -14687,7 +14685,7 @@ async function sourcesRemoveCommand(name) {
|
|
|
14687
14685
|
// src/commands/publish.ts
|
|
14688
14686
|
import fs49 from "fs";
|
|
14689
14687
|
import path40 from "path";
|
|
14690
|
-
import
|
|
14688
|
+
import chalk25 from "chalk";
|
|
14691
14689
|
import ora7 from "ora";
|
|
14692
14690
|
init_config();
|
|
14693
14691
|
init_resolve_caliber();
|
|
@@ -14695,7 +14693,7 @@ async function publishCommand() {
|
|
|
14695
14693
|
const dir = process.cwd();
|
|
14696
14694
|
const config = loadConfig();
|
|
14697
14695
|
if (!config) {
|
|
14698
|
-
console.log(
|
|
14696
|
+
console.log(chalk25.red("No LLM provider configured. Run ") + chalk25.hex("#83D1EB")(`${resolveCaliber()} config`) + chalk25.red(" first."));
|
|
14699
14697
|
throw new Error("__exit__");
|
|
14700
14698
|
}
|
|
14701
14699
|
const spinner = ora7("Generating project summary...").start();
|
|
@@ -14736,13 +14734,13 @@ async function publishCommand() {
|
|
|
14736
14734
|
const outputPath = path40.join(outputDir, "summary.json");
|
|
14737
14735
|
fs49.writeFileSync(outputPath, JSON.stringify(summary, null, 2) + "\n", "utf-8");
|
|
14738
14736
|
spinner.succeed("Project summary published");
|
|
14739
|
-
console.log(` ${
|
|
14740
|
-
console.log(
|
|
14741
|
-
console.log(
|
|
14737
|
+
console.log(` ${chalk25.green("\u2713")} ${path40.relative(dir, outputPath)}`);
|
|
14738
|
+
console.log(chalk25.dim("\n Other projects can now reference this repo as a source."));
|
|
14739
|
+
console.log(chalk25.dim(" When they run `caliber init`, they'll read this summary automatically.\n"));
|
|
14742
14740
|
} catch (err) {
|
|
14743
14741
|
spinner.fail("Failed to generate summary");
|
|
14744
14742
|
if (err instanceof Error && err.message === "__exit__") throw err;
|
|
14745
|
-
console.error(
|
|
14743
|
+
console.error(chalk25.red(err instanceof Error ? err.message : "Unknown error"));
|
|
14746
14744
|
throw new Error("__exit__");
|
|
14747
14745
|
}
|
|
14748
14746
|
}
|
|
@@ -14750,7 +14748,7 @@ async function publishCommand() {
|
|
|
14750
14748
|
// src/commands/bootstrap.ts
|
|
14751
14749
|
init_builtin_skills();
|
|
14752
14750
|
import fs50 from "fs";
|
|
14753
|
-
import
|
|
14751
|
+
import chalk26 from "chalk";
|
|
14754
14752
|
var PLATFORM_SKILL_DIRS = {
|
|
14755
14753
|
claude: ".claude/skills",
|
|
14756
14754
|
cursor: ".cursor/skills",
|
|
@@ -14776,21 +14774,21 @@ async function bootstrapCommand() {
|
|
|
14776
14774
|
}
|
|
14777
14775
|
}
|
|
14778
14776
|
if (written.length === 0) {
|
|
14779
|
-
console.log(
|
|
14777
|
+
console.log(chalk26.yellow("No skills were written."));
|
|
14780
14778
|
return;
|
|
14781
14779
|
}
|
|
14782
|
-
console.log(
|
|
14780
|
+
console.log(chalk26.bold.green("\n Caliber skills installed!\n"));
|
|
14783
14781
|
for (const file of written) {
|
|
14784
|
-
console.log(` ${
|
|
14782
|
+
console.log(` ${chalk26.green("\u2713")} ${file}`);
|
|
14785
14783
|
}
|
|
14786
|
-
console.log(
|
|
14787
|
-
console.log(
|
|
14784
|
+
console.log(chalk26.dim("\n Your agent can now run /setup-caliber to complete the setup."));
|
|
14785
|
+
console.log(chalk26.dim(' Just tell your agent: "Run /setup-caliber"\n'));
|
|
14788
14786
|
}
|
|
14789
14787
|
|
|
14790
14788
|
// src/commands/uninstall.ts
|
|
14791
14789
|
import fs51 from "fs";
|
|
14792
14790
|
import path41 from "path";
|
|
14793
|
-
import
|
|
14791
|
+
import chalk27 from "chalk";
|
|
14794
14792
|
import confirm3 from "@inquirer/confirm";
|
|
14795
14793
|
init_pre_commit_block();
|
|
14796
14794
|
init_builtin_skills();
|
|
@@ -14853,19 +14851,19 @@ function removeDirectory(dir) {
|
|
|
14853
14851
|
return true;
|
|
14854
14852
|
}
|
|
14855
14853
|
async function uninstallCommand(options) {
|
|
14856
|
-
console.log(
|
|
14857
|
-
console.log(
|
|
14858
|
-
console.log(
|
|
14859
|
-
console.log(
|
|
14860
|
-
console.log(
|
|
14861
|
-
console.log(
|
|
14862
|
-
console.log(
|
|
14863
|
-
console.log(
|
|
14864
|
-
console.log(
|
|
14854
|
+
console.log(chalk27.bold("\n Caliber Uninstall\n"));
|
|
14855
|
+
console.log(chalk27.dim(" This will remove all Caliber resources from this project:\n"));
|
|
14856
|
+
console.log(chalk27.dim(" \u2022 Pre-commit hook"));
|
|
14857
|
+
console.log(chalk27.dim(" \u2022 Session learning hooks"));
|
|
14858
|
+
console.log(chalk27.dim(" \u2022 Managed blocks in CLAUDE.md, AGENTS.md, copilot-instructions.md"));
|
|
14859
|
+
console.log(chalk27.dim(" \u2022 Cursor rules (caliber-*.mdc)"));
|
|
14860
|
+
console.log(chalk27.dim(" \u2022 Built-in skills (setup-caliber, find-skills, save-learning)"));
|
|
14861
|
+
console.log(chalk27.dim(" \u2022 CALIBER_LEARNINGS.md"));
|
|
14862
|
+
console.log(chalk27.dim(" \u2022 .caliber/ directory (backups, cache, state)\n"));
|
|
14865
14863
|
if (!options.force) {
|
|
14866
14864
|
const proceed = await confirm3({ message: "Continue with uninstall?" });
|
|
14867
14865
|
if (!proceed) {
|
|
14868
|
-
console.log(
|
|
14866
|
+
console.log(chalk27.dim("\n Cancelled.\n"));
|
|
14869
14867
|
return;
|
|
14870
14868
|
}
|
|
14871
14869
|
}
|
|
@@ -14873,65 +14871,65 @@ async function uninstallCommand(options) {
|
|
|
14873
14871
|
const actions = [];
|
|
14874
14872
|
const hookResult = removePreCommitHook();
|
|
14875
14873
|
if (hookResult.removed) {
|
|
14876
|
-
console.log(` ${
|
|
14874
|
+
console.log(` ${chalk27.red("\u2717")} Pre-commit hook removed`);
|
|
14877
14875
|
actions.push("pre-commit hook");
|
|
14878
14876
|
}
|
|
14879
14877
|
const stopHookResult = removeStopHook();
|
|
14880
14878
|
if (stopHookResult.removed) {
|
|
14881
|
-
console.log(` ${
|
|
14879
|
+
console.log(` ${chalk27.red("\u2717")} Onboarding hook removed`);
|
|
14882
14880
|
actions.push("onboarding hook");
|
|
14883
14881
|
}
|
|
14884
14882
|
const notificationHookResult = removeNotificationHook();
|
|
14885
14883
|
if (notificationHookResult.removed) {
|
|
14886
|
-
console.log(` ${
|
|
14884
|
+
console.log(` ${chalk27.red("\u2717")} Notification hook removed`);
|
|
14887
14885
|
actions.push("notification hook");
|
|
14888
14886
|
}
|
|
14889
14887
|
const sessionStartResult = removeSessionStartHook();
|
|
14890
14888
|
if (sessionStartResult.removed) {
|
|
14891
|
-
console.log(` ${
|
|
14889
|
+
console.log(` ${chalk27.red("\u2717")} SessionStart hook removed`);
|
|
14892
14890
|
actions.push("session-start hook");
|
|
14893
14891
|
}
|
|
14894
14892
|
const learnResult = removeLearningHooks();
|
|
14895
14893
|
if (learnResult.removed) {
|
|
14896
|
-
console.log(` ${
|
|
14894
|
+
console.log(` ${chalk27.red("\u2717")} Claude Code learning hooks removed`);
|
|
14897
14895
|
actions.push("claude learning hooks");
|
|
14898
14896
|
}
|
|
14899
14897
|
const cursorLearnResult = removeCursorLearningHooks();
|
|
14900
14898
|
if (cursorLearnResult.removed) {
|
|
14901
|
-
console.log(` ${
|
|
14899
|
+
console.log(` ${chalk27.red("\u2717")} Cursor learning hooks removed`);
|
|
14902
14900
|
actions.push("cursor learning hooks");
|
|
14903
14901
|
}
|
|
14904
14902
|
const strippedFiles = stripManagedBlocksFromFiles();
|
|
14905
14903
|
for (const file of strippedFiles) {
|
|
14906
|
-
console.log(` ${
|
|
14904
|
+
console.log(` ${chalk27.yellow("~")} ${file} \u2014 managed blocks removed`);
|
|
14907
14905
|
actions.push(file);
|
|
14908
14906
|
}
|
|
14909
14907
|
const removedCursorRules = removeCaliberManagedFiles(CURSOR_RULES_DIR, ".mdc");
|
|
14910
14908
|
for (const rule of removedCursorRules) {
|
|
14911
|
-
console.log(` ${
|
|
14909
|
+
console.log(` ${chalk27.red("\u2717")} ${rule}`);
|
|
14912
14910
|
}
|
|
14913
14911
|
if (removedCursorRules.length > 0) actions.push("cursor rules");
|
|
14914
14912
|
const removedClaudeRules = removeCaliberManagedFiles(CLAUDE_RULES_DIR, ".md");
|
|
14915
14913
|
for (const rule of removedClaudeRules) {
|
|
14916
|
-
console.log(` ${
|
|
14914
|
+
console.log(` ${chalk27.red("\u2717")} ${rule}`);
|
|
14917
14915
|
}
|
|
14918
14916
|
if (removedClaudeRules.length > 0) actions.push("claude rules");
|
|
14919
14917
|
const removedSkills = removeBuiltinSkills();
|
|
14920
14918
|
for (const skill of removedSkills) {
|
|
14921
|
-
console.log(` ${
|
|
14919
|
+
console.log(` ${chalk27.red("\u2717")} ${skill}/`);
|
|
14922
14920
|
}
|
|
14923
14921
|
if (removedSkills.length > 0) actions.push("builtin skills");
|
|
14924
14922
|
if (fs51.existsSync("CALIBER_LEARNINGS.md")) {
|
|
14925
14923
|
fs51.unlinkSync("CALIBER_LEARNINGS.md");
|
|
14926
|
-
console.log(` ${
|
|
14924
|
+
console.log(` ${chalk27.red("\u2717")} CALIBER_LEARNINGS.md`);
|
|
14927
14925
|
actions.push("learnings file");
|
|
14928
14926
|
}
|
|
14929
14927
|
if (removeDirectory(CALIBER_DIR)) {
|
|
14930
|
-
console.log(` ${
|
|
14928
|
+
console.log(` ${chalk27.red("\u2717")} .caliber/ directory`);
|
|
14931
14929
|
actions.push(".caliber directory");
|
|
14932
14930
|
}
|
|
14933
14931
|
if (actions.length === 0) {
|
|
14934
|
-
console.log(
|
|
14932
|
+
console.log(chalk27.dim(" Nothing to remove \u2014 Caliber is not installed in this project.\n"));
|
|
14935
14933
|
return;
|
|
14936
14934
|
}
|
|
14937
14935
|
trackUninstallExecuted();
|
|
@@ -14943,7 +14941,7 @@ async function uninstallCommand(options) {
|
|
|
14943
14941
|
});
|
|
14944
14942
|
if (removeConfig) {
|
|
14945
14943
|
fs51.unlinkSync(configPath);
|
|
14946
|
-
console.log(` ${
|
|
14944
|
+
console.log(` ${chalk27.red("\u2717")} ${configPath}`);
|
|
14947
14945
|
const configDir = path41.dirname(configPath);
|
|
14948
14946
|
try {
|
|
14949
14947
|
const remaining = fs51.readdirSync(configDir);
|
|
@@ -14952,9 +14950,9 @@ async function uninstallCommand(options) {
|
|
|
14952
14950
|
}
|
|
14953
14951
|
}
|
|
14954
14952
|
}
|
|
14955
|
-
console.log(
|
|
14953
|
+
console.log(chalk27.bold.green(`
|
|
14956
14954
|
Caliber has been removed from this project.`));
|
|
14957
|
-
console.log(
|
|
14955
|
+
console.log(chalk27.dim(" Your code is untouched \u2014 only Caliber config files were removed.\n"));
|
|
14958
14956
|
}
|
|
14959
14957
|
|
|
14960
14958
|
// src/cli.ts
|
|
@@ -15074,7 +15072,7 @@ import fs53 from "fs";
|
|
|
15074
15072
|
import path43 from "path";
|
|
15075
15073
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
15076
15074
|
import { execSync as execSync18, execFileSync as execFileSync5 } from "child_process";
|
|
15077
|
-
import
|
|
15075
|
+
import chalk28 from "chalk";
|
|
15078
15076
|
import ora8 from "ora";
|
|
15079
15077
|
import confirm4 from "@inquirer/confirm";
|
|
15080
15078
|
var __dirname_vc = path43.dirname(fileURLToPath2(import.meta.url));
|
|
@@ -15131,16 +15129,16 @@ async function checkForUpdates() {
|
|
|
15131
15129
|
if (!isInteractive) {
|
|
15132
15130
|
const installTag = channel === "latest" ? "" : `@${channel}`;
|
|
15133
15131
|
console.log(
|
|
15134
|
-
|
|
15132
|
+
chalk28.yellow(
|
|
15135
15133
|
`
|
|
15136
15134
|
Update available: ${current} -> ${latest}
|
|
15137
|
-
Run ${
|
|
15135
|
+
Run ${chalk28.bold(`npm install -g @rely-ai/caliber${installTag}`)} to upgrade.
|
|
15138
15136
|
`
|
|
15139
15137
|
)
|
|
15140
15138
|
);
|
|
15141
15139
|
return;
|
|
15142
15140
|
}
|
|
15143
|
-
console.log(
|
|
15141
|
+
console.log(chalk28.yellow(`
|
|
15144
15142
|
Update available: ${current} -> ${latest}`));
|
|
15145
15143
|
const shouldUpdate = await confirm4({
|
|
15146
15144
|
message: "Would you like to update now? (Y/n)",
|
|
@@ -15163,14 +15161,14 @@ Update available: ${current} -> ${latest}`));
|
|
|
15163
15161
|
if (installed !== latest) {
|
|
15164
15162
|
spinner.fail(`Update incomplete \u2014 got ${installed ?? "unknown"}, expected ${latest}`);
|
|
15165
15163
|
console.log(
|
|
15166
|
-
|
|
15164
|
+
chalk28.yellow(`Run ${chalk28.bold(`npm install -g @rely-ai/caliber@${tag}`)} manually.
|
|
15167
15165
|
`)
|
|
15168
15166
|
);
|
|
15169
15167
|
return;
|
|
15170
15168
|
}
|
|
15171
|
-
spinner.succeed(
|
|
15169
|
+
spinner.succeed(chalk28.green(`Updated to ${latest}`));
|
|
15172
15170
|
const args = process.argv.slice(2);
|
|
15173
|
-
console.log(
|
|
15171
|
+
console.log(chalk28.dim(`
|
|
15174
15172
|
Restarting: caliber ${args.join(" ")}
|
|
15175
15173
|
`));
|
|
15176
15174
|
execFileSync5("caliber", args, {
|
|
@@ -15183,11 +15181,11 @@ Restarting: caliber ${args.join(" ")}
|
|
|
15183
15181
|
if (err instanceof Error) {
|
|
15184
15182
|
const stderr = err.stderr;
|
|
15185
15183
|
const errMsg = stderr ? String(stderr).trim().split("\n").pop() : err.message.split("\n")[0];
|
|
15186
|
-
if (errMsg && !errMsg.includes("SIGTERM")) console.log(
|
|
15184
|
+
if (errMsg && !errMsg.includes("SIGTERM")) console.log(chalk28.dim(` ${errMsg}`));
|
|
15187
15185
|
}
|
|
15188
15186
|
console.log(
|
|
15189
|
-
|
|
15190
|
-
`Run ${
|
|
15187
|
+
chalk28.yellow(
|
|
15188
|
+
`Run ${chalk28.bold(`npm install -g @rely-ai/caliber@${tag}`)} manually to upgrade.
|
|
15191
15189
|
`
|
|
15192
15190
|
)
|
|
15193
15191
|
);
|