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

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 +69 -21
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -6535,7 +6535,7 @@ function validateSetup(setup, dir, checkExists = existsSync9) {
6535
6535
  }
6536
6536
  function buildFeedbackMessage(issues) {
6537
6537
  const lines = [
6538
- "Your generated config has these scoring issues. Fix ONLY these \u2014 do not rewrite, restructure, or make cosmetic changes to anything else:\n"
6538
+ "Fix ONLY these scoring issues \u2014 do not rewrite, restructure, or make cosmetic changes:\n"
6539
6539
  ];
6540
6540
  for (let i = 0; i < issues.length; i++) {
6541
6541
  const issue = issues[i];
@@ -6543,7 +6543,6 @@ function buildFeedbackMessage(issues) {
6543
6543
  lines.push(` Action: ${issue.fixInstruction}
6544
6544
  `);
6545
6545
  }
6546
- lines.push("Return the complete updated AgentSetup JSON with only these fixes applied.");
6547
6546
  return lines.join("\n");
6548
6547
  }
6549
6548
  function countIssuePoints(issues) {
@@ -6576,13 +6575,15 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
6576
6575
  const issueNames = issues.map((i) => i.check).join(", ");
6577
6576
  callbacks.onStatus(`Fixing ${issues.length} scoring issue${issues.length === 1 ? "" : "s"}: ${issueNames}...`);
6578
6577
  }
6579
- const feedbackMessage = buildFeedbackMessage(issues);
6580
- const refined = await refineSetupFast(currentSetup, feedbackMessage);
6578
+ const refined = await applyTargetedFixes(currentSetup, issues);
6581
6579
  if (!refined) {
6582
6580
  if (callbacks?.onStatus) callbacks.onStatus("Refinement failed, keeping current setup");
6583
6581
  return bestSetup;
6584
6582
  }
6585
- sessionHistory.push({ role: "user", content: feedbackMessage });
6583
+ sessionHistory.push({
6584
+ role: "user",
6585
+ content: `Fix scoring issues: ${issues.map((i) => i.check).join(", ")}`
6586
+ });
6586
6587
  sessionHistory.push({
6587
6588
  role: "assistant",
6588
6589
  content: `Applied scoring fixes for: ${issues.map((i) => i.check).join(", ")}`
@@ -6596,23 +6597,45 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
6596
6597
  }
6597
6598
  return bestSetup;
6598
6599
  }
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.`;
6600
+ async function applyTargetedFixes(setup, issues) {
6601
+ const { claudeMd, agentsMd } = extractConfigContent(setup);
6602
+ const targets = [];
6603
+ if (claudeMd) targets.push({ key: "claudeMd", label: "CLAUDE.md", content: claudeMd });
6604
+ if (agentsMd) targets.push({ key: "agentsMd", label: "AGENTS.md", content: agentsMd });
6605
+ if (targets.length === 0) return null;
6606
+ const feedbackMessage = buildFeedbackMessage(issues);
6607
+ const contentBlock = targets.map(
6608
+ (t) => `### ${t.label}
6609
+ \`\`\`markdown
6610
+ ${t.content}
6611
+ \`\`\``
6612
+ ).join("\n\n");
6613
+ const prompt = [
6614
+ "Here are the config files with scoring issues:\n",
6615
+ contentBlock,
6616
+ "\n",
6617
+ feedbackMessage,
6618
+ `
6619
+ Return ONLY the fixed content as a JSON object with keys ${targets.map((t) => `"${t.key}"`).join(", ")}. Each value is the fixed markdown string. No code fences, no explanations.`
6620
+ ].join("\n");
6606
6621
  try {
6607
6622
  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.",
6623
+ system: "You fix scoring issues in AI agent configuration files. Return only a JSON object with the fixed content \u2014 no explanations, no code fences.",
6609
6624
  prompt,
6610
- maxTokens: 16e3
6625
+ maxTokens: 8e3
6611
6626
  });
6612
6627
  const cleaned = stripMarkdownFences(raw);
6613
6628
  const jsonStart = cleaned.indexOf("{");
6614
6629
  const jsonToParse = jsonStart !== -1 ? cleaned.slice(jsonStart) : cleaned;
6615
- return JSON.parse(jsonToParse);
6630
+ const fixes = JSON.parse(jsonToParse);
6631
+ const patched = structuredClone(setup);
6632
+ for (const target of targets) {
6633
+ if (typeof fixes[target.key] === "string" && fixes[target.key].length > 50) {
6634
+ const parent = target.key === "claudeMd" ? patched.claude : patched.codex;
6635
+ if (parent) parent[target.key] = fixes[target.key];
6636
+ }
6637
+ }
6638
+ return patched;
6616
6639
  } catch {
6617
6640
  return null;
6618
6641
  }
@@ -7463,12 +7486,14 @@ ${agentRefs.join(" ")}
7463
7486
  log(options.verbose, ` Still failing: ${c.name} (${c.earnedPoints}/${c.maxPoints})${c.suggestion ? ` \u2014 ${c.suggestion}` : ""}`);
7464
7487
  }
7465
7488
  }
7489
+ let communitySkillsInstalled = 0;
7466
7490
  if (skillSearchResult.results.length > 0 && !options.autoApprove) {
7467
7491
  console.log(chalk11.dim(" Community skills matched to your project:\n"));
7468
7492
  const selected = await interactiveSelect(skillSearchResult.results);
7469
7493
  if (selected?.length) {
7470
7494
  await installSkills(selected, targetAgent, skillSearchResult.contentMap);
7471
7495
  trackInitSkillsSearch(true, selected.length);
7496
+ communitySkillsInstalled = selected.length;
7472
7497
  }
7473
7498
  }
7474
7499
  console.log("");
@@ -7504,9 +7529,10 @@ ${agentRefs.join(" ")}
7504
7529
  console.log(chalk11.dim(" Skipped auto-sync hooks. Run ") + chalk11.hex("#83D1EB")("caliber hooks --install") + chalk11.dim(" later to enable."));
7505
7530
  }
7506
7531
  const hasLearnableAgent = targetAgent.includes("claude") || targetAgent.includes("cursor");
7532
+ let enableLearn = false;
7507
7533
  if (hasLearnableAgent) {
7508
7534
  if (!options.autoApprove) {
7509
- const enableLearn = await promptLearnInstall(targetAgent);
7535
+ enableLearn = await promptLearnInstall(targetAgent);
7510
7536
  trackInitLearnEnabled(enableLearn);
7511
7537
  if (enableLearn) {
7512
7538
  if (targetAgent.includes("claude")) {
@@ -7524,6 +7550,7 @@ ${agentRefs.join(" ")}
7524
7550
  console.log(chalk11.dim(" Skipped. Run ") + chalk11.hex("#83D1EB")("caliber learn install") + chalk11.dim(" later to enable."));
7525
7551
  }
7526
7552
  } else {
7553
+ enableLearn = true;
7527
7554
  if (targetAgent.includes("claude")) installLearningHooks();
7528
7555
  if (targetAgent.includes("cursor")) installCursorLearningHooks();
7529
7556
  }
@@ -7531,11 +7558,32 @@ ${agentRefs.join(" ")}
7531
7558
  console.log(chalk11.bold.green("\n Setup complete!"));
7532
7559
  console.log(chalk11.dim(" Your AI agents now understand your project's architecture, build commands,"));
7533
7560
  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`);
7561
+ const done = chalk11.green("\u2713");
7562
+ const skip = chalk11.dim("\u2013");
7563
+ console.log(chalk11.bold(" What was set up:\n"));
7564
+ console.log(` ${done} Config generated ${title("caliber score")} for full breakdown`);
7565
+ const hooksInstalled = hookChoice !== "skip";
7566
+ if (hooksInstalled) {
7567
+ const hookLabel = hookChoice === "both" ? "pre-commit + Claude Code" : hookChoice === "precommit" ? "pre-commit" : "Claude Code";
7568
+ console.log(` ${done} Auto-sync hooks ${chalk11.dim(hookLabel + " \u2014 docs stay fresh automatically")}`);
7569
+ } else {
7570
+ console.log(` ${skip} Auto-sync hooks ${title("caliber hooks --install")} to enable later`);
7571
+ }
7572
+ if (hasLearnableAgent) {
7573
+ if (enableLearn) {
7574
+ console.log(` ${done} Session learning ${chalk11.dim("agent learns from your feedback")}`);
7575
+ } else {
7576
+ console.log(` ${skip} Session learning ${title("caliber learn install")} to enable later`);
7577
+ }
7578
+ }
7579
+ if (communitySkillsInstalled > 0) {
7580
+ console.log(` ${done} Community skills ${chalk11.dim(`${communitySkillsInstalled} skill${communitySkillsInstalled > 1 ? "s" : ""} installed for your stack`)}`);
7581
+ } else if (skillSearchResult.results.length > 0) {
7582
+ console.log(` ${skip} Community skills ${chalk11.dim("available but skipped")}`);
7583
+ }
7584
+ console.log(chalk11.bold("\n Explore next:\n"));
7585
+ console.log(` ${title("caliber skills")} Find more community skills as your codebase evolves`);
7586
+ console.log(` ${title("caliber score")} See the full scoring breakdown with improvement tips`);
7539
7587
  console.log(` ${title("caliber undo")} Revert all changes from this run`);
7540
7588
  console.log("");
7541
7589
  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.1773697587",
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": {