@rely-ai/caliber 1.20.0-dev.1773690306 → 1.20.0-dev.1773691540
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 +477 -252
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -227,7 +227,7 @@ import { fileURLToPath } from "url";
|
|
|
227
227
|
|
|
228
228
|
// src/commands/init.ts
|
|
229
229
|
import path20 from "path";
|
|
230
|
-
import
|
|
230
|
+
import chalk11 from "chalk";
|
|
231
231
|
import ora2 from "ora";
|
|
232
232
|
import select5 from "@inquirer/select";
|
|
233
233
|
import checkbox from "@inquirer/checkbox";
|
|
@@ -5331,12 +5331,12 @@ var AGENT_DISPLAY_NAMES = {
|
|
|
5331
5331
|
codex: "Codex"
|
|
5332
5332
|
};
|
|
5333
5333
|
var CATEGORY_LABELS = {
|
|
5334
|
-
existence: "FILES & SETUP",
|
|
5335
|
-
quality: "QUALITY",
|
|
5336
|
-
grounding: "GROUNDING",
|
|
5337
|
-
accuracy: "ACCURACY",
|
|
5338
|
-
freshness: "FRESHNESS & SAFETY",
|
|
5339
|
-
bonus: "BONUS"
|
|
5334
|
+
existence: { icon: "\u{1F4C1}", label: "FILES & SETUP" },
|
|
5335
|
+
quality: { icon: "\u26A1", label: "QUALITY" },
|
|
5336
|
+
grounding: { icon: "\u{1F3AF}", label: "GROUNDING" },
|
|
5337
|
+
accuracy: { icon: "\u{1F50D}", label: "ACCURACY" },
|
|
5338
|
+
freshness: { icon: "\u{1F6E1}\uFE0F", label: "FRESHNESS & SAFETY" },
|
|
5339
|
+
bonus: { icon: "\u2B50", label: "BONUS" }
|
|
5340
5340
|
};
|
|
5341
5341
|
var CATEGORY_ORDER = ["existence", "quality", "grounding", "accuracy", "freshness", "bonus"];
|
|
5342
5342
|
function gradeColor(grade) {
|
|
@@ -5355,20 +5355,51 @@ function gradeColor(grade) {
|
|
|
5355
5355
|
return chalk6.white;
|
|
5356
5356
|
}
|
|
5357
5357
|
}
|
|
5358
|
+
var GRADIENT_COLORS = ["#ef4444", "#f97316", "#eab308", "#22c55e"];
|
|
5358
5359
|
function progressBar(score, max, width = 40) {
|
|
5359
5360
|
const filled = Math.round(score / max * width);
|
|
5360
5361
|
const empty = width - filled;
|
|
5361
|
-
|
|
5362
|
+
let bar = "";
|
|
5363
|
+
for (let i = 0; i < filled; i++) {
|
|
5364
|
+
const position = i / (width - 1);
|
|
5365
|
+
const colorIndex = Math.min(
|
|
5366
|
+
GRADIENT_COLORS.length - 1,
|
|
5367
|
+
Math.floor(position * GRADIENT_COLORS.length)
|
|
5368
|
+
);
|
|
5369
|
+
bar += chalk6.hex(GRADIENT_COLORS[colorIndex])("\u2593");
|
|
5370
|
+
}
|
|
5371
|
+
bar += chalk6.gray("\u2591".repeat(empty));
|
|
5362
5372
|
return bar;
|
|
5363
5373
|
}
|
|
5364
5374
|
function formatCheck(check) {
|
|
5365
|
-
const
|
|
5366
|
-
const
|
|
5367
|
-
const
|
|
5375
|
+
const isPartial = !check.passed && check.earnedPoints > 0;
|
|
5376
|
+
const isNegative = check.earnedPoints < 0;
|
|
5377
|
+
const lostPoints = check.maxPoints - check.earnedPoints;
|
|
5378
|
+
const icon = check.passed ? chalk6.green("\u2713") : isPartial ? chalk6.yellow("~") : isNegative ? chalk6.red("\u2717") : chalk6.gray("\u2717");
|
|
5379
|
+
let points;
|
|
5380
|
+
if (check.passed) {
|
|
5381
|
+
points = chalk6.green(`+${check.earnedPoints}`.padStart(4));
|
|
5382
|
+
} else if (isNegative) {
|
|
5383
|
+
points = chalk6.red(`${check.earnedPoints}`.padStart(4));
|
|
5384
|
+
} else if (isPartial) {
|
|
5385
|
+
points = chalk6.yellow(`${check.earnedPoints}/${check.maxPoints}`.padStart(5));
|
|
5386
|
+
} else {
|
|
5387
|
+
points = chalk6.gray(`0/${check.maxPoints}`.padStart(5));
|
|
5388
|
+
}
|
|
5389
|
+
const name = check.passed ? chalk6.white(check.name) : isNegative ? chalk6.red(check.name) : isPartial ? chalk6.white(check.name) : chalk6.gray(check.name);
|
|
5368
5390
|
const detail = check.detail ? chalk6.gray(` (${check.detail})`) : "";
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5391
|
+
let suggestion = "";
|
|
5392
|
+
if (!check.passed && check.suggestion) {
|
|
5393
|
+
const suggColor = isNegative ? chalk6.red : chalk6.yellow;
|
|
5394
|
+
suggestion = suggColor(`
|
|
5395
|
+
\u2192 ${check.suggestion}`);
|
|
5396
|
+
}
|
|
5397
|
+
let recovery = "";
|
|
5398
|
+
if (isPartial && lostPoints > 0) {
|
|
5399
|
+
recovery = chalk6.yellow(`
|
|
5400
|
+
\u2191 Fix this for +${lostPoints} more points`);
|
|
5401
|
+
}
|
|
5402
|
+
return ` ${icon} ${name.padEnd(38)}${points}${detail}${suggestion}${recovery}`;
|
|
5372
5403
|
}
|
|
5373
5404
|
function displayScore(result) {
|
|
5374
5405
|
const gc = gradeColor(result.grade);
|
|
@@ -5385,14 +5416,32 @@ function displayScore(result) {
|
|
|
5385
5416
|
for (const category of CATEGORY_ORDER) {
|
|
5386
5417
|
const summary = result.categories[category];
|
|
5387
5418
|
const categoryChecks = result.checks.filter((c) => c.category === category);
|
|
5419
|
+
const { icon, label } = CATEGORY_LABELS[category];
|
|
5420
|
+
const gap = summary.max - summary.earned;
|
|
5421
|
+
const gapLabel = gap > 0 ? chalk6.yellow(` (-${gap} available)`) : "";
|
|
5388
5422
|
console.log(
|
|
5389
|
-
chalk6.gray(` ${
|
|
5423
|
+
chalk6.gray(` ${icon} ${label}`) + chalk6.gray(" ".repeat(Math.max(1, 43 - label.length))) + chalk6.white(`${summary.earned}`) + chalk6.gray(` / ${summary.max}`) + gapLabel
|
|
5390
5424
|
);
|
|
5391
5425
|
for (const check of categoryChecks) {
|
|
5392
5426
|
console.log(formatCheck(check));
|
|
5393
5427
|
}
|
|
5394
5428
|
console.log("");
|
|
5395
5429
|
}
|
|
5430
|
+
formatTopImprovements(result.checks);
|
|
5431
|
+
}
|
|
5432
|
+
function formatTopImprovements(checks) {
|
|
5433
|
+
const improvable = checks.filter((c) => c.earnedPoints < c.maxPoints).map((c) => ({ name: c.name, potential: c.maxPoints - c.earnedPoints })).sort((a, b) => b.potential - a.potential).slice(0, 5);
|
|
5434
|
+
if (improvable.length === 0) return;
|
|
5435
|
+
console.log(chalk6.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"));
|
|
5436
|
+
console.log("");
|
|
5437
|
+
for (let i = 0; i < improvable.length; i++) {
|
|
5438
|
+
const item = improvable[i];
|
|
5439
|
+
const num = chalk6.gray(`${i + 1}.`);
|
|
5440
|
+
const label = chalk6.white(item.name.padEnd(42));
|
|
5441
|
+
const pts = chalk6.yellow(`+${item.potential} pts`);
|
|
5442
|
+
console.log(` ${num} ${label}${pts}`);
|
|
5443
|
+
}
|
|
5444
|
+
console.log("");
|
|
5396
5445
|
}
|
|
5397
5446
|
function displayScoreSummary(result) {
|
|
5398
5447
|
const gc = gradeColor(result.grade);
|
|
@@ -6467,9 +6516,101 @@ function formatMs(ms) {
|
|
|
6467
6516
|
}
|
|
6468
6517
|
|
|
6469
6518
|
// src/utils/parallel-tasks.ts
|
|
6519
|
+
import chalk10 from "chalk";
|
|
6520
|
+
|
|
6521
|
+
// src/utils/waiting-content.ts
|
|
6470
6522
|
import chalk9 from "chalk";
|
|
6523
|
+
|
|
6524
|
+
// src/utils/waiting-cards.json
|
|
6525
|
+
var waiting_cards_default = [
|
|
6526
|
+
{
|
|
6527
|
+
title: "What is Caliber?",
|
|
6528
|
+
icon: "?",
|
|
6529
|
+
lines: [
|
|
6530
|
+
"Caliber scans your project and generates tailored configs",
|
|
6531
|
+
"for Claude Code, Cursor, and Codex \u2014 so your AI agent",
|
|
6532
|
+
"understands your codebase from the start."
|
|
6533
|
+
]
|
|
6534
|
+
},
|
|
6535
|
+
{
|
|
6536
|
+
title: "Generated Configs",
|
|
6537
|
+
icon: "\u2699",
|
|
6538
|
+
lines: [
|
|
6539
|
+
"CLAUDE.md and .cursor/rules/ tell your AI agent about",
|
|
6540
|
+
"your build commands, conventions, architecture, and tools.",
|
|
6541
|
+
"Think of them as onboarding docs \u2014 but for your copilot."
|
|
6542
|
+
]
|
|
6543
|
+
},
|
|
6544
|
+
{
|
|
6545
|
+
title: "Skills",
|
|
6546
|
+
icon: "\u26A1",
|
|
6547
|
+
lines: [
|
|
6548
|
+
"Skills are reusable task-specific instructions your agent",
|
|
6549
|
+
"loads on demand \u2014 deploy scripts, migration patterns, etc.",
|
|
6550
|
+
"Run `caliber skills` to search the community registry."
|
|
6551
|
+
]
|
|
6552
|
+
},
|
|
6553
|
+
{
|
|
6554
|
+
title: "Keep Configs Fresh",
|
|
6555
|
+
icon: "\u21BB",
|
|
6556
|
+
lines: [
|
|
6557
|
+
"As your code evolves, configs drift. `caliber refresh`",
|
|
6558
|
+
"reads your recent git diffs and updates configs to match.",
|
|
6559
|
+
"Add it as a post-commit hook for hands-free updates."
|
|
6560
|
+
]
|
|
6561
|
+
},
|
|
6562
|
+
{
|
|
6563
|
+
title: "Score Your Setup",
|
|
6564
|
+
icon: "\u2605",
|
|
6565
|
+
lines: [
|
|
6566
|
+
"`caliber score` runs 20+ checks against your config \u2014",
|
|
6567
|
+
"grounding, accuracy, freshness \u2014 and gives a letter grade.",
|
|
6568
|
+
"Aim for an A to get the most out of your AI agent."
|
|
6569
|
+
]
|
|
6570
|
+
},
|
|
6571
|
+
{
|
|
6572
|
+
title: "Quick Health Check",
|
|
6573
|
+
icon: "\u2764",
|
|
6574
|
+
lines: [
|
|
6575
|
+
"`caliber status` shows what you have configured,",
|
|
6576
|
+
"which hooks are active, and if anything needs attention.",
|
|
6577
|
+
"It runs in under a second \u2014 great for CI checks too."
|
|
6578
|
+
]
|
|
6579
|
+
}
|
|
6580
|
+
];
|
|
6581
|
+
|
|
6582
|
+
// src/utils/waiting-content.ts
|
|
6583
|
+
var ACCENT = chalk9.hex("#83D1EB");
|
|
6584
|
+
var BRAND = chalk9.hex("#EB9D83");
|
|
6585
|
+
var WAITING_CARDS = waiting_cards_default;
|
|
6586
|
+
function highlightCommands(text) {
|
|
6587
|
+
return text.replace(/`([^`]+)`/g, (_, cmd) => ACCENT(cmd));
|
|
6588
|
+
}
|
|
6589
|
+
function renderCard(card, index, total, cols) {
|
|
6590
|
+
const prefix = " ";
|
|
6591
|
+
const maxWidth = Math.min(cols - 8, 65);
|
|
6592
|
+
const lines = [];
|
|
6593
|
+
lines.push(chalk9.dim(`${prefix}${"\u2500".repeat(maxWidth)}`));
|
|
6594
|
+
lines.push("");
|
|
6595
|
+
const dots = Array.from(
|
|
6596
|
+
{ length: total },
|
|
6597
|
+
(_, i) => i === index ? ACCENT("\u25CF") : chalk9.dim("\u25CB")
|
|
6598
|
+
).join(" ");
|
|
6599
|
+
lines.push(`${prefix}${chalk9.dim("While you wait...")} ${dots}`);
|
|
6600
|
+
lines.push("");
|
|
6601
|
+
lines.push(`${prefix}${BRAND(card.icon)} ${chalk9.bold(card.title)}`);
|
|
6602
|
+
for (const line of card.lines) {
|
|
6603
|
+
lines.push(`${prefix} ${chalk9.dim(highlightCommands(line))}`);
|
|
6604
|
+
}
|
|
6605
|
+
lines.push("");
|
|
6606
|
+
lines.push(`${prefix}${chalk9.dim("\u2190 \u2192 navigate auto-advances every 15s")}`);
|
|
6607
|
+
return lines;
|
|
6608
|
+
}
|
|
6609
|
+
|
|
6610
|
+
// src/utils/parallel-tasks.ts
|
|
6471
6611
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
6472
6612
|
var SPINNER_INTERVAL_MS = 80;
|
|
6613
|
+
var CARD_ADVANCE_MS = 15e3;
|
|
6473
6614
|
var NAME_COL_WIDTH = 26;
|
|
6474
6615
|
var PREFIX = " ";
|
|
6475
6616
|
var ParallelTaskDisplay = class {
|
|
@@ -6479,6 +6620,14 @@ var ParallelTaskDisplay = class {
|
|
|
6479
6620
|
timer = null;
|
|
6480
6621
|
startTime = 0;
|
|
6481
6622
|
rendered = false;
|
|
6623
|
+
waitingEnabled = false;
|
|
6624
|
+
waitingCards = [];
|
|
6625
|
+
currentCard = 0;
|
|
6626
|
+
cardTimer = null;
|
|
6627
|
+
keypressHandler = null;
|
|
6628
|
+
cachedCardLines = null;
|
|
6629
|
+
cachedCardIndex = -1;
|
|
6630
|
+
cachedCardCols = -1;
|
|
6482
6631
|
add(name) {
|
|
6483
6632
|
const index = this.tasks.length;
|
|
6484
6633
|
this.tasks.push({ name, status: "pending", message: "" });
|
|
@@ -6504,13 +6653,78 @@ var ParallelTaskDisplay = class {
|
|
|
6504
6653
|
task.status = status;
|
|
6505
6654
|
if (message !== void 0) task.message = message;
|
|
6506
6655
|
}
|
|
6656
|
+
enableWaitingContent() {
|
|
6657
|
+
if (!process.stdin.isTTY) return;
|
|
6658
|
+
this.waitingCards = WAITING_CARDS;
|
|
6659
|
+
if (this.waitingCards.length === 0) return;
|
|
6660
|
+
this.waitingEnabled = true;
|
|
6661
|
+
this.currentCard = 0;
|
|
6662
|
+
this.cardTimer = setInterval(() => {
|
|
6663
|
+
this.advanceCard(1);
|
|
6664
|
+
}, CARD_ADVANCE_MS);
|
|
6665
|
+
const { stdin } = process;
|
|
6666
|
+
stdin.setRawMode(true);
|
|
6667
|
+
stdin.resume();
|
|
6668
|
+
stdin.setEncoding("utf8");
|
|
6669
|
+
this.keypressHandler = (key) => {
|
|
6670
|
+
const str = String(key);
|
|
6671
|
+
switch (str) {
|
|
6672
|
+
case "\x1B[C":
|
|
6673
|
+
case "n":
|
|
6674
|
+
this.advanceCard(1);
|
|
6675
|
+
this.resetCardTimer();
|
|
6676
|
+
break;
|
|
6677
|
+
case "\x1B[D":
|
|
6678
|
+
case "p":
|
|
6679
|
+
this.advanceCard(-1);
|
|
6680
|
+
this.resetCardTimer();
|
|
6681
|
+
break;
|
|
6682
|
+
case "":
|
|
6683
|
+
this.disableWaitingContent();
|
|
6684
|
+
process.kill(process.pid, "SIGINT");
|
|
6685
|
+
break;
|
|
6686
|
+
}
|
|
6687
|
+
};
|
|
6688
|
+
stdin.on("data", this.keypressHandler);
|
|
6689
|
+
}
|
|
6507
6690
|
stop() {
|
|
6691
|
+
this.disableWaitingContent();
|
|
6508
6692
|
if (this.timer) {
|
|
6509
6693
|
clearInterval(this.timer);
|
|
6510
6694
|
this.timer = null;
|
|
6511
6695
|
}
|
|
6512
6696
|
this.draw(false);
|
|
6513
6697
|
}
|
|
6698
|
+
advanceCard(offset) {
|
|
6699
|
+
this.currentCard = (this.currentCard + offset + this.waitingCards.length) % this.waitingCards.length;
|
|
6700
|
+
this.cachedCardLines = null;
|
|
6701
|
+
}
|
|
6702
|
+
disableWaitingContent() {
|
|
6703
|
+
if (!this.waitingEnabled) return;
|
|
6704
|
+
if (this.cardTimer) {
|
|
6705
|
+
clearInterval(this.cardTimer);
|
|
6706
|
+
this.cardTimer = null;
|
|
6707
|
+
}
|
|
6708
|
+
if (this.keypressHandler) {
|
|
6709
|
+
const { stdin } = process;
|
|
6710
|
+
stdin.removeListener("data", this.keypressHandler);
|
|
6711
|
+
if (stdin.isTTY) {
|
|
6712
|
+
stdin.setRawMode(false);
|
|
6713
|
+
stdin.pause();
|
|
6714
|
+
}
|
|
6715
|
+
this.keypressHandler = null;
|
|
6716
|
+
}
|
|
6717
|
+
this.waitingEnabled = false;
|
|
6718
|
+
this.cachedCardLines = null;
|
|
6719
|
+
}
|
|
6720
|
+
resetCardTimer() {
|
|
6721
|
+
if (this.cardTimer) {
|
|
6722
|
+
clearInterval(this.cardTimer);
|
|
6723
|
+
this.cardTimer = setInterval(() => {
|
|
6724
|
+
this.advanceCard(1);
|
|
6725
|
+
}, CARD_ADVANCE_MS);
|
|
6726
|
+
}
|
|
6727
|
+
}
|
|
6514
6728
|
formatTime(ms) {
|
|
6515
6729
|
const secs = Math.floor(ms / 1e3);
|
|
6516
6730
|
if (secs < 60) return `${secs}s`;
|
|
@@ -6526,31 +6740,31 @@ var ParallelTaskDisplay = class {
|
|
|
6526
6740
|
renderLine(task) {
|
|
6527
6741
|
const cols = process.stdout.columns || 80;
|
|
6528
6742
|
const elapsed = task.startTime ? this.formatTime((task.endTime ?? Date.now()) - task.startTime) : "";
|
|
6529
|
-
const timeStr = elapsed ? ` ${
|
|
6743
|
+
const timeStr = elapsed ? ` ${chalk10.dim(elapsed)}` : "";
|
|
6530
6744
|
const timePlain = elapsed ? ` ${elapsed}` : "";
|
|
6531
6745
|
let icon;
|
|
6532
6746
|
let nameStyle;
|
|
6533
6747
|
let msgStyle;
|
|
6534
6748
|
switch (task.status) {
|
|
6535
6749
|
case "pending":
|
|
6536
|
-
icon =
|
|
6537
|
-
nameStyle =
|
|
6538
|
-
msgStyle =
|
|
6750
|
+
icon = chalk10.dim("\u25CB");
|
|
6751
|
+
nameStyle = chalk10.dim;
|
|
6752
|
+
msgStyle = chalk10.dim;
|
|
6539
6753
|
break;
|
|
6540
6754
|
case "running":
|
|
6541
|
-
icon =
|
|
6542
|
-
nameStyle =
|
|
6543
|
-
msgStyle =
|
|
6755
|
+
icon = chalk10.cyan(SPINNER_FRAMES[this.spinnerFrame]);
|
|
6756
|
+
nameStyle = chalk10.white;
|
|
6757
|
+
msgStyle = chalk10.dim;
|
|
6544
6758
|
break;
|
|
6545
6759
|
case "done":
|
|
6546
|
-
icon =
|
|
6547
|
-
nameStyle =
|
|
6548
|
-
msgStyle =
|
|
6760
|
+
icon = chalk10.green("\u2713");
|
|
6761
|
+
nameStyle = chalk10.white;
|
|
6762
|
+
msgStyle = chalk10.dim;
|
|
6549
6763
|
break;
|
|
6550
6764
|
case "failed":
|
|
6551
|
-
icon =
|
|
6552
|
-
nameStyle =
|
|
6553
|
-
msgStyle =
|
|
6765
|
+
icon = chalk10.red("\u2717");
|
|
6766
|
+
nameStyle = chalk10.white;
|
|
6767
|
+
msgStyle = chalk10.red;
|
|
6554
6768
|
break;
|
|
6555
6769
|
}
|
|
6556
6770
|
const paddedName = task.name.padEnd(NAME_COL_WIDTH);
|
|
@@ -6566,6 +6780,16 @@ var ParallelTaskDisplay = class {
|
|
|
6566
6780
|
}
|
|
6567
6781
|
stdout.write("\x1B[0J");
|
|
6568
6782
|
const lines = this.tasks.map((t) => this.renderLine(t));
|
|
6783
|
+
if (this.waitingEnabled && this.waitingCards.length > 0 && stdout.isTTY) {
|
|
6784
|
+
const cols = stdout.columns || 80;
|
|
6785
|
+
if (this.currentCard !== this.cachedCardIndex || cols !== this.cachedCardCols || !this.cachedCardLines) {
|
|
6786
|
+
const card = this.waitingCards[this.currentCard];
|
|
6787
|
+
this.cachedCardLines = renderCard(card, this.currentCard, this.waitingCards.length, cols);
|
|
6788
|
+
this.cachedCardIndex = this.currentCard;
|
|
6789
|
+
this.cachedCardCols = cols;
|
|
6790
|
+
}
|
|
6791
|
+
lines.push(...this.cachedCardLines);
|
|
6792
|
+
}
|
|
6569
6793
|
const output = lines.join("\n");
|
|
6570
6794
|
stdout.write(output + "\n");
|
|
6571
6795
|
this.lineCount = output.split("\n").length;
|
|
@@ -6575,11 +6799,11 @@ var ParallelTaskDisplay = class {
|
|
|
6575
6799
|
|
|
6576
6800
|
// src/commands/init.ts
|
|
6577
6801
|
function log(verbose, ...args) {
|
|
6578
|
-
if (verbose) console.log(
|
|
6802
|
+
if (verbose) console.log(chalk11.dim(` [verbose] ${args.map(String).join(" ")}`));
|
|
6579
6803
|
}
|
|
6580
6804
|
async function initCommand(options) {
|
|
6581
|
-
const brand =
|
|
6582
|
-
const title =
|
|
6805
|
+
const brand = chalk11.hex("#EB9D83");
|
|
6806
|
+
const title = chalk11.hex("#83D1EB");
|
|
6583
6807
|
console.log(brand.bold(`
|
|
6584
6808
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
6585
6809
|
\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
@@ -6588,33 +6812,33 @@ async function initCommand(options) {
|
|
|
6588
6812
|
\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
6589
6813
|
\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
|
|
6590
6814
|
`));
|
|
6591
|
-
console.log(
|
|
6592
|
-
console.log(
|
|
6815
|
+
console.log(chalk11.dim(" Scan your project and generate tailored config files for"));
|
|
6816
|
+
console.log(chalk11.dim(" Claude Code, Cursor, and Codex.\n"));
|
|
6593
6817
|
const report = options.debugReport ? new DebugReport() : null;
|
|
6594
6818
|
console.log(title.bold(" How it works:\n"));
|
|
6595
|
-
console.log(
|
|
6596
|
-
console.log(
|
|
6597
|
-
console.log(
|
|
6598
|
-
console.log(
|
|
6819
|
+
console.log(chalk11.dim(" 1. Setup Connect your LLM provider and select your agents"));
|
|
6820
|
+
console.log(chalk11.dim(" 2. Engine Detect stack, generate configs & skills in parallel"));
|
|
6821
|
+
console.log(chalk11.dim(" 3. Review See all changes \u2014 accept, refine, or decline"));
|
|
6822
|
+
console.log(chalk11.dim(" 4. Finalize Score check and auto-sync hooks\n"));
|
|
6599
6823
|
console.log(title.bold(" Step 1/4 \u2014 Setup\n"));
|
|
6600
6824
|
let config = loadConfig();
|
|
6601
6825
|
if (!config) {
|
|
6602
|
-
console.log(
|
|
6826
|
+
console.log(chalk11.dim(" No LLM provider configured yet.\n"));
|
|
6603
6827
|
await runInteractiveProviderSetup({
|
|
6604
6828
|
selectMessage: "How do you want to use Caliber? (choose LLM provider)"
|
|
6605
6829
|
});
|
|
6606
6830
|
config = loadConfig();
|
|
6607
6831
|
if (!config) {
|
|
6608
|
-
console.log(
|
|
6832
|
+
console.log(chalk11.red(" Setup was cancelled or failed.\n"));
|
|
6609
6833
|
throw new Error("__exit__");
|
|
6610
6834
|
}
|
|
6611
|
-
console.log(
|
|
6835
|
+
console.log(chalk11.green(" \u2713 Provider saved\n"));
|
|
6612
6836
|
}
|
|
6613
6837
|
trackInitProviderSelected(config.provider, config.model);
|
|
6614
6838
|
const displayModel = getDisplayModel(config);
|
|
6615
6839
|
const fastModel = getFastModel();
|
|
6616
6840
|
const modelLine = fastModel ? ` Provider: ${config.provider} | Model: ${displayModel} | Scan: ${fastModel}` : ` Provider: ${config.provider} | Model: ${displayModel}`;
|
|
6617
|
-
console.log(
|
|
6841
|
+
console.log(chalk11.dim(modelLine + "\n"));
|
|
6618
6842
|
if (report) {
|
|
6619
6843
|
report.markStep("Provider setup");
|
|
6620
6844
|
report.addSection("LLM Provider", `- **Provider**: ${config.provider}
|
|
@@ -6631,7 +6855,7 @@ async function initCommand(options) {
|
|
|
6631
6855
|
} else {
|
|
6632
6856
|
targetAgent = await promptAgent();
|
|
6633
6857
|
}
|
|
6634
|
-
console.log(
|
|
6858
|
+
console.log(chalk11.dim(` Target: ${targetAgent.join(", ")}
|
|
6635
6859
|
`));
|
|
6636
6860
|
trackInitAgentSelected(targetAgent);
|
|
6637
6861
|
let wantsSkills = false;
|
|
@@ -6645,7 +6869,7 @@ async function initCommand(options) {
|
|
|
6645
6869
|
});
|
|
6646
6870
|
}
|
|
6647
6871
|
let baselineScore = computeLocalScore(process.cwd(), targetAgent);
|
|
6648
|
-
console.log(
|
|
6872
|
+
console.log(chalk11.dim("\n Current setup score:"));
|
|
6649
6873
|
displayScoreSummary(baselineScore);
|
|
6650
6874
|
if (options.verbose) {
|
|
6651
6875
|
for (const c of baselineScore.checks) {
|
|
@@ -6674,29 +6898,29 @@ async function initCommand(options) {
|
|
|
6674
6898
|
const failingCount = baselineScore.checks.filter((c) => !c.passed).length;
|
|
6675
6899
|
if (hasExistingConfig && baselineScore.score === 100) {
|
|
6676
6900
|
trackInitScoreComputed(baselineScore.score, passingCount, failingCount, true);
|
|
6677
|
-
console.log(
|
|
6678
|
-
console.log(
|
|
6901
|
+
console.log(chalk11.bold.green(" Your setup is already optimal \u2014 nothing to change.\n"));
|
|
6902
|
+
console.log(chalk11.dim(" Run ") + chalk11.hex("#83D1EB")("caliber init --force") + chalk11.dim(" to regenerate anyway.\n"));
|
|
6679
6903
|
if (!options.force) return;
|
|
6680
6904
|
}
|
|
6681
6905
|
const allFailingChecks = baselineScore.checks.filter((c) => !c.passed && c.maxPoints > 0);
|
|
6682
6906
|
const llmFixableChecks = allFailingChecks.filter((c) => !NON_LLM_CHECKS.has(c.id));
|
|
6683
6907
|
trackInitScoreComputed(baselineScore.score, passingCount, failingCount, false);
|
|
6684
6908
|
if (hasExistingConfig && llmFixableChecks.length === 0 && allFailingChecks.length > 0 && !options.force) {
|
|
6685
|
-
console.log(
|
|
6686
|
-
console.log(
|
|
6909
|
+
console.log(chalk11.bold.green("\n Your config is fully optimized for LLM generation.\n"));
|
|
6910
|
+
console.log(chalk11.dim(" Remaining items need CLI actions:\n"));
|
|
6687
6911
|
for (const check of allFailingChecks) {
|
|
6688
|
-
console.log(
|
|
6912
|
+
console.log(chalk11.dim(` \u2022 ${check.name}`));
|
|
6689
6913
|
if (check.suggestion) {
|
|
6690
|
-
console.log(` ${
|
|
6914
|
+
console.log(` ${chalk11.hex("#83D1EB")(check.suggestion)}`);
|
|
6691
6915
|
}
|
|
6692
6916
|
}
|
|
6693
6917
|
console.log("");
|
|
6694
|
-
console.log(
|
|
6918
|
+
console.log(chalk11.dim(" Run ") + chalk11.hex("#83D1EB")("caliber init --force") + chalk11.dim(" to regenerate anyway.\n"));
|
|
6695
6919
|
return;
|
|
6696
6920
|
}
|
|
6697
6921
|
console.log(title.bold(" Step 2/4 \u2014 Engine\n"));
|
|
6698
6922
|
const genModelInfo = fastModel ? ` Using ${displayModel} for docs, ${fastModel} for skills` : ` Using ${displayModel}`;
|
|
6699
|
-
console.log(
|
|
6923
|
+
console.log(chalk11.dim(genModelInfo + "\n"));
|
|
6700
6924
|
if (report) report.markStep("Generation");
|
|
6701
6925
|
trackInitGenerationStarted(false);
|
|
6702
6926
|
const genStartTime = Date.now();
|
|
@@ -6711,6 +6935,7 @@ async function initCommand(options) {
|
|
|
6711
6935
|
const TASK_SKILLS_GEN = display.add("Generating skills");
|
|
6712
6936
|
const TASK_SKILLS_SEARCH = wantsSkills ? display.add("Searching community skills") : -1;
|
|
6713
6937
|
display.start();
|
|
6938
|
+
display.enableWaitingContent();
|
|
6714
6939
|
try {
|
|
6715
6940
|
display.update(TASK_STACK, "running");
|
|
6716
6941
|
fingerprint = await collectFingerprint(process.cwd());
|
|
@@ -6820,7 +7045,7 @@ async function initCommand(options) {
|
|
|
6820
7045
|
} catch (err) {
|
|
6821
7046
|
display.stop();
|
|
6822
7047
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
6823
|
-
console.log(
|
|
7048
|
+
console.log(chalk11.red(`
|
|
6824
7049
|
Engine failed: ${msg}
|
|
6825
7050
|
`));
|
|
6826
7051
|
writeErrorLog(config, void 0, msg, "exception");
|
|
@@ -6832,15 +7057,15 @@ async function initCommand(options) {
|
|
|
6832
7057
|
const mins = Math.floor(elapsedMs / 6e4);
|
|
6833
7058
|
const secs = Math.floor(elapsedMs % 6e4 / 1e3);
|
|
6834
7059
|
const timeStr = mins > 0 ? `${mins}m ${secs}s` : `${secs}s`;
|
|
6835
|
-
console.log(
|
|
7060
|
+
console.log(chalk11.dim(`
|
|
6836
7061
|
Done in ${timeStr}
|
|
6837
7062
|
`));
|
|
6838
7063
|
if (!generatedSetup) {
|
|
6839
|
-
console.log(
|
|
7064
|
+
console.log(chalk11.red(" Failed to generate setup."));
|
|
6840
7065
|
writeErrorLog(config, rawOutput, void 0, genStopReason);
|
|
6841
7066
|
if (rawOutput) {
|
|
6842
|
-
console.log(
|
|
6843
|
-
console.log(
|
|
7067
|
+
console.log(chalk11.dim("\nRaw LLM output (JSON parse failed):"));
|
|
7068
|
+
console.log(chalk11.dim(rawOutput.slice(0, 500)));
|
|
6844
7069
|
}
|
|
6845
7070
|
throw new Error("__exit__");
|
|
6846
7071
|
}
|
|
@@ -6859,9 +7084,9 @@ async function initCommand(options) {
|
|
|
6859
7084
|
const setupFiles = collectSetupFiles(generatedSetup, targetAgent);
|
|
6860
7085
|
const staged = stageFiles(setupFiles, process.cwd());
|
|
6861
7086
|
const totalChanges = staged.newFiles + staged.modifiedFiles;
|
|
6862
|
-
console.log(
|
|
7087
|
+
console.log(chalk11.dim(` ${chalk11.green(`${staged.newFiles} new`)} / ${chalk11.yellow(`${staged.modifiedFiles} modified`)} file${totalChanges !== 1 ? "s" : ""}`));
|
|
6863
7088
|
if (skillSearchResult.results.length > 0) {
|
|
6864
|
-
console.log(
|
|
7089
|
+
console.log(chalk11.dim(` ${chalk11.cyan(`${skillSearchResult.results.length}`)} community skills available to install
|
|
6865
7090
|
`));
|
|
6866
7091
|
} else {
|
|
6867
7092
|
console.log("");
|
|
@@ -6869,7 +7094,7 @@ async function initCommand(options) {
|
|
|
6869
7094
|
const hasSkillResults = skillSearchResult.results.length > 0;
|
|
6870
7095
|
let action;
|
|
6871
7096
|
if (totalChanges === 0 && !hasSkillResults) {
|
|
6872
|
-
console.log(
|
|
7097
|
+
console.log(chalk11.dim(" No changes needed \u2014 your configs are already up to date.\n"));
|
|
6873
7098
|
cleanupStaging();
|
|
6874
7099
|
action = "accept";
|
|
6875
7100
|
} else if (options.autoApprove) {
|
|
@@ -6901,12 +7126,12 @@ async function initCommand(options) {
|
|
|
6901
7126
|
trackInitRefinementRound(refinementRound, !!generatedSetup);
|
|
6902
7127
|
if (!generatedSetup) {
|
|
6903
7128
|
cleanupStaging();
|
|
6904
|
-
console.log(
|
|
7129
|
+
console.log(chalk11.dim("Refinement cancelled. No files were modified."));
|
|
6905
7130
|
return;
|
|
6906
7131
|
}
|
|
6907
7132
|
const updatedFiles = collectSetupFiles(generatedSetup, targetAgent);
|
|
6908
7133
|
const restaged = stageFiles(updatedFiles, process.cwd());
|
|
6909
|
-
console.log(
|
|
7134
|
+
console.log(chalk11.dim(` ${chalk11.green(`${restaged.newFiles} new`)} / ${chalk11.yellow(`${restaged.modifiedFiles} modified`)} file${restaged.newFiles + restaged.modifiedFiles !== 1 ? "s" : ""}
|
|
6910
7135
|
`));
|
|
6911
7136
|
printSetupSummary(generatedSetup);
|
|
6912
7137
|
await openReview("terminal", restaged.stagedFiles);
|
|
@@ -6915,12 +7140,12 @@ async function initCommand(options) {
|
|
|
6915
7140
|
}
|
|
6916
7141
|
cleanupStaging();
|
|
6917
7142
|
if (action === "decline") {
|
|
6918
|
-
console.log(
|
|
7143
|
+
console.log(chalk11.dim("Setup declined. No files were modified."));
|
|
6919
7144
|
return;
|
|
6920
7145
|
}
|
|
6921
7146
|
console.log(title.bold("\n Step 4/4 \u2014 Finalize\n"));
|
|
6922
7147
|
if (options.dryRun) {
|
|
6923
|
-
console.log(
|
|
7148
|
+
console.log(chalk11.yellow("\n[Dry run] Would write the following files:"));
|
|
6924
7149
|
console.log(JSON.stringify(generatedSetup, null, 2));
|
|
6925
7150
|
return;
|
|
6926
7151
|
}
|
|
@@ -6949,23 +7174,23 @@ ${agentRefs.join(" ")}
|
|
|
6949
7174
|
0,
|
|
6950
7175
|
result.deleted.length
|
|
6951
7176
|
);
|
|
6952
|
-
console.log(
|
|
7177
|
+
console.log(chalk11.bold("\nFiles created/updated:"));
|
|
6953
7178
|
for (const file of result.written) {
|
|
6954
|
-
console.log(` ${
|
|
7179
|
+
console.log(` ${chalk11.green("\u2713")} ${file}`);
|
|
6955
7180
|
}
|
|
6956
7181
|
if (result.deleted.length > 0) {
|
|
6957
|
-
console.log(
|
|
7182
|
+
console.log(chalk11.bold("\nFiles removed:"));
|
|
6958
7183
|
for (const file of result.deleted) {
|
|
6959
|
-
console.log(` ${
|
|
7184
|
+
console.log(` ${chalk11.red("\u2717")} ${file}`);
|
|
6960
7185
|
}
|
|
6961
7186
|
}
|
|
6962
7187
|
if (result.backupDir) {
|
|
6963
|
-
console.log(
|
|
7188
|
+
console.log(chalk11.dim(`
|
|
6964
7189
|
Backups saved to ${result.backupDir}`));
|
|
6965
7190
|
}
|
|
6966
7191
|
} catch (err) {
|
|
6967
7192
|
writeSpinner.fail("Failed to write files");
|
|
6968
|
-
console.error(
|
|
7193
|
+
console.error(chalk11.red(err instanceof Error ? err.message : "Unknown error"));
|
|
6969
7194
|
throw new Error("__exit__");
|
|
6970
7195
|
}
|
|
6971
7196
|
if (fingerprint) ensurePermissions(fingerprint);
|
|
@@ -6979,15 +7204,15 @@ ${agentRefs.join(" ")}
|
|
|
6979
7204
|
if (afterScore.score < baselineScore.score) {
|
|
6980
7205
|
trackInitScoreRegression(baselineScore.score, afterScore.score);
|
|
6981
7206
|
console.log("");
|
|
6982
|
-
console.log(
|
|
7207
|
+
console.log(chalk11.yellow(` Score would drop from ${baselineScore.score} to ${afterScore.score} \u2014 reverting changes.`));
|
|
6983
7208
|
try {
|
|
6984
7209
|
const { restored, removed } = undoSetup();
|
|
6985
7210
|
if (restored.length > 0 || removed.length > 0) {
|
|
6986
|
-
console.log(
|
|
7211
|
+
console.log(chalk11.dim(` Reverted ${restored.length + removed.length} file${restored.length + removed.length === 1 ? "" : "s"} from backup.`));
|
|
6987
7212
|
}
|
|
6988
7213
|
} catch {
|
|
6989
7214
|
}
|
|
6990
|
-
console.log(
|
|
7215
|
+
console.log(chalk11.dim(" Run ") + chalk11.hex("#83D1EB")("caliber init --force") + chalk11.dim(" to override.\n"));
|
|
6991
7216
|
return;
|
|
6992
7217
|
}
|
|
6993
7218
|
if (report) {
|
|
@@ -7006,7 +7231,7 @@ ${agentRefs.join(" ")}
|
|
|
7006
7231
|
}
|
|
7007
7232
|
}
|
|
7008
7233
|
if (skillSearchResult.results.length > 0 && !options.autoApprove) {
|
|
7009
|
-
console.log(
|
|
7234
|
+
console.log(chalk11.dim(" Community skills matched to your project:\n"));
|
|
7010
7235
|
const selected = await interactiveSelect(skillSearchResult.results);
|
|
7011
7236
|
if (selected?.length) {
|
|
7012
7237
|
await installSkills(selected, targetAgent, skillSearchResult.contentMap);
|
|
@@ -7025,37 +7250,37 @@ ${agentRefs.join(" ")}
|
|
|
7025
7250
|
if (hookChoice === "claude" || hookChoice === "both") {
|
|
7026
7251
|
const hookResult = installHook();
|
|
7027
7252
|
if (hookResult.installed) {
|
|
7028
|
-
console.log(` ${
|
|
7029
|
-
console.log(
|
|
7253
|
+
console.log(` ${chalk11.green("\u2713")} Claude Code hook installed \u2014 docs update on session end`);
|
|
7254
|
+
console.log(chalk11.dim(" Run ") + chalk11.hex("#83D1EB")("caliber hooks --remove") + chalk11.dim(" to disable"));
|
|
7030
7255
|
} else if (hookResult.alreadyInstalled) {
|
|
7031
|
-
console.log(
|
|
7256
|
+
console.log(chalk11.dim(" Claude Code hook already installed"));
|
|
7032
7257
|
}
|
|
7033
7258
|
const learnResult = installLearningHooks();
|
|
7034
7259
|
if (learnResult.installed) {
|
|
7035
|
-
console.log(` ${
|
|
7036
|
-
console.log(
|
|
7260
|
+
console.log(` ${chalk11.green("\u2713")} Learning hooks installed \u2014 session insights captured automatically`);
|
|
7261
|
+
console.log(chalk11.dim(" Run ") + chalk11.hex("#83D1EB")("caliber learn remove") + chalk11.dim(" to disable"));
|
|
7037
7262
|
} else if (learnResult.alreadyInstalled) {
|
|
7038
|
-
console.log(
|
|
7263
|
+
console.log(chalk11.dim(" Learning hooks already installed"));
|
|
7039
7264
|
}
|
|
7040
7265
|
}
|
|
7041
7266
|
if (hookChoice === "precommit" || hookChoice === "both") {
|
|
7042
7267
|
const precommitResult = installPreCommitHook();
|
|
7043
7268
|
if (precommitResult.installed) {
|
|
7044
|
-
console.log(` ${
|
|
7045
|
-
console.log(
|
|
7269
|
+
console.log(` ${chalk11.green("\u2713")} Pre-commit hook installed \u2014 docs refresh before each commit`);
|
|
7270
|
+
console.log(chalk11.dim(" Run ") + chalk11.hex("#83D1EB")("caliber hooks --remove") + chalk11.dim(" to disable"));
|
|
7046
7271
|
} else if (precommitResult.alreadyInstalled) {
|
|
7047
|
-
console.log(
|
|
7272
|
+
console.log(chalk11.dim(" Pre-commit hook already installed"));
|
|
7048
7273
|
} else {
|
|
7049
|
-
console.log(
|
|
7274
|
+
console.log(chalk11.yellow(" Could not install pre-commit hook (not a git repository?)"));
|
|
7050
7275
|
}
|
|
7051
7276
|
}
|
|
7052
7277
|
if (hookChoice === "skip") {
|
|
7053
|
-
console.log(
|
|
7278
|
+
console.log(chalk11.dim(" Skipped auto-sync hooks. Run ") + chalk11.hex("#83D1EB")("caliber hooks --install") + chalk11.dim(" later to enable."));
|
|
7054
7279
|
}
|
|
7055
|
-
console.log(
|
|
7056
|
-
console.log(
|
|
7057
|
-
console.log(
|
|
7058
|
-
console.log(
|
|
7280
|
+
console.log(chalk11.bold.green("\n Setup complete!"));
|
|
7281
|
+
console.log(chalk11.dim(" Your AI agents now understand your project's architecture, build commands,"));
|
|
7282
|
+
console.log(chalk11.dim(" testing patterns, and conventions. All changes are backed up automatically.\n"));
|
|
7283
|
+
console.log(chalk11.bold(" Next steps:\n"));
|
|
7059
7284
|
console.log(` ${title("caliber score")} See your full config breakdown`);
|
|
7060
7285
|
console.log(` ${title("caliber refresh")} Update docs after code changes`);
|
|
7061
7286
|
console.log(` ${title("caliber hooks")} Toggle auto-refresh hooks`);
|
|
@@ -7069,7 +7294,7 @@ ${agentRefs.join(" ")}
|
|
|
7069
7294
|
report.markStep("Finished");
|
|
7070
7295
|
const reportPath = path20.join(process.cwd(), ".caliber", "debug-report.md");
|
|
7071
7296
|
report.write(reportPath);
|
|
7072
|
-
console.log(
|
|
7297
|
+
console.log(chalk11.dim(` Debug report written to ${path20.relative(process.cwd(), reportPath)}
|
|
7073
7298
|
`));
|
|
7074
7299
|
}
|
|
7075
7300
|
}
|
|
@@ -7084,9 +7309,9 @@ async function refineLoop(currentSetup, _targetAgent, sessionHistory) {
|
|
|
7084
7309
|
}
|
|
7085
7310
|
const isValid = await classifyRefineIntent(message);
|
|
7086
7311
|
if (!isValid) {
|
|
7087
|
-
console.log(
|
|
7088
|
-
console.log(
|
|
7089
|
-
console.log(
|
|
7312
|
+
console.log(chalk11.dim(" This doesn't look like a config change request."));
|
|
7313
|
+
console.log(chalk11.dim(" Describe what to add, remove, or modify in your configs."));
|
|
7314
|
+
console.log(chalk11.dim(' Type "done" to accept the current setup.\n'));
|
|
7090
7315
|
continue;
|
|
7091
7316
|
}
|
|
7092
7317
|
const refineSpinner = ora2("Refining setup...").start();
|
|
@@ -7107,10 +7332,10 @@ async function refineLoop(currentSetup, _targetAgent, sessionHistory) {
|
|
|
7107
7332
|
});
|
|
7108
7333
|
refineSpinner.succeed("Setup updated");
|
|
7109
7334
|
printSetupSummary(refined);
|
|
7110
|
-
console.log(
|
|
7335
|
+
console.log(chalk11.dim('Type "done" to accept, or describe more changes.'));
|
|
7111
7336
|
} else {
|
|
7112
7337
|
refineSpinner.fail("Refinement failed \u2014 could not parse AI response.");
|
|
7113
|
-
console.log(
|
|
7338
|
+
console.log(chalk11.dim('Try rephrasing your request, or type "done" to keep the current setup.'));
|
|
7114
7339
|
}
|
|
7115
7340
|
}
|
|
7116
7341
|
}
|
|
@@ -7225,26 +7450,26 @@ function printSetupSummary(setup) {
|
|
|
7225
7450
|
const fileDescriptions = setup.fileDescriptions;
|
|
7226
7451
|
const deletions = setup.deletions;
|
|
7227
7452
|
console.log("");
|
|
7228
|
-
console.log(
|
|
7453
|
+
console.log(chalk11.bold(" Your tailored setup:\n"));
|
|
7229
7454
|
const getDescription = (filePath) => {
|
|
7230
7455
|
return fileDescriptions?.[filePath];
|
|
7231
7456
|
};
|
|
7232
7457
|
if (claude) {
|
|
7233
7458
|
if (claude.claudeMd) {
|
|
7234
|
-
const icon = fs25.existsSync("CLAUDE.md") ?
|
|
7459
|
+
const icon = fs25.existsSync("CLAUDE.md") ? chalk11.yellow("~") : chalk11.green("+");
|
|
7235
7460
|
const desc = getDescription("CLAUDE.md");
|
|
7236
|
-
console.log(` ${icon} ${
|
|
7237
|
-
if (desc) console.log(
|
|
7461
|
+
console.log(` ${icon} ${chalk11.bold("CLAUDE.md")}`);
|
|
7462
|
+
if (desc) console.log(chalk11.dim(` ${desc}`));
|
|
7238
7463
|
console.log("");
|
|
7239
7464
|
}
|
|
7240
7465
|
const skills = claude.skills;
|
|
7241
7466
|
if (Array.isArray(skills) && skills.length > 0) {
|
|
7242
7467
|
for (const skill of skills) {
|
|
7243
7468
|
const skillPath = `.claude/skills/${skill.name}/SKILL.md`;
|
|
7244
|
-
const icon = fs25.existsSync(skillPath) ?
|
|
7469
|
+
const icon = fs25.existsSync(skillPath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
7245
7470
|
const desc = getDescription(skillPath);
|
|
7246
|
-
console.log(` ${icon} ${
|
|
7247
|
-
console.log(
|
|
7471
|
+
console.log(` ${icon} ${chalk11.bold(skillPath)}`);
|
|
7472
|
+
console.log(chalk11.dim(` ${desc || skill.description || skill.name}`));
|
|
7248
7473
|
console.log("");
|
|
7249
7474
|
}
|
|
7250
7475
|
}
|
|
@@ -7252,40 +7477,40 @@ function printSetupSummary(setup) {
|
|
|
7252
7477
|
const codex = setup.codex;
|
|
7253
7478
|
if (codex) {
|
|
7254
7479
|
if (codex.agentsMd) {
|
|
7255
|
-
const icon = fs25.existsSync("AGENTS.md") ?
|
|
7480
|
+
const icon = fs25.existsSync("AGENTS.md") ? chalk11.yellow("~") : chalk11.green("+");
|
|
7256
7481
|
const desc = getDescription("AGENTS.md");
|
|
7257
|
-
console.log(` ${icon} ${
|
|
7258
|
-
if (desc) console.log(
|
|
7482
|
+
console.log(` ${icon} ${chalk11.bold("AGENTS.md")}`);
|
|
7483
|
+
if (desc) console.log(chalk11.dim(` ${desc}`));
|
|
7259
7484
|
console.log("");
|
|
7260
7485
|
}
|
|
7261
7486
|
const codexSkills = codex.skills;
|
|
7262
7487
|
if (Array.isArray(codexSkills) && codexSkills.length > 0) {
|
|
7263
7488
|
for (const skill of codexSkills) {
|
|
7264
7489
|
const skillPath = `.agents/skills/${skill.name}/SKILL.md`;
|
|
7265
|
-
const icon = fs25.existsSync(skillPath) ?
|
|
7490
|
+
const icon = fs25.existsSync(skillPath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
7266
7491
|
const desc = getDescription(skillPath);
|
|
7267
|
-
console.log(` ${icon} ${
|
|
7268
|
-
console.log(
|
|
7492
|
+
console.log(` ${icon} ${chalk11.bold(skillPath)}`);
|
|
7493
|
+
console.log(chalk11.dim(` ${desc || skill.description || skill.name}`));
|
|
7269
7494
|
console.log("");
|
|
7270
7495
|
}
|
|
7271
7496
|
}
|
|
7272
7497
|
}
|
|
7273
7498
|
if (cursor) {
|
|
7274
7499
|
if (cursor.cursorrules) {
|
|
7275
|
-
const icon = fs25.existsSync(".cursorrules") ?
|
|
7500
|
+
const icon = fs25.existsSync(".cursorrules") ? chalk11.yellow("~") : chalk11.green("+");
|
|
7276
7501
|
const desc = getDescription(".cursorrules");
|
|
7277
|
-
console.log(` ${icon} ${
|
|
7278
|
-
if (desc) console.log(
|
|
7502
|
+
console.log(` ${icon} ${chalk11.bold(".cursorrules")}`);
|
|
7503
|
+
if (desc) console.log(chalk11.dim(` ${desc}`));
|
|
7279
7504
|
console.log("");
|
|
7280
7505
|
}
|
|
7281
7506
|
const cursorSkills = cursor.skills;
|
|
7282
7507
|
if (Array.isArray(cursorSkills) && cursorSkills.length > 0) {
|
|
7283
7508
|
for (const skill of cursorSkills) {
|
|
7284
7509
|
const skillPath = `.cursor/skills/${skill.name}/SKILL.md`;
|
|
7285
|
-
const icon = fs25.existsSync(skillPath) ?
|
|
7510
|
+
const icon = fs25.existsSync(skillPath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
7286
7511
|
const desc = getDescription(skillPath);
|
|
7287
|
-
console.log(` ${icon} ${
|
|
7288
|
-
console.log(
|
|
7512
|
+
console.log(` ${icon} ${chalk11.bold(skillPath)}`);
|
|
7513
|
+
console.log(chalk11.dim(` ${desc || skill.description || skill.name}`));
|
|
7289
7514
|
console.log("");
|
|
7290
7515
|
}
|
|
7291
7516
|
}
|
|
@@ -7293,14 +7518,14 @@ function printSetupSummary(setup) {
|
|
|
7293
7518
|
if (Array.isArray(rules) && rules.length > 0) {
|
|
7294
7519
|
for (const rule of rules) {
|
|
7295
7520
|
const rulePath = `.cursor/rules/${rule.filename}`;
|
|
7296
|
-
const icon = fs25.existsSync(rulePath) ?
|
|
7521
|
+
const icon = fs25.existsSync(rulePath) ? chalk11.yellow("~") : chalk11.green("+");
|
|
7297
7522
|
const desc = getDescription(rulePath);
|
|
7298
|
-
console.log(` ${icon} ${
|
|
7523
|
+
console.log(` ${icon} ${chalk11.bold(rulePath)}`);
|
|
7299
7524
|
if (desc) {
|
|
7300
|
-
console.log(
|
|
7525
|
+
console.log(chalk11.dim(` ${desc}`));
|
|
7301
7526
|
} else {
|
|
7302
7527
|
const firstLine = rule.content.split("\n").filter((l) => l.trim() && !l.trim().startsWith("#"))[0];
|
|
7303
|
-
if (firstLine) console.log(
|
|
7528
|
+
if (firstLine) console.log(chalk11.dim(` ${firstLine.trim().slice(0, 80)}`));
|
|
7304
7529
|
}
|
|
7305
7530
|
console.log("");
|
|
7306
7531
|
}
|
|
@@ -7308,12 +7533,12 @@ function printSetupSummary(setup) {
|
|
|
7308
7533
|
}
|
|
7309
7534
|
if (Array.isArray(deletions) && deletions.length > 0) {
|
|
7310
7535
|
for (const del of deletions) {
|
|
7311
|
-
console.log(` ${
|
|
7312
|
-
console.log(
|
|
7536
|
+
console.log(` ${chalk11.red("-")} ${chalk11.bold(del.filePath)}`);
|
|
7537
|
+
console.log(chalk11.dim(` ${del.reason}`));
|
|
7313
7538
|
console.log("");
|
|
7314
7539
|
}
|
|
7315
7540
|
}
|
|
7316
|
-
console.log(` ${
|
|
7541
|
+
console.log(` ${chalk11.green("+")} ${chalk11.dim("new")} ${chalk11.yellow("~")} ${chalk11.dim("modified")} ${chalk11.red("-")} ${chalk11.dim("removed")}`);
|
|
7317
7542
|
console.log("");
|
|
7318
7543
|
}
|
|
7319
7544
|
function derivePermissions(fingerprint) {
|
|
@@ -7373,20 +7598,20 @@ function ensurePermissions(fingerprint) {
|
|
|
7373
7598
|
function displayTokenUsage() {
|
|
7374
7599
|
const summary = getUsageSummary();
|
|
7375
7600
|
if (summary.length === 0) {
|
|
7376
|
-
console.log(
|
|
7601
|
+
console.log(chalk11.dim(" Token tracking not available for this provider.\n"));
|
|
7377
7602
|
return;
|
|
7378
7603
|
}
|
|
7379
|
-
console.log(
|
|
7604
|
+
console.log(chalk11.bold(" Token usage:\n"));
|
|
7380
7605
|
let totalIn = 0;
|
|
7381
7606
|
let totalOut = 0;
|
|
7382
7607
|
for (const m of summary) {
|
|
7383
7608
|
totalIn += m.inputTokens;
|
|
7384
7609
|
totalOut += m.outputTokens;
|
|
7385
|
-
const cacheInfo = m.cacheReadTokens > 0 || m.cacheWriteTokens > 0 ?
|
|
7386
|
-
console.log(` ${
|
|
7610
|
+
const cacheInfo = m.cacheReadTokens > 0 || m.cacheWriteTokens > 0 ? chalk11.dim(` (cache: ${m.cacheReadTokens.toLocaleString()} read, ${m.cacheWriteTokens.toLocaleString()} write)`) : "";
|
|
7611
|
+
console.log(` ${chalk11.dim(m.model)}: ${m.inputTokens.toLocaleString()} in / ${m.outputTokens.toLocaleString()} out (${m.calls} call${m.calls === 1 ? "" : "s"})${cacheInfo}`);
|
|
7387
7612
|
}
|
|
7388
7613
|
if (summary.length > 1) {
|
|
7389
|
-
console.log(` ${
|
|
7614
|
+
console.log(` ${chalk11.dim("Total")}: ${totalIn.toLocaleString()} in / ${totalOut.toLocaleString()} out`);
|
|
7390
7615
|
}
|
|
7391
7616
|
console.log("");
|
|
7392
7617
|
}
|
|
@@ -7407,14 +7632,14 @@ function writeErrorLog(config, rawOutput, error, stopReason) {
|
|
|
7407
7632
|
lines.push("## Raw LLM Output", "```", rawOutput || "(empty)", "```");
|
|
7408
7633
|
fs25.mkdirSync(path20.join(process.cwd(), ".caliber"), { recursive: true });
|
|
7409
7634
|
fs25.writeFileSync(logPath, lines.join("\n"));
|
|
7410
|
-
console.log(
|
|
7635
|
+
console.log(chalk11.dim(`
|
|
7411
7636
|
Error log written to .caliber/error-log.md`));
|
|
7412
7637
|
} catch {
|
|
7413
7638
|
}
|
|
7414
7639
|
}
|
|
7415
7640
|
|
|
7416
7641
|
// src/commands/undo.ts
|
|
7417
|
-
import
|
|
7642
|
+
import chalk12 from "chalk";
|
|
7418
7643
|
import ora3 from "ora";
|
|
7419
7644
|
function undoCommand() {
|
|
7420
7645
|
const spinner = ora3("Reverting setup...").start();
|
|
@@ -7427,26 +7652,26 @@ function undoCommand() {
|
|
|
7427
7652
|
trackUndoExecuted();
|
|
7428
7653
|
spinner.succeed("Setup reverted successfully.\n");
|
|
7429
7654
|
if (restored.length > 0) {
|
|
7430
|
-
console.log(
|
|
7655
|
+
console.log(chalk12.cyan(" Restored from backup:"));
|
|
7431
7656
|
for (const file of restored) {
|
|
7432
|
-
console.log(` ${
|
|
7657
|
+
console.log(` ${chalk12.green("\u21A9")} ${file}`);
|
|
7433
7658
|
}
|
|
7434
7659
|
}
|
|
7435
7660
|
if (removed.length > 0) {
|
|
7436
|
-
console.log(
|
|
7661
|
+
console.log(chalk12.cyan(" Removed:"));
|
|
7437
7662
|
for (const file of removed) {
|
|
7438
|
-
console.log(` ${
|
|
7663
|
+
console.log(` ${chalk12.red("\u2717")} ${file}`);
|
|
7439
7664
|
}
|
|
7440
7665
|
}
|
|
7441
7666
|
console.log("");
|
|
7442
7667
|
} catch (err) {
|
|
7443
|
-
spinner.fail(
|
|
7668
|
+
spinner.fail(chalk12.red(err instanceof Error ? err.message : "Undo failed"));
|
|
7444
7669
|
throw new Error("__exit__");
|
|
7445
7670
|
}
|
|
7446
7671
|
}
|
|
7447
7672
|
|
|
7448
7673
|
// src/commands/status.ts
|
|
7449
|
-
import
|
|
7674
|
+
import chalk13 from "chalk";
|
|
7450
7675
|
import fs26 from "fs";
|
|
7451
7676
|
init_config();
|
|
7452
7677
|
async function statusCommand(options) {
|
|
@@ -7461,40 +7686,40 @@ async function statusCommand(options) {
|
|
|
7461
7686
|
}, null, 2));
|
|
7462
7687
|
return;
|
|
7463
7688
|
}
|
|
7464
|
-
console.log(
|
|
7689
|
+
console.log(chalk13.bold("\nCaliber Status\n"));
|
|
7465
7690
|
if (config) {
|
|
7466
|
-
console.log(` LLM: ${
|
|
7691
|
+
console.log(` LLM: ${chalk13.green(config.provider)} (${config.model})`);
|
|
7467
7692
|
} else {
|
|
7468
|
-
console.log(` LLM: ${
|
|
7693
|
+
console.log(` LLM: ${chalk13.yellow("Not configured")} \u2014 run ${chalk13.hex("#83D1EB")("caliber config")}`);
|
|
7469
7694
|
}
|
|
7470
7695
|
if (!manifest) {
|
|
7471
|
-
console.log(` Setup: ${
|
|
7472
|
-
console.log(
|
|
7696
|
+
console.log(` Setup: ${chalk13.dim("No setup applied")}`);
|
|
7697
|
+
console.log(chalk13.dim("\n Run ") + chalk13.hex("#83D1EB")("caliber init") + chalk13.dim(" to get started.\n"));
|
|
7473
7698
|
return;
|
|
7474
7699
|
}
|
|
7475
|
-
console.log(` Files managed: ${
|
|
7700
|
+
console.log(` Files managed: ${chalk13.cyan(manifest.entries.length.toString())}`);
|
|
7476
7701
|
for (const entry of manifest.entries) {
|
|
7477
7702
|
const exists = fs26.existsSync(entry.path);
|
|
7478
|
-
const icon = exists ?
|
|
7703
|
+
const icon = exists ? chalk13.green("\u2713") : chalk13.red("\u2717");
|
|
7479
7704
|
console.log(` ${icon} ${entry.path} (${entry.action})`);
|
|
7480
7705
|
}
|
|
7481
7706
|
console.log("");
|
|
7482
7707
|
}
|
|
7483
7708
|
|
|
7484
7709
|
// src/commands/regenerate.ts
|
|
7485
|
-
import
|
|
7710
|
+
import chalk14 from "chalk";
|
|
7486
7711
|
import ora4 from "ora";
|
|
7487
7712
|
import select6 from "@inquirer/select";
|
|
7488
7713
|
init_config();
|
|
7489
7714
|
async function regenerateCommand(options) {
|
|
7490
7715
|
const config = loadConfig();
|
|
7491
7716
|
if (!config) {
|
|
7492
|
-
console.log(
|
|
7717
|
+
console.log(chalk14.red("No LLM provider configured. Run ") + chalk14.hex("#83D1EB")("caliber config") + chalk14.red(" first."));
|
|
7493
7718
|
throw new Error("__exit__");
|
|
7494
7719
|
}
|
|
7495
7720
|
const manifest = readManifest();
|
|
7496
7721
|
if (!manifest) {
|
|
7497
|
-
console.log(
|
|
7722
|
+
console.log(chalk14.yellow("No existing setup found. Run ") + chalk14.hex("#83D1EB")("caliber init") + chalk14.yellow(" first."));
|
|
7498
7723
|
throw new Error("__exit__");
|
|
7499
7724
|
}
|
|
7500
7725
|
const targetAgent = readState()?.targetAgent ?? ["claude", "cursor"];
|
|
@@ -7505,7 +7730,7 @@ async function regenerateCommand(options) {
|
|
|
7505
7730
|
const baselineScore = computeLocalScore(process.cwd(), targetAgent);
|
|
7506
7731
|
displayScoreSummary(baselineScore);
|
|
7507
7732
|
if (baselineScore.score === 100) {
|
|
7508
|
-
console.log(
|
|
7733
|
+
console.log(chalk14.green(" Your setup is already at 100/100 \u2014 nothing to regenerate.\n"));
|
|
7509
7734
|
return;
|
|
7510
7735
|
}
|
|
7511
7736
|
const genSpinner = ora4("Regenerating setup...").start();
|
|
@@ -7546,18 +7771,18 @@ async function regenerateCommand(options) {
|
|
|
7546
7771
|
const setupFiles = collectSetupFiles(generatedSetup, targetAgent);
|
|
7547
7772
|
const staged = stageFiles(setupFiles, process.cwd());
|
|
7548
7773
|
const totalChanges = staged.newFiles + staged.modifiedFiles;
|
|
7549
|
-
console.log(
|
|
7550
|
-
${
|
|
7774
|
+
console.log(chalk14.dim(`
|
|
7775
|
+
${chalk14.green(`${staged.newFiles} new`)} / ${chalk14.yellow(`${staged.modifiedFiles} modified`)} file${totalChanges !== 1 ? "s" : ""}
|
|
7551
7776
|
`));
|
|
7552
7777
|
if (totalChanges === 0) {
|
|
7553
|
-
console.log(
|
|
7778
|
+
console.log(chalk14.dim(" No changes needed \u2014 your configs are already up to date.\n"));
|
|
7554
7779
|
cleanupStaging();
|
|
7555
7780
|
return;
|
|
7556
7781
|
}
|
|
7557
7782
|
if (options.dryRun) {
|
|
7558
|
-
console.log(
|
|
7783
|
+
console.log(chalk14.yellow("[Dry run] Would write:"));
|
|
7559
7784
|
for (const f of staged.stagedFiles) {
|
|
7560
|
-
console.log(` ${f.isNew ?
|
|
7785
|
+
console.log(` ${f.isNew ? chalk14.green("+") : chalk14.yellow("~")} ${f.relativePath}`);
|
|
7561
7786
|
}
|
|
7562
7787
|
cleanupStaging();
|
|
7563
7788
|
return;
|
|
@@ -7576,7 +7801,7 @@ async function regenerateCommand(options) {
|
|
|
7576
7801
|
});
|
|
7577
7802
|
cleanupStaging();
|
|
7578
7803
|
if (action === "decline") {
|
|
7579
|
-
console.log(
|
|
7804
|
+
console.log(chalk14.dim("Regeneration cancelled. No files were modified."));
|
|
7580
7805
|
return;
|
|
7581
7806
|
}
|
|
7582
7807
|
const writeSpinner = ora4("Writing config files...").start();
|
|
@@ -7584,20 +7809,20 @@ async function regenerateCommand(options) {
|
|
|
7584
7809
|
const result = writeSetup(generatedSetup);
|
|
7585
7810
|
writeSpinner.succeed("Config files written");
|
|
7586
7811
|
for (const file of result.written) {
|
|
7587
|
-
console.log(` ${
|
|
7812
|
+
console.log(` ${chalk14.green("\u2713")} ${file}`);
|
|
7588
7813
|
}
|
|
7589
7814
|
if (result.deleted.length > 0) {
|
|
7590
7815
|
for (const file of result.deleted) {
|
|
7591
|
-
console.log(` ${
|
|
7816
|
+
console.log(` ${chalk14.red("\u2717")} ${file}`);
|
|
7592
7817
|
}
|
|
7593
7818
|
}
|
|
7594
7819
|
if (result.backupDir) {
|
|
7595
|
-
console.log(
|
|
7820
|
+
console.log(chalk14.dim(`
|
|
7596
7821
|
Backups saved to ${result.backupDir}`));
|
|
7597
7822
|
}
|
|
7598
7823
|
} catch (err) {
|
|
7599
7824
|
writeSpinner.fail("Failed to write files");
|
|
7600
|
-
console.error(
|
|
7825
|
+
console.error(chalk14.red(err instanceof Error ? err.message : "Unknown error"));
|
|
7601
7826
|
throw new Error("__exit__");
|
|
7602
7827
|
}
|
|
7603
7828
|
const sha = getCurrentHeadSha();
|
|
@@ -7609,25 +7834,25 @@ async function regenerateCommand(options) {
|
|
|
7609
7834
|
const afterScore = computeLocalScore(process.cwd(), targetAgent);
|
|
7610
7835
|
if (afterScore.score < baselineScore.score) {
|
|
7611
7836
|
console.log("");
|
|
7612
|
-
console.log(
|
|
7837
|
+
console.log(chalk14.yellow(` Score would drop from ${baselineScore.score} to ${afterScore.score} \u2014 reverting changes.`));
|
|
7613
7838
|
try {
|
|
7614
7839
|
const { restored, removed } = undoSetup();
|
|
7615
7840
|
if (restored.length > 0 || removed.length > 0) {
|
|
7616
|
-
console.log(
|
|
7841
|
+
console.log(chalk14.dim(` Reverted ${restored.length + removed.length} file${restored.length + removed.length === 1 ? "" : "s"} from backup.`));
|
|
7617
7842
|
}
|
|
7618
7843
|
} catch {
|
|
7619
7844
|
}
|
|
7620
|
-
console.log(
|
|
7845
|
+
console.log(chalk14.dim(" Run ") + chalk14.hex("#83D1EB")("caliber init --force") + chalk14.dim(" to override.\n"));
|
|
7621
7846
|
return;
|
|
7622
7847
|
}
|
|
7623
7848
|
displayScoreDelta(baselineScore, afterScore);
|
|
7624
7849
|
trackRegenerateCompleted(action, Date.now());
|
|
7625
|
-
console.log(
|
|
7626
|
-
console.log(
|
|
7850
|
+
console.log(chalk14.bold.green(" Regeneration complete!"));
|
|
7851
|
+
console.log(chalk14.dim(" Run ") + chalk14.hex("#83D1EB")("caliber undo") + chalk14.dim(" to revert changes.\n"));
|
|
7627
7852
|
}
|
|
7628
7853
|
|
|
7629
7854
|
// src/commands/score.ts
|
|
7630
|
-
import
|
|
7855
|
+
import chalk15 from "chalk";
|
|
7631
7856
|
async function scoreCommand(options) {
|
|
7632
7857
|
const dir = process.cwd();
|
|
7633
7858
|
const target = options.agent ?? readState()?.targetAgent;
|
|
@@ -7642,14 +7867,14 @@ async function scoreCommand(options) {
|
|
|
7642
7867
|
return;
|
|
7643
7868
|
}
|
|
7644
7869
|
displayScore(result);
|
|
7645
|
-
const separator =
|
|
7870
|
+
const separator = chalk15.gray(" " + "\u2500".repeat(53));
|
|
7646
7871
|
console.log(separator);
|
|
7647
7872
|
if (result.score < 40) {
|
|
7648
|
-
console.log(
|
|
7873
|
+
console.log(chalk15.gray(" Run ") + chalk15.hex("#83D1EB")("caliber init") + chalk15.gray(" to generate a complete, optimized setup."));
|
|
7649
7874
|
} else if (result.score < 70) {
|
|
7650
|
-
console.log(
|
|
7875
|
+
console.log(chalk15.gray(" Run ") + chalk15.hex("#83D1EB")("caliber init") + chalk15.gray(" to improve your setup."));
|
|
7651
7876
|
} else {
|
|
7652
|
-
console.log(
|
|
7877
|
+
console.log(chalk15.green(" Looking good!") + chalk15.gray(" Run ") + chalk15.hex("#83D1EB")("caliber regenerate") + chalk15.gray(" to rebuild from scratch."));
|
|
7653
7878
|
}
|
|
7654
7879
|
console.log("");
|
|
7655
7880
|
}
|
|
@@ -7657,7 +7882,7 @@ async function scoreCommand(options) {
|
|
|
7657
7882
|
// src/commands/refresh.ts
|
|
7658
7883
|
import fs30 from "fs";
|
|
7659
7884
|
import path24 from "path";
|
|
7660
|
-
import
|
|
7885
|
+
import chalk16 from "chalk";
|
|
7661
7886
|
import ora5 from "ora";
|
|
7662
7887
|
|
|
7663
7888
|
// src/lib/git-diff.ts
|
|
@@ -8000,7 +8225,7 @@ function discoverGitRepos(parentDir) {
|
|
|
8000
8225
|
}
|
|
8001
8226
|
async function refreshSingleRepo(repoDir, options) {
|
|
8002
8227
|
const quiet = !!options.quiet;
|
|
8003
|
-
const prefix = options.label ? `${
|
|
8228
|
+
const prefix = options.label ? `${chalk16.bold(options.label)} ` : "";
|
|
8004
8229
|
const state = readState();
|
|
8005
8230
|
const lastSha = state?.lastRefreshSha ?? null;
|
|
8006
8231
|
const diff = collectDiff(lastSha);
|
|
@@ -8009,7 +8234,7 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
8009
8234
|
if (currentSha) {
|
|
8010
8235
|
writeState({ lastRefreshSha: currentSha, lastRefreshTimestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
8011
8236
|
}
|
|
8012
|
-
log2(quiet,
|
|
8237
|
+
log2(quiet, chalk16.dim(`${prefix}No changes since last refresh.`));
|
|
8013
8238
|
return;
|
|
8014
8239
|
}
|
|
8015
8240
|
const spinner = quiet ? null : ora5(`${prefix}Analyzing changes...`).start();
|
|
@@ -8043,10 +8268,10 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
8043
8268
|
if (options.dryRun) {
|
|
8044
8269
|
spinner?.info(`${prefix}Dry run \u2014 would update:`);
|
|
8045
8270
|
for (const doc of response.docsUpdated) {
|
|
8046
|
-
console.log(` ${
|
|
8271
|
+
console.log(` ${chalk16.yellow("~")} ${doc}`);
|
|
8047
8272
|
}
|
|
8048
8273
|
if (response.changesSummary) {
|
|
8049
|
-
console.log(
|
|
8274
|
+
console.log(chalk16.dim(`
|
|
8050
8275
|
${response.changesSummary}`));
|
|
8051
8276
|
}
|
|
8052
8277
|
return;
|
|
@@ -8055,10 +8280,10 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
8055
8280
|
trackRefreshCompleted(written.length, Date.now());
|
|
8056
8281
|
spinner?.succeed(`${prefix}Updated ${written.length} doc${written.length === 1 ? "" : "s"}`);
|
|
8057
8282
|
for (const file of written) {
|
|
8058
|
-
log2(quiet, ` ${
|
|
8283
|
+
log2(quiet, ` ${chalk16.green("\u2713")} ${file}`);
|
|
8059
8284
|
}
|
|
8060
8285
|
if (response.changesSummary) {
|
|
8061
|
-
log2(quiet,
|
|
8286
|
+
log2(quiet, chalk16.dim(`
|
|
8062
8287
|
${response.changesSummary}`));
|
|
8063
8288
|
}
|
|
8064
8289
|
if (currentSha) {
|
|
@@ -8075,7 +8300,7 @@ async function refreshCommand(options) {
|
|
|
8075
8300
|
const config = loadConfig();
|
|
8076
8301
|
if (!config) {
|
|
8077
8302
|
if (quiet) return;
|
|
8078
|
-
console.log(
|
|
8303
|
+
console.log(chalk16.red("No LLM provider configured. Run ") + chalk16.hex("#83D1EB")("caliber config") + chalk16.red(" (e.g. choose Cursor) or set an API key."));
|
|
8079
8304
|
throw new Error("__exit__");
|
|
8080
8305
|
}
|
|
8081
8306
|
await validateModel({ fast: true });
|
|
@@ -8086,10 +8311,10 @@ async function refreshCommand(options) {
|
|
|
8086
8311
|
const repos = discoverGitRepos(process.cwd());
|
|
8087
8312
|
if (repos.length === 0) {
|
|
8088
8313
|
if (quiet) return;
|
|
8089
|
-
console.log(
|
|
8314
|
+
console.log(chalk16.red("Not inside a git repository and no git repos found in child directories."));
|
|
8090
8315
|
throw new Error("__exit__");
|
|
8091
8316
|
}
|
|
8092
|
-
log2(quiet,
|
|
8317
|
+
log2(quiet, chalk16.dim(`Found ${repos.length} git repo${repos.length === 1 ? "" : "s"}
|
|
8093
8318
|
`));
|
|
8094
8319
|
const originalDir = process.cwd();
|
|
8095
8320
|
for (const repo of repos) {
|
|
@@ -8099,7 +8324,7 @@ async function refreshCommand(options) {
|
|
|
8099
8324
|
await refreshSingleRepo(repo, { ...options, label: repoName });
|
|
8100
8325
|
} catch (err) {
|
|
8101
8326
|
if (err instanceof Error && err.message === "__exit__") continue;
|
|
8102
|
-
log2(quiet,
|
|
8327
|
+
log2(quiet, chalk16.yellow(`${repoName}: refresh failed \u2014 ${err instanceof Error ? err.message : "unknown error"}`));
|
|
8103
8328
|
}
|
|
8104
8329
|
}
|
|
8105
8330
|
process.chdir(originalDir);
|
|
@@ -8107,13 +8332,13 @@ async function refreshCommand(options) {
|
|
|
8107
8332
|
if (err instanceof Error && err.message === "__exit__") throw err;
|
|
8108
8333
|
if (quiet) return;
|
|
8109
8334
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
8110
|
-
console.log(
|
|
8335
|
+
console.log(chalk16.red(`Refresh failed: ${msg}`));
|
|
8111
8336
|
throw new Error("__exit__");
|
|
8112
8337
|
}
|
|
8113
8338
|
}
|
|
8114
8339
|
|
|
8115
8340
|
// src/commands/hooks.ts
|
|
8116
|
-
import
|
|
8341
|
+
import chalk17 from "chalk";
|
|
8117
8342
|
var HOOKS = [
|
|
8118
8343
|
{
|
|
8119
8344
|
id: "session-end",
|
|
@@ -8133,13 +8358,13 @@ var HOOKS = [
|
|
|
8133
8358
|
}
|
|
8134
8359
|
];
|
|
8135
8360
|
function printStatus() {
|
|
8136
|
-
console.log(
|
|
8361
|
+
console.log(chalk17.bold("\n Hooks\n"));
|
|
8137
8362
|
for (const hook of HOOKS) {
|
|
8138
8363
|
const installed = hook.isInstalled();
|
|
8139
|
-
const icon = installed ?
|
|
8140
|
-
const state = installed ?
|
|
8364
|
+
const icon = installed ? chalk17.green("\u2713") : chalk17.dim("\u2717");
|
|
8365
|
+
const state = installed ? chalk17.green("enabled") : chalk17.dim("disabled");
|
|
8141
8366
|
console.log(` ${icon} ${hook.label.padEnd(26)} ${state}`);
|
|
8142
|
-
console.log(
|
|
8367
|
+
console.log(chalk17.dim(` ${hook.description}`));
|
|
8143
8368
|
}
|
|
8144
8369
|
console.log("");
|
|
8145
8370
|
}
|
|
@@ -8148,9 +8373,9 @@ async function hooksCommand(options) {
|
|
|
8148
8373
|
for (const hook of HOOKS) {
|
|
8149
8374
|
const result = hook.install();
|
|
8150
8375
|
if (result.alreadyInstalled) {
|
|
8151
|
-
console.log(
|
|
8376
|
+
console.log(chalk17.dim(` ${hook.label} already enabled.`));
|
|
8152
8377
|
} else {
|
|
8153
|
-
console.log(
|
|
8378
|
+
console.log(chalk17.green(" \u2713") + ` ${hook.label} enabled`);
|
|
8154
8379
|
}
|
|
8155
8380
|
}
|
|
8156
8381
|
return;
|
|
@@ -8159,9 +8384,9 @@ async function hooksCommand(options) {
|
|
|
8159
8384
|
for (const hook of HOOKS) {
|
|
8160
8385
|
const result = hook.remove();
|
|
8161
8386
|
if (result.notFound) {
|
|
8162
|
-
console.log(
|
|
8387
|
+
console.log(chalk17.dim(` ${hook.label} already disabled.`));
|
|
8163
8388
|
} else {
|
|
8164
|
-
console.log(
|
|
8389
|
+
console.log(chalk17.green(" \u2713") + ` ${hook.label} removed`);
|
|
8165
8390
|
}
|
|
8166
8391
|
}
|
|
8167
8392
|
return;
|
|
@@ -8176,18 +8401,18 @@ async function hooksCommand(options) {
|
|
|
8176
8401
|
const states = HOOKS.map((h) => h.isInstalled());
|
|
8177
8402
|
function render() {
|
|
8178
8403
|
const lines = [];
|
|
8179
|
-
lines.push(
|
|
8404
|
+
lines.push(chalk17.bold(" Hooks"));
|
|
8180
8405
|
lines.push("");
|
|
8181
8406
|
for (let i = 0; i < HOOKS.length; i++) {
|
|
8182
8407
|
const hook = HOOKS[i];
|
|
8183
8408
|
const enabled = states[i];
|
|
8184
|
-
const toggle = enabled ?
|
|
8185
|
-
const ptr = i === cursor ?
|
|
8409
|
+
const toggle = enabled ? chalk17.green("[on] ") : chalk17.dim("[off]");
|
|
8410
|
+
const ptr = i === cursor ? chalk17.cyan(">") : " ";
|
|
8186
8411
|
lines.push(` ${ptr} ${toggle} ${hook.label}`);
|
|
8187
|
-
lines.push(
|
|
8412
|
+
lines.push(chalk17.dim(` ${hook.description}`));
|
|
8188
8413
|
}
|
|
8189
8414
|
lines.push("");
|
|
8190
|
-
lines.push(
|
|
8415
|
+
lines.push(chalk17.dim(" \u2191\u2193 navigate \u23B5 toggle a all on n all off \u23CE apply q cancel"));
|
|
8191
8416
|
return lines.join("\n");
|
|
8192
8417
|
}
|
|
8193
8418
|
function draw(initial) {
|
|
@@ -8218,16 +8443,16 @@ async function hooksCommand(options) {
|
|
|
8218
8443
|
const wantEnabled = states[i];
|
|
8219
8444
|
if (wantEnabled && !wasInstalled) {
|
|
8220
8445
|
hook.install();
|
|
8221
|
-
console.log(
|
|
8446
|
+
console.log(chalk17.green(" \u2713") + ` ${hook.label} enabled`);
|
|
8222
8447
|
changed++;
|
|
8223
8448
|
} else if (!wantEnabled && wasInstalled) {
|
|
8224
8449
|
hook.remove();
|
|
8225
|
-
console.log(
|
|
8450
|
+
console.log(chalk17.green(" \u2713") + ` ${hook.label} disabled`);
|
|
8226
8451
|
changed++;
|
|
8227
8452
|
}
|
|
8228
8453
|
}
|
|
8229
8454
|
if (changed === 0) {
|
|
8230
|
-
console.log(
|
|
8455
|
+
console.log(chalk17.dim(" No changes."));
|
|
8231
8456
|
}
|
|
8232
8457
|
console.log("");
|
|
8233
8458
|
}
|
|
@@ -8263,7 +8488,7 @@ async function hooksCommand(options) {
|
|
|
8263
8488
|
case "\x1B":
|
|
8264
8489
|
case "":
|
|
8265
8490
|
cleanup();
|
|
8266
|
-
console.log(
|
|
8491
|
+
console.log(chalk17.dim("\n Cancelled.\n"));
|
|
8267
8492
|
resolve2();
|
|
8268
8493
|
break;
|
|
8269
8494
|
}
|
|
@@ -8274,51 +8499,51 @@ async function hooksCommand(options) {
|
|
|
8274
8499
|
|
|
8275
8500
|
// src/commands/config.ts
|
|
8276
8501
|
init_config();
|
|
8277
|
-
import
|
|
8502
|
+
import chalk18 from "chalk";
|
|
8278
8503
|
async function configCommand() {
|
|
8279
8504
|
const existing = loadConfig();
|
|
8280
8505
|
if (existing) {
|
|
8281
8506
|
const displayModel = getDisplayModel(existing);
|
|
8282
8507
|
const fastModel = getFastModel();
|
|
8283
|
-
console.log(
|
|
8284
|
-
console.log(` Provider: ${
|
|
8285
|
-
console.log(` Model: ${
|
|
8508
|
+
console.log(chalk18.bold("\nCurrent Configuration\n"));
|
|
8509
|
+
console.log(` Provider: ${chalk18.cyan(existing.provider)}`);
|
|
8510
|
+
console.log(` Model: ${chalk18.cyan(displayModel)}`);
|
|
8286
8511
|
if (fastModel) {
|
|
8287
|
-
console.log(` Scan: ${
|
|
8512
|
+
console.log(` Scan: ${chalk18.cyan(fastModel)}`);
|
|
8288
8513
|
}
|
|
8289
8514
|
if (existing.apiKey) {
|
|
8290
8515
|
const masked = existing.apiKey.slice(0, 8) + "..." + existing.apiKey.slice(-4);
|
|
8291
|
-
console.log(` API Key: ${
|
|
8516
|
+
console.log(` API Key: ${chalk18.dim(masked)}`);
|
|
8292
8517
|
}
|
|
8293
8518
|
if (existing.provider === "cursor") {
|
|
8294
|
-
console.log(` Seat: ${
|
|
8519
|
+
console.log(` Seat: ${chalk18.dim("Cursor (agent acp)")}`);
|
|
8295
8520
|
}
|
|
8296
8521
|
if (existing.provider === "claude-cli") {
|
|
8297
|
-
console.log(` Seat: ${
|
|
8522
|
+
console.log(` Seat: ${chalk18.dim("Claude Code (claude -p)")}`);
|
|
8298
8523
|
}
|
|
8299
8524
|
if (existing.baseUrl) {
|
|
8300
|
-
console.log(` Base URL: ${
|
|
8525
|
+
console.log(` Base URL: ${chalk18.dim(existing.baseUrl)}`);
|
|
8301
8526
|
}
|
|
8302
8527
|
if (existing.vertexProjectId) {
|
|
8303
|
-
console.log(` Vertex Project: ${
|
|
8304
|
-
console.log(` Vertex Region: ${
|
|
8528
|
+
console.log(` Vertex Project: ${chalk18.dim(existing.vertexProjectId)}`);
|
|
8529
|
+
console.log(` Vertex Region: ${chalk18.dim(existing.vertexRegion || "us-east5")}`);
|
|
8305
8530
|
}
|
|
8306
|
-
console.log(` Source: ${
|
|
8531
|
+
console.log(` Source: ${chalk18.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())}`);
|
|
8307
8532
|
console.log("");
|
|
8308
8533
|
}
|
|
8309
8534
|
await runInteractiveProviderSetup();
|
|
8310
8535
|
const updated = loadConfig();
|
|
8311
8536
|
if (updated) trackConfigProviderSet(updated.provider);
|
|
8312
|
-
console.log(
|
|
8313
|
-
console.log(
|
|
8537
|
+
console.log(chalk18.green("\n\u2713 Configuration saved"));
|
|
8538
|
+
console.log(chalk18.dim(` ${getConfigFilePath()}
|
|
8314
8539
|
`));
|
|
8315
|
-
console.log(
|
|
8316
|
-
console.log(
|
|
8540
|
+
console.log(chalk18.dim(" You can also set environment variables instead:"));
|
|
8541
|
+
console.log(chalk18.dim(" ANTHROPIC_API_KEY, OPENAI_API_KEY, VERTEX_PROJECT_ID, CALIBER_USE_CURSOR_SEAT=1, or CALIBER_USE_CLAUDE_CLI=1\n"));
|
|
8317
8542
|
}
|
|
8318
8543
|
|
|
8319
8544
|
// src/commands/learn.ts
|
|
8320
8545
|
import fs33 from "fs";
|
|
8321
|
-
import
|
|
8546
|
+
import chalk19 from "chalk";
|
|
8322
8547
|
|
|
8323
8548
|
// src/learner/stdin.ts
|
|
8324
8549
|
var STDIN_TIMEOUT_MS = 5e3;
|
|
@@ -8749,26 +8974,26 @@ async function learnFinalizeCommand(options) {
|
|
|
8749
8974
|
if (!options?.force) {
|
|
8750
8975
|
const { isCaliberRunning: isCaliberRunning2 } = await Promise.resolve().then(() => (init_lock(), lock_exports));
|
|
8751
8976
|
if (isCaliberRunning2()) {
|
|
8752
|
-
console.log(
|
|
8977
|
+
console.log(chalk19.dim("caliber: skipping finalize \u2014 another caliber process is running"));
|
|
8753
8978
|
return;
|
|
8754
8979
|
}
|
|
8755
8980
|
}
|
|
8756
8981
|
if (!acquireFinalizeLock()) {
|
|
8757
|
-
console.log(
|
|
8982
|
+
console.log(chalk19.dim("caliber: skipping finalize \u2014 another finalize is in progress"));
|
|
8758
8983
|
return;
|
|
8759
8984
|
}
|
|
8760
8985
|
let analyzed = false;
|
|
8761
8986
|
try {
|
|
8762
8987
|
const config = loadConfig();
|
|
8763
8988
|
if (!config) {
|
|
8764
|
-
console.log(
|
|
8989
|
+
console.log(chalk19.yellow("caliber: no LLM provider configured \u2014 run `caliber config` first"));
|
|
8765
8990
|
clearSession();
|
|
8766
8991
|
resetState();
|
|
8767
8992
|
return;
|
|
8768
8993
|
}
|
|
8769
8994
|
const events = readAllEvents();
|
|
8770
8995
|
if (events.length < MIN_EVENTS_FOR_ANALYSIS) {
|
|
8771
|
-
console.log(
|
|
8996
|
+
console.log(chalk19.dim(`caliber: ${events.length}/${MIN_EVENTS_FOR_ANALYSIS} events recorded \u2014 need more before analysis`));
|
|
8772
8997
|
return;
|
|
8773
8998
|
}
|
|
8774
8999
|
await validateModel({ fast: true });
|
|
@@ -8796,9 +9021,9 @@ async function learnFinalizeCommand(options) {
|
|
|
8796
9021
|
newLearningsProduced = result.newItemCount;
|
|
8797
9022
|
if (result.newItemCount > 0) {
|
|
8798
9023
|
const wasteLabel = waste.totalWasteTokens > 0 ? ` (~${waste.totalWasteTokens.toLocaleString()} wasted tokens captured)` : "";
|
|
8799
|
-
console.log(
|
|
9024
|
+
console.log(chalk19.dim(`caliber: learned ${result.newItemCount} new pattern${result.newItemCount === 1 ? "" : "s"}${wasteLabel}`));
|
|
8800
9025
|
for (const item of result.newItems) {
|
|
8801
|
-
console.log(
|
|
9026
|
+
console.log(chalk19.dim(` + ${item.replace(/^- /, "").slice(0, 80)}`));
|
|
8802
9027
|
}
|
|
8803
9028
|
const wastePerLearning = Math.round(waste.totalWasteTokens / result.newItemCount);
|
|
8804
9029
|
const TYPE_RE = /^\*\*\[([^\]]+)\]\*\*/;
|
|
@@ -8857,11 +9082,11 @@ async function learnFinalizeCommand(options) {
|
|
|
8857
9082
|
});
|
|
8858
9083
|
if (t.estimatedSavingsTokens > 0) {
|
|
8859
9084
|
const totalLearnings = existingLearnedItems + newLearningsProduced;
|
|
8860
|
-
console.log(
|
|
9085
|
+
console.log(chalk19.dim(`caliber: ${totalLearnings} learnings active \u2014 est. ~${t.estimatedSavingsTokens.toLocaleString()} tokens saved across ${t.totalSessionsWithLearnings} sessions`));
|
|
8861
9086
|
}
|
|
8862
9087
|
} catch (err) {
|
|
8863
9088
|
if (options?.force) {
|
|
8864
|
-
console.error(
|
|
9089
|
+
console.error(chalk19.red("caliber: finalize failed \u2014"), err instanceof Error ? err.message : err);
|
|
8865
9090
|
}
|
|
8866
9091
|
} finally {
|
|
8867
9092
|
if (analyzed) {
|
|
@@ -8876,45 +9101,45 @@ async function learnInstallCommand() {
|
|
|
8876
9101
|
if (fs33.existsSync(".claude")) {
|
|
8877
9102
|
const r = installLearningHooks();
|
|
8878
9103
|
if (r.installed) {
|
|
8879
|
-
console.log(
|
|
9104
|
+
console.log(chalk19.green("\u2713") + " Claude Code learning hooks installed");
|
|
8880
9105
|
anyInstalled = true;
|
|
8881
9106
|
} else if (r.alreadyInstalled) {
|
|
8882
|
-
console.log(
|
|
9107
|
+
console.log(chalk19.dim(" Claude Code hooks already installed"));
|
|
8883
9108
|
}
|
|
8884
9109
|
}
|
|
8885
9110
|
if (fs33.existsSync(".cursor")) {
|
|
8886
9111
|
const r = installCursorLearningHooks();
|
|
8887
9112
|
if (r.installed) {
|
|
8888
|
-
console.log(
|
|
9113
|
+
console.log(chalk19.green("\u2713") + " Cursor learning hooks installed");
|
|
8889
9114
|
anyInstalled = true;
|
|
8890
9115
|
} else if (r.alreadyInstalled) {
|
|
8891
|
-
console.log(
|
|
9116
|
+
console.log(chalk19.dim(" Cursor hooks already installed"));
|
|
8892
9117
|
}
|
|
8893
9118
|
}
|
|
8894
9119
|
if (!fs33.existsSync(".claude") && !fs33.existsSync(".cursor")) {
|
|
8895
|
-
console.log(
|
|
8896
|
-
console.log(
|
|
9120
|
+
console.log(chalk19.yellow("No .claude/ or .cursor/ directory found."));
|
|
9121
|
+
console.log(chalk19.dim(" Run `caliber init` first, or create the directory manually."));
|
|
8897
9122
|
return;
|
|
8898
9123
|
}
|
|
8899
9124
|
if (anyInstalled) {
|
|
8900
|
-
console.log(
|
|
8901
|
-
console.log(
|
|
9125
|
+
console.log(chalk19.dim(` Tool usage will be recorded and learnings extracted after \u2265${MIN_EVENTS_FOR_ANALYSIS} events.`));
|
|
9126
|
+
console.log(chalk19.dim(" Learnings written to CALIBER_LEARNINGS.md."));
|
|
8902
9127
|
}
|
|
8903
9128
|
}
|
|
8904
9129
|
async function learnRemoveCommand() {
|
|
8905
9130
|
let anyRemoved = false;
|
|
8906
9131
|
const r1 = removeLearningHooks();
|
|
8907
9132
|
if (r1.removed) {
|
|
8908
|
-
console.log(
|
|
9133
|
+
console.log(chalk19.green("\u2713") + " Claude Code learning hooks removed");
|
|
8909
9134
|
anyRemoved = true;
|
|
8910
9135
|
}
|
|
8911
9136
|
const r2 = removeCursorLearningHooks();
|
|
8912
9137
|
if (r2.removed) {
|
|
8913
|
-
console.log(
|
|
9138
|
+
console.log(chalk19.green("\u2713") + " Cursor learning hooks removed");
|
|
8914
9139
|
anyRemoved = true;
|
|
8915
9140
|
}
|
|
8916
9141
|
if (!anyRemoved) {
|
|
8917
|
-
console.log(
|
|
9142
|
+
console.log(chalk19.dim("No learning hooks found."));
|
|
8918
9143
|
}
|
|
8919
9144
|
}
|
|
8920
9145
|
async function learnStatusCommand() {
|
|
@@ -8922,40 +9147,40 @@ async function learnStatusCommand() {
|
|
|
8922
9147
|
const cursorInstalled = areCursorLearningHooksInstalled();
|
|
8923
9148
|
const state = readState2();
|
|
8924
9149
|
const eventCount = getEventCount();
|
|
8925
|
-
console.log(
|
|
9150
|
+
console.log(chalk19.bold("Session Learning Status"));
|
|
8926
9151
|
console.log();
|
|
8927
9152
|
if (claudeInstalled) {
|
|
8928
|
-
console.log(
|
|
9153
|
+
console.log(chalk19.green("\u2713") + " Claude Code hooks " + chalk19.green("installed"));
|
|
8929
9154
|
} else {
|
|
8930
|
-
console.log(
|
|
9155
|
+
console.log(chalk19.dim("\u2717") + " Claude Code hooks " + chalk19.dim("not installed"));
|
|
8931
9156
|
}
|
|
8932
9157
|
if (cursorInstalled) {
|
|
8933
|
-
console.log(
|
|
9158
|
+
console.log(chalk19.green("\u2713") + " Cursor hooks " + chalk19.green("installed"));
|
|
8934
9159
|
} else {
|
|
8935
|
-
console.log(
|
|
9160
|
+
console.log(chalk19.dim("\u2717") + " Cursor hooks " + chalk19.dim("not installed"));
|
|
8936
9161
|
}
|
|
8937
9162
|
if (!claudeInstalled && !cursorInstalled) {
|
|
8938
|
-
console.log(
|
|
9163
|
+
console.log(chalk19.dim(" Run `caliber learn install` to enable session learning."));
|
|
8939
9164
|
}
|
|
8940
9165
|
console.log();
|
|
8941
|
-
console.log(`Events recorded: ${
|
|
8942
|
-
console.log(`Threshold for analysis: ${
|
|
9166
|
+
console.log(`Events recorded: ${chalk19.cyan(String(eventCount))}`);
|
|
9167
|
+
console.log(`Threshold for analysis: ${chalk19.cyan(String(MIN_EVENTS_FOR_ANALYSIS))}`);
|
|
8943
9168
|
if (state.lastAnalysisTimestamp) {
|
|
8944
|
-
console.log(`Last analysis: ${
|
|
9169
|
+
console.log(`Last analysis: ${chalk19.cyan(state.lastAnalysisTimestamp)}`);
|
|
8945
9170
|
} else {
|
|
8946
|
-
console.log(`Last analysis: ${
|
|
9171
|
+
console.log(`Last analysis: ${chalk19.dim("none")}`);
|
|
8947
9172
|
}
|
|
8948
9173
|
const learnedSection = readLearnedSection();
|
|
8949
9174
|
if (learnedSection) {
|
|
8950
9175
|
const lineCount = learnedSection.split("\n").filter(Boolean).length;
|
|
8951
9176
|
console.log(`
|
|
8952
|
-
Learned items in CALIBER_LEARNINGS.md: ${
|
|
9177
|
+
Learned items in CALIBER_LEARNINGS.md: ${chalk19.cyan(String(lineCount))}`);
|
|
8953
9178
|
}
|
|
8954
9179
|
const roiStats = readROIStats();
|
|
8955
9180
|
const roiSummary = formatROISummary(roiStats);
|
|
8956
9181
|
if (roiSummary) {
|
|
8957
9182
|
console.log();
|
|
8958
|
-
console.log(
|
|
9183
|
+
console.log(chalk19.bold(roiSummary.split("\n")[0]));
|
|
8959
9184
|
for (const line of roiSummary.split("\n").slice(1)) {
|
|
8960
9185
|
console.log(line);
|
|
8961
9186
|
}
|
|
@@ -9043,7 +9268,7 @@ import fs35 from "fs";
|
|
|
9043
9268
|
import path28 from "path";
|
|
9044
9269
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
9045
9270
|
import { execSync as execSync14 } from "child_process";
|
|
9046
|
-
import
|
|
9271
|
+
import chalk20 from "chalk";
|
|
9047
9272
|
import ora6 from "ora";
|
|
9048
9273
|
import confirm2 from "@inquirer/confirm";
|
|
9049
9274
|
var __dirname_vc = path28.dirname(fileURLToPath2(import.meta.url));
|
|
@@ -9099,17 +9324,17 @@ async function checkForUpdates() {
|
|
|
9099
9324
|
if (!isInteractive) {
|
|
9100
9325
|
const installTag = channel === "latest" ? "" : `@${channel}`;
|
|
9101
9326
|
console.log(
|
|
9102
|
-
|
|
9327
|
+
chalk20.yellow(
|
|
9103
9328
|
`
|
|
9104
9329
|
Update available: ${current} -> ${latest}
|
|
9105
|
-
Run ${
|
|
9330
|
+
Run ${chalk20.bold(`npm install -g @rely-ai/caliber${installTag}`)} to upgrade.
|
|
9106
9331
|
`
|
|
9107
9332
|
)
|
|
9108
9333
|
);
|
|
9109
9334
|
return;
|
|
9110
9335
|
}
|
|
9111
9336
|
console.log(
|
|
9112
|
-
|
|
9337
|
+
chalk20.yellow(`
|
|
9113
9338
|
Update available: ${current} -> ${latest}`)
|
|
9114
9339
|
);
|
|
9115
9340
|
const shouldUpdate = await confirm2({ message: "Would you like to update now? (Y/n)", default: true });
|
|
@@ -9128,13 +9353,13 @@ Update available: ${current} -> ${latest}`)
|
|
|
9128
9353
|
const installed = getInstalledVersion();
|
|
9129
9354
|
if (installed !== latest) {
|
|
9130
9355
|
spinner.fail(`Update incomplete \u2014 got ${installed ?? "unknown"}, expected ${latest}`);
|
|
9131
|
-
console.log(
|
|
9356
|
+
console.log(chalk20.yellow(`Run ${chalk20.bold(`npm install -g @rely-ai/caliber@${tag}`)} manually.
|
|
9132
9357
|
`));
|
|
9133
9358
|
return;
|
|
9134
9359
|
}
|
|
9135
|
-
spinner.succeed(
|
|
9360
|
+
spinner.succeed(chalk20.green(`Updated to ${latest}`));
|
|
9136
9361
|
const args = process.argv.slice(2);
|
|
9137
|
-
console.log(
|
|
9362
|
+
console.log(chalk20.dim(`
|
|
9138
9363
|
Restarting: caliber ${args.join(" ")}
|
|
9139
9364
|
`));
|
|
9140
9365
|
execSync14(`caliber ${args.map((a) => JSON.stringify(a)).join(" ")}`, {
|
|
@@ -9147,11 +9372,11 @@ Restarting: caliber ${args.join(" ")}
|
|
|
9147
9372
|
if (err instanceof Error) {
|
|
9148
9373
|
const stderr = err.stderr;
|
|
9149
9374
|
const errMsg = stderr ? String(stderr).trim().split("\n").pop() : err.message.split("\n")[0];
|
|
9150
|
-
if (errMsg && !errMsg.includes("SIGTERM")) console.log(
|
|
9375
|
+
if (errMsg && !errMsg.includes("SIGTERM")) console.log(chalk20.dim(` ${errMsg}`));
|
|
9151
9376
|
}
|
|
9152
9377
|
console.log(
|
|
9153
|
-
|
|
9154
|
-
`Run ${
|
|
9378
|
+
chalk20.yellow(
|
|
9379
|
+
`Run ${chalk20.bold(`npm install -g @rely-ai/caliber@${tag}`)} manually to upgrade.
|
|
9155
9380
|
`
|
|
9156
9381
|
)
|
|
9157
9382
|
);
|