@rely-ai/caliber 1.5.0 → 1.5.2
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 +36 -37
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -1469,13 +1469,13 @@ async function detectProjectStack(fileTree, fileContents) {
|
|
|
1469
1469
|
}
|
|
1470
1470
|
|
|
1471
1471
|
// src/fingerprint/index.ts
|
|
1472
|
-
function collectFingerprint(dir) {
|
|
1472
|
+
async function collectFingerprint(dir) {
|
|
1473
1473
|
const gitRemoteUrl = getGitRemoteUrl();
|
|
1474
1474
|
const fileTree = getFileTree(dir);
|
|
1475
1475
|
const existingConfigs = readExistingConfigs(dir);
|
|
1476
1476
|
const codeAnalysis = analyzeCode(dir);
|
|
1477
1477
|
const packageName = readPackageName(dir);
|
|
1478
|
-
|
|
1478
|
+
const fingerprint = {
|
|
1479
1479
|
gitRemoteUrl,
|
|
1480
1480
|
packageName,
|
|
1481
1481
|
languages: [],
|
|
@@ -1485,6 +1485,8 @@ function collectFingerprint(dir) {
|
|
|
1485
1485
|
existingConfigs,
|
|
1486
1486
|
codeAnalysis
|
|
1487
1487
|
};
|
|
1488
|
+
await enrichWithLLM(fingerprint, dir);
|
|
1489
|
+
return fingerprint;
|
|
1488
1490
|
}
|
|
1489
1491
|
function readPackageName(dir) {
|
|
1490
1492
|
try {
|
|
@@ -1510,7 +1512,7 @@ var DEP_FILE_PATTERNS = [
|
|
|
1510
1512
|
"composer.json"
|
|
1511
1513
|
];
|
|
1512
1514
|
var MAX_CONTENT_SIZE = 50 * 1024;
|
|
1513
|
-
async function
|
|
1515
|
+
async function enrichWithLLM(fingerprint, dir) {
|
|
1514
1516
|
try {
|
|
1515
1517
|
const config = loadConfig();
|
|
1516
1518
|
if (!config) return;
|
|
@@ -1532,21 +1534,9 @@ async function enrichFingerprintWithLLM(fingerprint, dir) {
|
|
|
1532
1534
|
}
|
|
1533
1535
|
if (Object.keys(fileContents).length === 0 && fingerprint.fileTree.length === 0) return;
|
|
1534
1536
|
const result = await detectProjectStack(fingerprint.fileTree, fileContents);
|
|
1535
|
-
if (result.languages?.length)
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
fingerprint.languages = [...langSet];
|
|
1539
|
-
}
|
|
1540
|
-
if (result.frameworks?.length) {
|
|
1541
|
-
const fwSet = new Set(fingerprint.frameworks);
|
|
1542
|
-
for (const fw of result.frameworks) fwSet.add(fw);
|
|
1543
|
-
fingerprint.frameworks = [...fwSet];
|
|
1544
|
-
}
|
|
1545
|
-
if (result.tools?.length) {
|
|
1546
|
-
const toolSet = new Set(fingerprint.tools);
|
|
1547
|
-
for (const tool of result.tools) toolSet.add(tool);
|
|
1548
|
-
fingerprint.tools = [...toolSet];
|
|
1549
|
-
}
|
|
1537
|
+
if (result.languages?.length) fingerprint.languages = result.languages;
|
|
1538
|
+
if (result.frameworks?.length) fingerprint.frameworks = result.frameworks;
|
|
1539
|
+
if (result.tools?.length) fingerprint.tools = result.tools;
|
|
1550
1540
|
} catch {
|
|
1551
1541
|
}
|
|
1552
1542
|
}
|
|
@@ -4988,9 +4978,8 @@ ${candidateList}`,
|
|
|
4988
4978
|
reason: s.reason || candidates[s.index].reason
|
|
4989
4979
|
}));
|
|
4990
4980
|
}
|
|
4991
|
-
function buildProjectContext(
|
|
4981
|
+
function buildProjectContext(fingerprint) {
|
|
4992
4982
|
const parts = [];
|
|
4993
|
-
const fingerprint = collectFingerprint(dir);
|
|
4994
4983
|
if (fingerprint.packageName) parts.push(`Package: ${fingerprint.packageName}`);
|
|
4995
4984
|
if (fingerprint.languages.length > 0) parts.push(`Languages: ${fingerprint.languages.join(", ")}`);
|
|
4996
4985
|
if (fingerprint.frameworks.length > 0) parts.push(`Frameworks: ${fingerprint.frameworks.join(", ")}`);
|
|
@@ -5108,7 +5097,7 @@ async function recommendCommand() {
|
|
|
5108
5097
|
await searchAndInstallSkills();
|
|
5109
5098
|
}
|
|
5110
5099
|
async function searchAndInstallSkills() {
|
|
5111
|
-
const fingerprint = collectFingerprint(process.cwd());
|
|
5100
|
+
const fingerprint = await collectFingerprint(process.cwd());
|
|
5112
5101
|
const platforms = detectLocalPlatforms();
|
|
5113
5102
|
const installedSkills = getInstalledSkills();
|
|
5114
5103
|
const technologies = [...new Set([
|
|
@@ -5141,7 +5130,7 @@ async function searchAndInstallSkills() {
|
|
|
5141
5130
|
if (config) {
|
|
5142
5131
|
const scoreSpinner = ora2("Scoring relevance for your project...").start();
|
|
5143
5132
|
try {
|
|
5144
|
-
const projectContext = buildProjectContext(
|
|
5133
|
+
const projectContext = buildProjectContext(fingerprint);
|
|
5145
5134
|
results = await scoreWithLLM2(newCandidates, projectContext, technologies);
|
|
5146
5135
|
if (results.length === 0) {
|
|
5147
5136
|
scoreSpinner.succeed("No highly relevant skills found for your specific project.");
|
|
@@ -5187,23 +5176,30 @@ async function interactiveSelect2(recs) {
|
|
|
5187
5176
|
const hasScores = recs.some((r) => r.score > 0);
|
|
5188
5177
|
function render() {
|
|
5189
5178
|
const lines = [];
|
|
5179
|
+
const cols = process.stdout.columns || 80;
|
|
5180
|
+
const nameWidth = Math.max(...recs.map((r) => r.name.length), 4) + 2;
|
|
5181
|
+
const prefixWidth = 8;
|
|
5182
|
+
const scoreWidth = 6;
|
|
5190
5183
|
lines.push(chalk6.bold(" Skills"));
|
|
5191
5184
|
lines.push("");
|
|
5192
5185
|
if (hasScores) {
|
|
5193
|
-
|
|
5186
|
+
const header = " ".repeat(prefixWidth) + chalk6.dim("Score".padEnd(scoreWidth)) + chalk6.dim("Name".padEnd(nameWidth)) + chalk6.dim("Why");
|
|
5187
|
+
lines.push(header);
|
|
5194
5188
|
} else {
|
|
5195
|
-
|
|
5189
|
+
const header = " ".repeat(prefixWidth) + chalk6.dim("Name".padEnd(nameWidth)) + chalk6.dim("Technology".padEnd(18)) + chalk6.dim("Source");
|
|
5190
|
+
lines.push(header);
|
|
5196
5191
|
}
|
|
5197
|
-
lines.push(chalk6.dim(" " + "\u2500".repeat(
|
|
5192
|
+
lines.push(chalk6.dim(" " + "\u2500".repeat(Math.min(cols - 4, 90))));
|
|
5198
5193
|
for (let i = 0; i < recs.length; i++) {
|
|
5199
5194
|
const rec = recs[i];
|
|
5200
5195
|
const check = selected.has(i) ? chalk6.green("[x]") : "[ ]";
|
|
5201
5196
|
const ptr = i === cursor ? chalk6.cyan(">") : " ";
|
|
5202
5197
|
if (hasScores) {
|
|
5203
5198
|
const scoreColor = rec.score >= 90 ? chalk6.green : rec.score >= 70 ? chalk6.yellow : chalk6.dim;
|
|
5204
|
-
|
|
5199
|
+
const reasonMax = Math.max(cols - prefixWidth - scoreWidth - nameWidth - 2, 20);
|
|
5200
|
+
lines.push(` ${ptr} ${check} ${scoreColor(String(rec.score).padStart(3))} ${rec.name.padEnd(nameWidth)}${chalk6.dim(rec.reason.slice(0, reasonMax))}`);
|
|
5205
5201
|
} else {
|
|
5206
|
-
lines.push(` ${ptr} ${check} ${rec.name.padEnd(
|
|
5202
|
+
lines.push(` ${ptr} ${check} ${rec.name.padEnd(nameWidth)}${rec.detected_technology.padEnd(16)} ${chalk6.dim(rec.source_url || "")}`);
|
|
5207
5203
|
}
|
|
5208
5204
|
}
|
|
5209
5205
|
lines.push("");
|
|
@@ -5338,18 +5334,23 @@ async function installSkills(recs, platforms, contentMap) {
|
|
|
5338
5334
|
}
|
|
5339
5335
|
function printSkills(recs) {
|
|
5340
5336
|
const hasScores = recs.some((r) => r.score > 0);
|
|
5337
|
+
const cols = process.stdout.columns || 80;
|
|
5338
|
+
const nameWidth = Math.max(...recs.map((r) => r.name.length), 4) + 2;
|
|
5339
|
+
const scoreWidth = 6;
|
|
5340
|
+
const prefixWidth = 2;
|
|
5341
5341
|
console.log(chalk6.bold("\n Skills\n"));
|
|
5342
5342
|
if (hasScores) {
|
|
5343
|
-
console.log(
|
|
5343
|
+
console.log(" ".repeat(prefixWidth) + chalk6.dim("Score".padEnd(scoreWidth)) + chalk6.dim("Name".padEnd(nameWidth)) + chalk6.dim("Why"));
|
|
5344
5344
|
} else {
|
|
5345
|
-
console.log(
|
|
5345
|
+
console.log(" ".repeat(prefixWidth) + chalk6.dim("Name".padEnd(nameWidth)) + chalk6.dim("Technology".padEnd(18)) + chalk6.dim("Source"));
|
|
5346
5346
|
}
|
|
5347
|
-
console.log(chalk6.dim(" " + "\u2500".repeat(
|
|
5347
|
+
console.log(chalk6.dim(" " + "\u2500".repeat(Math.min(cols - 4, 90))));
|
|
5348
5348
|
for (const rec of recs) {
|
|
5349
5349
|
if (hasScores) {
|
|
5350
|
-
|
|
5350
|
+
const reasonMax = Math.max(cols - prefixWidth - scoreWidth - nameWidth - 2, 20);
|
|
5351
|
+
console.log(` ${String(rec.score).padStart(3)} ${rec.name.padEnd(nameWidth)}${chalk6.dim(rec.reason.slice(0, reasonMax))}`);
|
|
5351
5352
|
} else {
|
|
5352
|
-
console.log(` ${rec.name.padEnd(
|
|
5353
|
+
console.log(` ${rec.name.padEnd(nameWidth)}${rec.detected_technology.padEnd(16)} ${chalk6.dim(rec.source_url || "")}`);
|
|
5353
5354
|
}
|
|
5354
5355
|
}
|
|
5355
5356
|
console.log("");
|
|
@@ -5404,8 +5405,7 @@ async function initCommand(options) {
|
|
|
5404
5405
|
console.log(title.bold(" Step 2/6 \u2014 Discover your project\n"));
|
|
5405
5406
|
console.log(chalk7.dim(" Learning about your languages, dependencies, structure, and existing configs.\n"));
|
|
5406
5407
|
const spinner = ora3("Analyzing project...").start();
|
|
5407
|
-
const fingerprint = collectFingerprint(process.cwd());
|
|
5408
|
-
await enrichFingerprintWithLLM(fingerprint, process.cwd());
|
|
5408
|
+
const fingerprint = await collectFingerprint(process.cwd());
|
|
5409
5409
|
spinner.succeed("Project analyzed");
|
|
5410
5410
|
console.log(chalk7.dim(` Languages: ${fingerprint.languages.join(", ") || "none detected"}`));
|
|
5411
5411
|
console.log(chalk7.dim(` Files: ${fingerprint.fileTree.length} found
|
|
@@ -6055,8 +6055,7 @@ async function regenerateCommand(options) {
|
|
|
6055
6055
|
}
|
|
6056
6056
|
const targetAgent = readState()?.targetAgent ?? ["claude", "cursor"];
|
|
6057
6057
|
const spinner = ora5("Analyzing project...").start();
|
|
6058
|
-
const fingerprint = collectFingerprint(process.cwd());
|
|
6059
|
-
await enrichFingerprintWithLLM(fingerprint, process.cwd());
|
|
6058
|
+
const fingerprint = await collectFingerprint(process.cwd());
|
|
6060
6059
|
spinner.succeed("Project analyzed");
|
|
6061
6060
|
const baselineScore = computeLocalScore(process.cwd(), targetAgent);
|
|
6062
6061
|
displayScoreSummary(baselineScore);
|
|
@@ -6422,7 +6421,7 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
6422
6421
|
}
|
|
6423
6422
|
const spinner = quiet ? null : ora6(`${prefix}Analyzing changes...`).start();
|
|
6424
6423
|
const existingDocs = readExistingConfigs(repoDir);
|
|
6425
|
-
const fingerprint = collectFingerprint(repoDir);
|
|
6424
|
+
const fingerprint = await collectFingerprint(repoDir);
|
|
6426
6425
|
const projectContext = {
|
|
6427
6426
|
languages: fingerprint.languages,
|
|
6428
6427
|
frameworks: fingerprint.frameworks,
|
package/package.json
CHANGED