@rely-ai/caliber 1.12.3 → 1.12.5

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.
Files changed (2) hide show
  1. package/dist/bin.js +53 -52
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -2407,7 +2407,14 @@ These checks are currently PASSING \u2014 do NOT break them:`);
2407
2407
  }
2408
2408
  }
2409
2409
  parts.push(`
2410
- 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. If a skill file is not related to a failing check, return it EXACTLY as-is, character for character.`);
2410
+ IMPORTANT RULES FOR TARGETED FIX:
2411
+ - Return the existing CLAUDE.md and skills with MINIMAL changes \u2014 only the edits needed to fix the above checks.
2412
+ - Do NOT rewrite, restructure, rephrase, or make cosmetic changes.
2413
+ - Preserve the existing content as-is except for targeted fixes.
2414
+ - If a skill file is not related to a failing check, return it EXACTLY as-is, character for character.
2415
+ - For "Documented commands exist": DELETE the specific invalid commands listed in the suggestion. Do NOT replace them with other commands unless you are 100% certain they exist.
2416
+ - For "Documented paths exist": DELETE the specific non-existent paths listed in the suggestion. Do NOT replace them with guessed paths.
2417
+ - For "Concise context files": Remove the least important lines to get under the line limit. Do NOT add new content.`);
2411
2418
  } else if (hasExistingConfigs) {
2412
2419
  parts.push(`Audit and improve the existing coding agent configuration for target: ${targetAgent}`);
2413
2420
  } else {
@@ -3193,15 +3200,15 @@ function collectSetupFiles(setup) {
3193
3200
  if (claude) agentRefs.push("See `CLAUDE.md` for Claude Code configuration.");
3194
3201
  if (cursor) agentRefs.push("See `.cursor/rules/` for Cursor rules.");
3195
3202
  if (agentRefs.length === 0) agentRefs.push("See CLAUDE.md and .cursor/rules/ for agent configurations.");
3196
- files.push({
3197
- path: "AGENTS.md",
3198
- content: `# AGENTS.md
3203
+ const stubContent = `# AGENTS.md
3199
3204
 
3200
3205
  This project uses AI coding agents configured by [Caliber](https://github.com/rely-ai-org/caliber).
3201
3206
 
3202
3207
  ${agentRefs.join(" ")}
3203
- `
3204
- });
3208
+ `;
3209
+ files.push({ path: "AGENTS.md", content: stubContent });
3210
+ if (!setup.codex) setup.codex = {};
3211
+ setup.codex.agentsMd = stubContent;
3205
3212
  }
3206
3213
  return files;
3207
3214
  }
@@ -4398,7 +4405,7 @@ function checkAccuracy(dir) {
4398
4405
  earnedPoints: cmdPoints,
4399
4406
  passed: cmdRatio >= 0.8,
4400
4407
  detail: cmds.total === 0 ? "No commands documented" : `${cmds.valid.length}/${cmds.total} commands verified`,
4401
- suggestion: cmds.invalid.length > 0 ? `Invalid: ${cmds.invalid[0]}${cmds.invalid.length > 1 ? ` (+${cmds.invalid.length - 1} more)` : ""}` : void 0
4408
+ suggestion: cmds.invalid.length > 0 ? `Remove these invalid commands from CLAUDE.md: ${cmds.invalid.join("; ")}` : void 0
4402
4409
  });
4403
4410
  const paths = validateDocumentedPaths(dir);
4404
4411
  const pathRatio = paths.total > 0 ? paths.valid.length / paths.total : 1;
@@ -4411,7 +4418,7 @@ function checkAccuracy(dir) {
4411
4418
  earnedPoints: pathPoints,
4412
4419
  passed: pathRatio >= 0.8,
4413
4420
  detail: paths.total === 0 ? "No file paths documented" : `${paths.valid.length}/${paths.total} paths verified`,
4414
- suggestion: paths.invalid.length > 0 ? `Stale path: ${paths.invalid[0]}${paths.invalid.length > 1 ? ` (+${paths.invalid.length - 1} more)` : ""}` : void 0
4421
+ suggestion: paths.invalid.length > 0 ? `Remove these non-existent paths from CLAUDE.md: ${paths.invalid.join("; ")}` : void 0
4415
4422
  });
4416
4423
  const drift = detectConfigDrift(dir);
4417
4424
  let driftPoints = POINTS_CONFIG_DRIFT;
@@ -6031,6 +6038,43 @@ async function initCommand(options) {
6031
6038
  if (rawOutput) report.addCodeBlock("Generation: Raw LLM Response", rawOutput);
6032
6039
  report.addJson("Generation: Parsed Setup", generatedSetup);
6033
6040
  }
6041
+ {
6042
+ const preWriteResult = writeSetup(generatedSetup);
6043
+ const inlineScore = computeLocalScore(process.cwd(), targetAgent);
6044
+ if (inlineScore.score < 100) {
6045
+ const inlineFailingChecks = inlineScore.checks.filter((c) => !c.passed && c.maxPoints > 0).filter((c) => !NON_LLM_CHECKS.has(c.id));
6046
+ if (inlineFailingChecks.length > 0) {
6047
+ genSpinner.text = "Polishing generated setup...";
6048
+ log(options.verbose, `Inline polish: score ${inlineScore.score}/100, fixing ${inlineFailingChecks.length} checks`);
6049
+ try {
6050
+ const polishResult = await generateSetup(
6051
+ fingerprint,
6052
+ targetAgent,
6053
+ void 0,
6054
+ { onStatus: () => {
6055
+ }, onComplete: () => {
6056
+ }, onError: () => {
6057
+ } },
6058
+ inlineFailingChecks.map((c) => ({ name: c.name, suggestion: c.suggestion })),
6059
+ inlineScore.score,
6060
+ inlineScore.checks.filter((c) => c.passed).map((c) => ({ name: c.name })),
6061
+ { skipSkills: true, forceTargetedFix: true }
6062
+ );
6063
+ if (polishResult.setup) {
6064
+ generatedSetup = polishResult.setup;
6065
+ writeSetup(generatedSetup);
6066
+ log(options.verbose, "Inline polish applied");
6067
+ }
6068
+ } catch {
6069
+ log(options.verbose, "Inline polish failed, continuing with original");
6070
+ }
6071
+ }
6072
+ }
6073
+ try {
6074
+ undoSetup();
6075
+ } catch {
6076
+ }
6077
+ }
6034
6078
  const elapsedMs = Date.now() - genStartTime;
6035
6079
  trackInitGenerationCompleted(elapsedMs, 0);
6036
6080
  const mins = Math.floor(elapsedMs / 6e4);
@@ -6174,50 +6218,7 @@ async function initCommand(options) {
6174
6218
  if (hookChoice === "skip") {
6175
6219
  console.log(chalk8.dim(" Skipped auto-refresh hooks. Run ") + chalk8.hex("#83D1EB")("caliber hooks --install") + chalk8.dim(" later to enable."));
6176
6220
  }
6177
- let afterScore = computeLocalScore(process.cwd(), targetAgent);
6178
- if (afterScore.score < 100) {
6179
- const polishFailingChecks = afterScore.checks.filter((c) => !c.passed && c.maxPoints > 0).filter((c) => !NON_LLM_CHECKS.has(c.id));
6180
- if (polishFailingChecks.length > 0) {
6181
- console.log("");
6182
- console.log(chalk8.dim(` Score: ${afterScore.score}/100 \u2014 polishing ${polishFailingChecks.length} remaining check${polishFailingChecks.length === 1 ? "" : "s"}...`));
6183
- if (options.verbose) {
6184
- for (const c of polishFailingChecks) {
6185
- log(options.verbose, ` Polish target: ${c.name}${c.suggestion ? ` \u2014 ${c.suggestion}` : ""}`);
6186
- }
6187
- }
6188
- const polishFailing = polishFailingChecks.map((c) => ({
6189
- name: c.name,
6190
- suggestion: c.suggestion
6191
- }));
6192
- const polishPassing = afterScore.checks.filter((c) => c.passed).map((c) => ({ name: c.name }));
6193
- try {
6194
- const polishResult = await generateSetup(
6195
- fingerprint,
6196
- targetAgent,
6197
- void 0,
6198
- {
6199
- onStatus: () => {
6200
- },
6201
- onComplete: () => {
6202
- },
6203
- onError: () => {
6204
- }
6205
- },
6206
- polishFailing,
6207
- afterScore.score,
6208
- polishPassing,
6209
- { skipSkills: true, forceTargetedFix: true }
6210
- );
6211
- if (polishResult.setup) {
6212
- const polishWriteResult = writeSetup(polishResult.setup);
6213
- if (polishWriteResult.written.length > 0) {
6214
- afterScore = computeLocalScore(process.cwd(), targetAgent);
6215
- }
6216
- }
6217
- } catch {
6218
- }
6219
- }
6220
- }
6221
+ const afterScore = computeLocalScore(process.cwd(), targetAgent);
6221
6222
  if (afterScore.score < baselineScore.score) {
6222
6223
  trackInitScoreRegression(baselineScore.score, afterScore.score);
6223
6224
  console.log("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.12.3",
3
+ "version": "1.12.5",
4
4
  "description": "Analyze your codebase and generate optimized AI agent configs (CLAUDE.md, .cursorrules, skills) — no API key needed",
5
5
  "type": "module",
6
6
  "bin": {