@rely-ai/caliber 1.20.0-dev.1773696449 → 1.20.0-dev.1773696964

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 +66 -28
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -6576,18 +6576,12 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
6576
6576
  const issueNames = issues.map((i) => i.check).join(", ");
6577
6577
  callbacks.onStatus(`Fixing ${issues.length} scoring issue${issues.length === 1 ? "" : "s"}: ${issueNames}...`);
6578
6578
  }
6579
- const feedbackMessage = buildFeedbackMessage(issues);
6580
- const refined = await refineSetupFast(currentSetup, feedbackMessage);
6581
- if (!refined) {
6579
+ const patched = await applyTargetedFixes(currentSetup, issues, sessionHistory);
6580
+ if (!patched) {
6582
6581
  if (callbacks?.onStatus) callbacks.onStatus("Refinement failed, keeping current setup");
6583
6582
  return bestSetup;
6584
6583
  }
6585
- sessionHistory.push({ role: "user", content: feedbackMessage });
6586
- sessionHistory.push({
6587
- role: "assistant",
6588
- content: `Applied scoring fixes for: ${issues.map((i) => i.check).join(", ")}`
6589
- });
6590
- currentSetup = refined;
6584
+ currentSetup = patched;
6591
6585
  }
6592
6586
  const finalIssues = validateSetup(currentSetup, dir, cachedExists);
6593
6587
  const finalLostPoints = countIssuePoints(finalIssues);
@@ -6596,23 +6590,42 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
6596
6590
  }
6597
6591
  return bestSetup;
6598
6592
  }
6599
- async function refineSetupFast(setup, feedbackMessage) {
6600
- const prompt = `Current setup:
6601
- ${JSON.stringify(setup, null, 2)}
6602
-
6603
- ${feedbackMessage}
6604
-
6605
- Return the complete updated AgentSetup JSON with only these fixes applied. Respond with ONLY the JSON.`;
6593
+ async function applyTargetedFixes(setup, issues, sessionHistory) {
6594
+ const { claudeMd, agentsMd } = extractConfigContent(setup);
6595
+ const content = claudeMd ?? agentsMd;
6596
+ if (!content) return null;
6597
+ const feedbackMessage = buildFeedbackMessage(issues);
6598
+ const contentLabel = claudeMd ? "CLAUDE.md" : "AGENTS.md";
6599
+ const prompt = [
6600
+ `Here is the current ${contentLabel} content:
6601
+ `,
6602
+ "```markdown",
6603
+ content,
6604
+ "```\n",
6605
+ feedbackMessage,
6606
+ `
6607
+ Return ONLY the fixed ${contentLabel} content as raw markdown (no JSON, no code fences). Apply the fixes above and nothing else \u2014 do not rewrite, restructure, or make cosmetic changes.`
6608
+ ].join("\n");
6606
6609
  try {
6607
6610
  const raw = await llmCall({
6608
- system: "You fix scoring issues in AI agent configuration files. Return only the corrected JSON \u2014 no explanations, no code fences.",
6611
+ system: `You fix scoring issues in AI agent configuration files. Return only the fixed markdown content \u2014 no explanations, no JSON wrappers, no code fences.`,
6609
6612
  prompt,
6610
- maxTokens: 16e3
6613
+ maxTokens: 8e3
6614
+ });
6615
+ const fixed = stripMarkdownFences(raw).trim();
6616
+ if (!fixed || fixed.length < 50) return null;
6617
+ const patched = JSON.parse(JSON.stringify(setup));
6618
+ if (claudeMd) {
6619
+ patched.claude.claudeMd = fixed;
6620
+ } else {
6621
+ patched.codex.agentsMd = fixed;
6622
+ }
6623
+ sessionHistory.push({ role: "user", content: feedbackMessage });
6624
+ sessionHistory.push({
6625
+ role: "assistant",
6626
+ content: `Applied scoring fixes for: ${issues.map((i) => i.check).join(", ")}`
6611
6627
  });
6612
- const cleaned = stripMarkdownFences(raw);
6613
- const jsonStart = cleaned.indexOf("{");
6614
- const jsonToParse = jsonStart !== -1 ? cleaned.slice(jsonStart) : cleaned;
6615
- return JSON.parse(jsonToParse);
6628
+ return patched;
6616
6629
  } catch {
6617
6630
  return null;
6618
6631
  }
@@ -7463,12 +7476,14 @@ ${agentRefs.join(" ")}
7463
7476
  log(options.verbose, ` Still failing: ${c.name} (${c.earnedPoints}/${c.maxPoints})${c.suggestion ? ` \u2014 ${c.suggestion}` : ""}`);
7464
7477
  }
7465
7478
  }
7479
+ let communitySkillsInstalled = 0;
7466
7480
  if (skillSearchResult.results.length > 0 && !options.autoApprove) {
7467
7481
  console.log(chalk11.dim(" Community skills matched to your project:\n"));
7468
7482
  const selected = await interactiveSelect(skillSearchResult.results);
7469
7483
  if (selected?.length) {
7470
7484
  await installSkills(selected, targetAgent, skillSearchResult.contentMap);
7471
7485
  trackInitSkillsSearch(true, selected.length);
7486
+ communitySkillsInstalled = selected.length;
7472
7487
  }
7473
7488
  }
7474
7489
  console.log("");
@@ -7504,9 +7519,10 @@ ${agentRefs.join(" ")}
7504
7519
  console.log(chalk11.dim(" Skipped auto-sync hooks. Run ") + chalk11.hex("#83D1EB")("caliber hooks --install") + chalk11.dim(" later to enable."));
7505
7520
  }
7506
7521
  const hasLearnableAgent = targetAgent.includes("claude") || targetAgent.includes("cursor");
7522
+ let enableLearn = false;
7507
7523
  if (hasLearnableAgent) {
7508
7524
  if (!options.autoApprove) {
7509
- const enableLearn = await promptLearnInstall(targetAgent);
7525
+ enableLearn = await promptLearnInstall(targetAgent);
7510
7526
  trackInitLearnEnabled(enableLearn);
7511
7527
  if (enableLearn) {
7512
7528
  if (targetAgent.includes("claude")) {
@@ -7524,6 +7540,7 @@ ${agentRefs.join(" ")}
7524
7540
  console.log(chalk11.dim(" Skipped. Run ") + chalk11.hex("#83D1EB")("caliber learn install") + chalk11.dim(" later to enable."));
7525
7541
  }
7526
7542
  } else {
7543
+ enableLearn = true;
7527
7544
  if (targetAgent.includes("claude")) installLearningHooks();
7528
7545
  if (targetAgent.includes("cursor")) installCursorLearningHooks();
7529
7546
  }
@@ -7531,11 +7548,32 @@ ${agentRefs.join(" ")}
7531
7548
  console.log(chalk11.bold.green("\n Setup complete!"));
7532
7549
  console.log(chalk11.dim(" Your AI agents now understand your project's architecture, build commands,"));
7533
7550
  console.log(chalk11.dim(" testing patterns, and conventions. All changes are backed up automatically.\n"));
7534
- console.log(chalk11.bold(" Next steps:\n"));
7535
- console.log(` ${title("caliber score")} See your full config breakdown`);
7536
- console.log(` ${title("caliber refresh")} Update docs after code changes`);
7537
- console.log(` ${title("caliber hooks")} Toggle auto-refresh hooks`);
7538
- console.log(` ${title("caliber skills")} Discover community skills for your stack`);
7551
+ const done = chalk11.green("\u2713");
7552
+ const skip = chalk11.dim("\u2013");
7553
+ console.log(chalk11.bold(" What was set up:\n"));
7554
+ console.log(` ${done} Config generated ${title("caliber score")} for full breakdown`);
7555
+ const hooksInstalled = hookChoice !== "skip";
7556
+ if (hooksInstalled) {
7557
+ const hookLabel = hookChoice === "both" ? "pre-commit + Claude Code" : hookChoice === "precommit" ? "pre-commit" : "Claude Code";
7558
+ console.log(` ${done} Auto-sync hooks ${chalk11.dim(hookLabel + " \u2014 docs stay fresh automatically")}`);
7559
+ } else {
7560
+ console.log(` ${skip} Auto-sync hooks ${title("caliber hooks --install")} to enable later`);
7561
+ }
7562
+ if (hasLearnableAgent) {
7563
+ if (enableLearn) {
7564
+ console.log(` ${done} Session learning ${chalk11.dim("agent learns from your feedback")}`);
7565
+ } else {
7566
+ console.log(` ${skip} Session learning ${title("caliber learn install")} to enable later`);
7567
+ }
7568
+ }
7569
+ if (communitySkillsInstalled > 0) {
7570
+ console.log(` ${done} Community skills ${chalk11.dim(`${communitySkillsInstalled} skill${communitySkillsInstalled > 1 ? "s" : ""} installed for your stack`)}`);
7571
+ } else if (skillSearchResult.results.length > 0) {
7572
+ console.log(` ${skip} Community skills ${chalk11.dim("available but skipped")}`);
7573
+ }
7574
+ console.log(chalk11.bold("\n Explore next:\n"));
7575
+ console.log(` ${title("caliber skills")} Find more community skills as your codebase evolves`);
7576
+ console.log(` ${title("caliber score")} See the full scoring breakdown with improvement tips`);
7539
7577
  console.log(` ${title("caliber undo")} Revert all changes from this run`);
7540
7578
  console.log("");
7541
7579
  if (options.showTokens) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.20.0-dev.1773696449",
3
+ "version": "1.20.0-dev.1773696964",
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": {