@rely-ai/caliber 0.3.0 → 0.4.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 +46 -8
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -326,6 +326,7 @@ var IGNORE_DIRS2 = /* @__PURE__ */ new Set([
|
|
|
326
326
|
]);
|
|
327
327
|
var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".py"]);
|
|
328
328
|
var CONFIG_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
329
|
+
"package.json",
|
|
329
330
|
"Dockerfile",
|
|
330
331
|
"docker-compose.yml",
|
|
331
332
|
"docker-compose.yaml",
|
|
@@ -333,6 +334,10 @@ var CONFIG_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
|
333
334
|
"tsconfig.json",
|
|
334
335
|
"pyproject.toml",
|
|
335
336
|
"turbo.json",
|
|
337
|
+
"requirements.txt",
|
|
338
|
+
"go.mod",
|
|
339
|
+
"Cargo.toml",
|
|
340
|
+
"Gemfile",
|
|
336
341
|
"next.config.js",
|
|
337
342
|
"next.config.mjs",
|
|
338
343
|
"next.config.ts",
|
|
@@ -1541,9 +1546,9 @@ function isTransientError2(error) {
|
|
|
1541
1546
|
const msg = error.message.toLowerCase();
|
|
1542
1547
|
return TRANSIENT_ERRORS.some((e) => msg.includes(e.toLowerCase()));
|
|
1543
1548
|
}
|
|
1544
|
-
async function generateSetup(fingerprint, targetAgent, prompt, callbacks) {
|
|
1549
|
+
async function generateSetup(fingerprint, targetAgent, prompt, callbacks, failingChecks, currentScore) {
|
|
1545
1550
|
const provider = getProvider();
|
|
1546
|
-
const userMessage = buildGeneratePrompt(fingerprint, targetAgent, prompt);
|
|
1551
|
+
const userMessage = buildGeneratePrompt(fingerprint, targetAgent, prompt, failingChecks, currentScore);
|
|
1547
1552
|
let attempt = 0;
|
|
1548
1553
|
const attemptGeneration = async () => {
|
|
1549
1554
|
attempt++;
|
|
@@ -1643,7 +1648,7 @@ var LIMITS = {
|
|
|
1643
1648
|
SKILLS_MAX: 10,
|
|
1644
1649
|
SKILL_CHARS: 3e3,
|
|
1645
1650
|
RULES_MAX: 10,
|
|
1646
|
-
CONFIG_FILES_MAX:
|
|
1651
|
+
CONFIG_FILES_MAX: 15,
|
|
1647
1652
|
CONFIG_FILE_CHARS: 3e3,
|
|
1648
1653
|
ROUTES_MAX: 50,
|
|
1649
1654
|
FILE_SUMMARIES_MAX: 60
|
|
@@ -1653,11 +1658,21 @@ function truncate(text, maxChars) {
|
|
|
1653
1658
|
return text.slice(0, maxChars) + `
|
|
1654
1659
|
... (truncated at ${maxChars} chars)`;
|
|
1655
1660
|
}
|
|
1656
|
-
function buildGeneratePrompt(fingerprint, targetAgent, prompt) {
|
|
1661
|
+
function buildGeneratePrompt(fingerprint, targetAgent, prompt, failingChecks, currentScore) {
|
|
1657
1662
|
const parts = [];
|
|
1658
1663
|
const existing = fingerprint.existingConfigs;
|
|
1659
1664
|
const hasExistingConfigs = !!(existing.claudeMd || existing.claudeSettings || existing.claudeSkills?.length || existing.readmeMd || existing.cursorrules || existing.cursorRules?.length);
|
|
1660
|
-
|
|
1665
|
+
const isTargetedFix = failingChecks && failingChecks.length > 0 && currentScore !== void 0 && currentScore >= 95;
|
|
1666
|
+
if (isTargetedFix) {
|
|
1667
|
+
parts.push(`TARGETED FIX MODE \u2014 current score: ${currentScore}/100, target: ${targetAgent}`);
|
|
1668
|
+
parts.push(`
|
|
1669
|
+
The existing config is already high quality. ONLY fix these specific failing checks:`);
|
|
1670
|
+
for (const check of failingChecks) {
|
|
1671
|
+
parts.push(`- ${check.name}${check.suggestion ? `: ${check.suggestion}` : ""}`);
|
|
1672
|
+
}
|
|
1673
|
+
parts.push(`
|
|
1674
|
+
IMPORTANT: Return the existing CLAUDE.md and skills with MINIMAL changes \u2014 only the edits needed to fix the above checks. Do NOT rewrite, restructure, rephrase, or make cosmetic changes. Preserve the existing content as-is except for targeted fixes.`);
|
|
1675
|
+
} else if (hasExistingConfigs) {
|
|
1661
1676
|
parts.push(`Audit and improve the existing coding agent configuration for target: ${targetAgent}`);
|
|
1662
1677
|
} else {
|
|
1663
1678
|
parts.push(`Generate an initial coding agent configuration for target: ${targetAgent}`);
|
|
@@ -3777,12 +3792,33 @@ async function initCommand(options) {
|
|
|
3777
3792
|
`));
|
|
3778
3793
|
const targetAgent = options.agent || await promptAgent();
|
|
3779
3794
|
const baselineScore = computeLocalScore(process.cwd(), targetAgent);
|
|
3795
|
+
const hasExistingConfig = !!(fingerprint.existingConfigs.claudeMd || fingerprint.existingConfigs.claudeSettings || fingerprint.existingConfigs.claudeSkills?.length || fingerprint.existingConfigs.cursorrules || fingerprint.existingConfigs.cursorRules?.length);
|
|
3796
|
+
if (hasExistingConfig && baselineScore.score === 100) {
|
|
3797
|
+
console.log(chalk4.hex("#6366f1").bold(" Step 3/4 \u2014 Score check\n"));
|
|
3798
|
+
displayScore(baselineScore);
|
|
3799
|
+
console.log(chalk4.bold.green(" Your setup is already optimal \u2014 nothing to change.\n"));
|
|
3800
|
+
console.log(chalk4.dim(" Run `caliber init --force` to regenerate anyway.\n"));
|
|
3801
|
+
if (!options.force) return;
|
|
3802
|
+
}
|
|
3780
3803
|
const isEmpty = fingerprint.fileTree.length < 3;
|
|
3781
3804
|
if (isEmpty) {
|
|
3782
3805
|
fingerprint.description = await promptInput2("What will you build in this project?");
|
|
3783
3806
|
}
|
|
3784
|
-
|
|
3785
|
-
|
|
3807
|
+
let failingChecks;
|
|
3808
|
+
let currentScore;
|
|
3809
|
+
if (hasExistingConfig && baselineScore.score >= 95 && !options.force) {
|
|
3810
|
+
failingChecks = baselineScore.checks.filter((c) => !c.passed && c.maxPoints > 0).map((c) => ({ name: c.name, suggestion: c.suggestion }));
|
|
3811
|
+
currentScore = baselineScore.score;
|
|
3812
|
+
if (failingChecks.length > 0) {
|
|
3813
|
+
console.log(chalk4.hex("#6366f1").bold(" Step 3/4 \u2014 Targeted fixes\n"));
|
|
3814
|
+
console.log(chalk4.dim(` Score is ${baselineScore.score}/100 \u2014 only fixing ${failingChecks.length} remaining issue${failingChecks.length === 1 ? "" : "s"}:
|
|
3815
|
+
`));
|
|
3816
|
+
for (const check of failingChecks) {
|
|
3817
|
+
console.log(chalk4.dim(` \u2022 ${check.name}`));
|
|
3818
|
+
}
|
|
3819
|
+
console.log("");
|
|
3820
|
+
}
|
|
3821
|
+
} else if (hasExistingConfig) {
|
|
3786
3822
|
console.log(chalk4.hex("#6366f1").bold(" Step 3/4 \u2014 Auditing your configs\n"));
|
|
3787
3823
|
console.log(chalk4.dim(" AI is reviewing your existing configs against your codebase"));
|
|
3788
3824
|
console.log(chalk4.dim(" and suggesting improvements.\n"));
|
|
@@ -3813,7 +3849,9 @@ async function initCommand(options) {
|
|
|
3813
3849
|
genMessages.stop();
|
|
3814
3850
|
genSpinner.fail(`Generation error: ${error}`);
|
|
3815
3851
|
}
|
|
3816
|
-
}
|
|
3852
|
+
},
|
|
3853
|
+
failingChecks,
|
|
3854
|
+
currentScore
|
|
3817
3855
|
);
|
|
3818
3856
|
if (!generatedSetup) {
|
|
3819
3857
|
generatedSetup = result.setup;
|
package/package.json
CHANGED