@rely-ai/caliber 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +65 -22
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -446,7 +446,7 @@ var CONFIG_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
|
446
446
|
var CONFIG_GLOBS_DIRS = [
|
|
447
447
|
{ dir: ".github/workflows", pattern: /\.ya?ml$/ }
|
|
448
448
|
];
|
|
449
|
-
var TOTAL_BUDGET =
|
|
449
|
+
var TOTAL_BUDGET = 6e5;
|
|
450
450
|
var CONFIG_BUDGET = Math.floor(TOTAL_BUDGET * 0.15);
|
|
451
451
|
var SOURCE_BUDGET = Math.floor(TOTAL_BUDGET * 0.85);
|
|
452
452
|
function analyzeCode(dir) {
|
|
@@ -3795,7 +3795,7 @@ async function runInteractiveProviderSetup(options) {
|
|
|
3795
3795
|
}
|
|
3796
3796
|
|
|
3797
3797
|
// src/scoring/index.ts
|
|
3798
|
-
import { existsSync as
|
|
3798
|
+
import { existsSync as existsSync7 } from "fs";
|
|
3799
3799
|
import { join as join8 } from "path";
|
|
3800
3800
|
|
|
3801
3801
|
// src/scoring/checks/existence.ts
|
|
@@ -4144,12 +4144,25 @@ function collectProjectStructure(dir, maxDepth = 2) {
|
|
|
4144
4144
|
walk(dir, 0);
|
|
4145
4145
|
return { dirs, files };
|
|
4146
4146
|
}
|
|
4147
|
-
function
|
|
4147
|
+
function collectPrimaryConfigContent(dir) {
|
|
4148
4148
|
const parts = [];
|
|
4149
4149
|
for (const file of ["CLAUDE.md", ".cursorrules", "AGENTS.md"]) {
|
|
4150
4150
|
const content = readFileOrNull2(join3(dir, file));
|
|
4151
4151
|
if (content) parts.push(content);
|
|
4152
4152
|
}
|
|
4153
|
+
try {
|
|
4154
|
+
const rulesDir = join3(dir, ".cursor", "rules");
|
|
4155
|
+
const mdcFiles = readdirSync2(rulesDir).filter((f) => f.endsWith(".mdc"));
|
|
4156
|
+
for (const f of mdcFiles) {
|
|
4157
|
+
const content = readFileOrNull2(join3(rulesDir, f));
|
|
4158
|
+
if (content) parts.push(content);
|
|
4159
|
+
}
|
|
4160
|
+
} catch {
|
|
4161
|
+
}
|
|
4162
|
+
return parts.join("\n");
|
|
4163
|
+
}
|
|
4164
|
+
function collectAllConfigContent(dir) {
|
|
4165
|
+
const parts = [collectPrimaryConfigContent(dir)];
|
|
4153
4166
|
for (const skillsDir of [join3(dir, ".claude", "skills"), join3(dir, ".agents", "skills")]) {
|
|
4154
4167
|
try {
|
|
4155
4168
|
const entries = readdirSync2(skillsDir, { withFileTypes: true });
|
|
@@ -4165,15 +4178,6 @@ function collectAllConfigContent(dir) {
|
|
|
4165
4178
|
} catch {
|
|
4166
4179
|
}
|
|
4167
4180
|
}
|
|
4168
|
-
try {
|
|
4169
|
-
const rulesDir = join3(dir, ".cursor", "rules");
|
|
4170
|
-
const mdcFiles = readdirSync2(rulesDir).filter((f) => f.endsWith(".mdc"));
|
|
4171
|
-
for (const f of mdcFiles) {
|
|
4172
|
-
const content = readFileOrNull2(join3(rulesDir, f));
|
|
4173
|
-
if (content) parts.push(content);
|
|
4174
|
-
}
|
|
4175
|
-
} catch {
|
|
4176
|
-
}
|
|
4177
4181
|
return parts.join("\n");
|
|
4178
4182
|
}
|
|
4179
4183
|
function estimateTokens2(text) {
|
|
@@ -4289,7 +4293,7 @@ function checkQuality(dir) {
|
|
|
4289
4293
|
instruction: `Add code blocks with executable commands. Currently ${codeBlockCount}, need at least 3 for full points.`
|
|
4290
4294
|
} : void 0
|
|
4291
4295
|
});
|
|
4292
|
-
const totalContent =
|
|
4296
|
+
const totalContent = collectPrimaryConfigContent(dir);
|
|
4293
4297
|
const totalTokens = estimateTokens2(totalContent);
|
|
4294
4298
|
const tokenThreshold = TOKEN_BUDGET_THRESHOLDS.find((t) => totalTokens <= t.maxTokens);
|
|
4295
4299
|
const tokenPoints = totalContent.length === 0 ? POINTS_CONCISE_CONFIG : tokenThreshold?.points ?? 0;
|
|
@@ -4521,11 +4525,11 @@ function checkGrounding(dir) {
|
|
|
4521
4525
|
}
|
|
4522
4526
|
|
|
4523
4527
|
// src/scoring/checks/accuracy.ts
|
|
4524
|
-
import { existsSync as existsSync4 } from "fs";
|
|
4528
|
+
import { existsSync as existsSync4, statSync as statSync2 } from "fs";
|
|
4525
4529
|
import { execSync as execSync8 } from "child_process";
|
|
4526
4530
|
import { join as join5 } from "path";
|
|
4527
4531
|
function validateReferences(dir) {
|
|
4528
|
-
const configContent =
|
|
4532
|
+
const configContent = collectPrimaryConfigContent(dir);
|
|
4529
4533
|
if (!configContent) return { valid: [], invalid: [], total: 0 };
|
|
4530
4534
|
const refs = extractReferences(configContent);
|
|
4531
4535
|
const valid = [];
|
|
@@ -4559,6 +4563,25 @@ function detectGitDrift(dir) {
|
|
|
4559
4563
|
return { commitsSinceConfigUpdate: 0, lastConfigCommit: null, isGitRepo: false };
|
|
4560
4564
|
}
|
|
4561
4565
|
const configFiles = ["CLAUDE.md", "AGENTS.md", ".cursorrules", ".cursor/rules"];
|
|
4566
|
+
try {
|
|
4567
|
+
const headTimestamp = execSync8(
|
|
4568
|
+
"git log -1 --format=%ct HEAD",
|
|
4569
|
+
{ cwd: dir, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
4570
|
+
).trim();
|
|
4571
|
+
const headTime = parseInt(headTimestamp, 10) * 1e3;
|
|
4572
|
+
for (const file of configFiles) {
|
|
4573
|
+
const filePath = join5(dir, file);
|
|
4574
|
+
if (!existsSync4(filePath)) continue;
|
|
4575
|
+
try {
|
|
4576
|
+
const mtime = statSync2(filePath).mtime.getTime();
|
|
4577
|
+
if (mtime > headTime) {
|
|
4578
|
+
return { commitsSinceConfigUpdate: 0, lastConfigCommit: "uncommitted (recently modified)", isGitRepo: true };
|
|
4579
|
+
}
|
|
4580
|
+
} catch {
|
|
4581
|
+
}
|
|
4582
|
+
}
|
|
4583
|
+
} catch {
|
|
4584
|
+
}
|
|
4562
4585
|
let latestConfigCommitHash = null;
|
|
4563
4586
|
for (const file of configFiles) {
|
|
4564
4587
|
try {
|
|
@@ -4662,10 +4685,30 @@ function checkAccuracy(dir) {
|
|
|
4662
4685
|
}
|
|
4663
4686
|
|
|
4664
4687
|
// src/scoring/checks/freshness.ts
|
|
4688
|
+
import { existsSync as existsSync5, statSync as statSync3 } from "fs";
|
|
4665
4689
|
import { execSync as execSync9 } from "child_process";
|
|
4666
4690
|
import { join as join6 } from "path";
|
|
4667
4691
|
function getCommitsSinceConfigUpdate(dir) {
|
|
4668
4692
|
const configFiles = ["CLAUDE.md", "AGENTS.md", ".cursorrules"];
|
|
4693
|
+
try {
|
|
4694
|
+
const headTimestamp = execSync9(
|
|
4695
|
+
"git log -1 --format=%ct HEAD",
|
|
4696
|
+
{ cwd: dir, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
4697
|
+
).trim();
|
|
4698
|
+
const headTime = parseInt(headTimestamp, 10) * 1e3;
|
|
4699
|
+
for (const file of configFiles) {
|
|
4700
|
+
const filePath = join6(dir, file);
|
|
4701
|
+
if (!existsSync5(filePath)) continue;
|
|
4702
|
+
try {
|
|
4703
|
+
const mtime = statSync3(filePath).mtime.getTime();
|
|
4704
|
+
if (mtime > headTime) {
|
|
4705
|
+
return 0;
|
|
4706
|
+
}
|
|
4707
|
+
} catch {
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
} catch {
|
|
4711
|
+
}
|
|
4669
4712
|
for (const file of configFiles) {
|
|
4670
4713
|
try {
|
|
4671
4714
|
const hash = execSync9(
|
|
@@ -4790,7 +4833,7 @@ function checkFreshness(dir) {
|
|
|
4790
4833
|
}
|
|
4791
4834
|
|
|
4792
4835
|
// src/scoring/checks/bonus.ts
|
|
4793
|
-
import { existsSync as
|
|
4836
|
+
import { existsSync as existsSync6, readdirSync as readdirSync3 } from "fs";
|
|
4794
4837
|
import { execSync as execSync10 } from "child_process";
|
|
4795
4838
|
import { join as join7 } from "path";
|
|
4796
4839
|
function hasPreCommitHook(dir) {
|
|
@@ -4840,7 +4883,7 @@ function checkBonus(dir) {
|
|
|
4840
4883
|
instruction: "Install caliber hooks for automatic config refresh on commits."
|
|
4841
4884
|
}
|
|
4842
4885
|
});
|
|
4843
|
-
const agentsMdExists =
|
|
4886
|
+
const agentsMdExists = existsSync6(join7(dir, "AGENTS.md"));
|
|
4844
4887
|
checks.push({
|
|
4845
4888
|
id: "agents_md_exists",
|
|
4846
4889
|
name: "AGENTS.md exists",
|
|
@@ -4938,9 +4981,9 @@ function filterChecksForTarget(checks, target) {
|
|
|
4938
4981
|
}
|
|
4939
4982
|
function detectTargetAgent(dir) {
|
|
4940
4983
|
const agents = [];
|
|
4941
|
-
if (
|
|
4942
|
-
if (
|
|
4943
|
-
if (
|
|
4984
|
+
if (existsSync7(join8(dir, "CLAUDE.md")) || existsSync7(join8(dir, ".claude", "skills"))) agents.push("claude");
|
|
4985
|
+
if (existsSync7(join8(dir, ".cursorrules")) || existsSync7(join8(dir, ".cursor", "rules"))) agents.push("cursor");
|
|
4986
|
+
if (existsSync7(join8(dir, ".codex")) || existsSync7(join8(dir, ".agents", "skills"))) agents.push("codex");
|
|
4944
4987
|
return agents.length > 0 ? agents : ["claude"];
|
|
4945
4988
|
}
|
|
4946
4989
|
function computeLocalScore(dir, targetAgent) {
|
|
@@ -5104,7 +5147,7 @@ function displayScoreDelta(before, after) {
|
|
|
5104
5147
|
import chalk7 from "chalk";
|
|
5105
5148
|
import ora from "ora";
|
|
5106
5149
|
import select4 from "@inquirer/select";
|
|
5107
|
-
import { mkdirSync, readFileSync as readFileSync4, readdirSync as readdirSync4, existsSync as
|
|
5150
|
+
import { mkdirSync, readFileSync as readFileSync4, readdirSync as readdirSync4, existsSync as existsSync8, writeFileSync } from "fs";
|
|
5108
5151
|
import { join as join9, dirname as dirname2 } from "path";
|
|
5109
5152
|
|
|
5110
5153
|
// src/scanner/index.ts
|
|
@@ -5605,7 +5648,7 @@ Already installed skills: ${Array.from(installed).join(", ")}`);
|
|
|
5605
5648
|
}
|
|
5606
5649
|
function extractTopDeps() {
|
|
5607
5650
|
const pkgPath = join9(process.cwd(), "package.json");
|
|
5608
|
-
if (!
|
|
5651
|
+
if (!existsSync8(pkgPath)) return [];
|
|
5609
5652
|
try {
|
|
5610
5653
|
const pkg3 = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
5611
5654
|
const deps = Object.keys(pkg3.dependencies ?? {});
|
package/package.json
CHANGED