@rely-ai/caliber 1.20.0-dev.1773695082 → 1.20.0-dev.1773695578

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 +71 -8
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -5816,6 +5816,9 @@ function trackSkillsInstalled(count) {
5816
5816
  function trackUndoExecuted() {
5817
5817
  trackEvent("undo_executed");
5818
5818
  }
5819
+ function trackInitLearnEnabled(enabled) {
5820
+ trackEvent("init_learn_enabled", { enabled });
5821
+ }
5819
5822
  function trackLearnSessionAnalyzed(props) {
5820
5823
  trackEvent("learn_session_analyzed", {
5821
5824
  event_count: props.eventCount,
@@ -7120,6 +7123,7 @@ async function initCommand(options) {
7120
7123
  const TASK_CONFIG = display.add("Generating configs");
7121
7124
  const TASK_SKILLS_GEN = display.add("Generating skills");
7122
7125
  const TASK_SKILLS_SEARCH = wantsSkills ? display.add("Searching community skills") : -1;
7126
+ const TASK_SCORE_REFINE = display.add("Validating & refining setup");
7123
7127
  display.start();
7124
7128
  display.enableWaitingContent();
7125
7129
  try {
@@ -7228,6 +7232,29 @@ async function initCommand(options) {
7228
7232
  }
7229
7233
  })() : Promise.resolve();
7230
7234
  await Promise.all([generatePromise, searchPromise]);
7235
+ if (generatedSetup) {
7236
+ display.update(TASK_SCORE_REFINE, "running");
7237
+ const sessionHistory2 = [];
7238
+ sessionHistory2.push({
7239
+ role: "assistant",
7240
+ content: summarizeSetup("Initial generation", generatedSetup)
7241
+ });
7242
+ try {
7243
+ const refined = await scoreAndRefine(generatedSetup, process.cwd(), sessionHistory2, {
7244
+ onStatus: (msg) => display.update(TASK_SCORE_REFINE, "running", msg)
7245
+ });
7246
+ if (refined !== generatedSetup) {
7247
+ display.update(TASK_SCORE_REFINE, "done", "Refined");
7248
+ generatedSetup = refined;
7249
+ } else {
7250
+ display.update(TASK_SCORE_REFINE, "done", "Passed");
7251
+ }
7252
+ } catch {
7253
+ display.update(TASK_SCORE_REFINE, "done", "Skipped");
7254
+ }
7255
+ } else {
7256
+ display.update(TASK_SCORE_REFINE, "failed", "No setup to validate");
7257
+ }
7231
7258
  } catch (err) {
7232
7259
  display.stop();
7233
7260
  const msg = err instanceof Error ? err.message : "Unknown error";
@@ -7265,7 +7292,6 @@ async function initCommand(options) {
7265
7292
  role: "assistant",
7266
7293
  content: summarizeSetup("Initial generation", generatedSetup)
7267
7294
  });
7268
- generatedSetup = await runScoreRefineWithSpinner(generatedSetup, process.cwd(), sessionHistory);
7269
7295
  console.log(title.bold(" Step 3/4 \u2014 Review\n"));
7270
7296
  const setupFiles = collectSetupFiles(generatedSetup, targetAgent);
7271
7297
  const staged = stageFiles(setupFiles, process.cwd());
@@ -7441,13 +7467,6 @@ ${agentRefs.join(" ")}
7441
7467
  } else if (hookResult.alreadyInstalled) {
7442
7468
  console.log(chalk11.dim(" Claude Code hook already installed"));
7443
7469
  }
7444
- const learnResult = installLearningHooks();
7445
- if (learnResult.installed) {
7446
- console.log(` ${chalk11.green("\u2713")} Learning hooks installed \u2014 session insights captured automatically`);
7447
- console.log(chalk11.dim(" Run ") + chalk11.hex("#83D1EB")("caliber learn remove") + chalk11.dim(" to disable"));
7448
- } else if (learnResult.alreadyInstalled) {
7449
- console.log(chalk11.dim(" Learning hooks already installed"));
7450
- }
7451
7470
  }
7452
7471
  if (hookChoice === "precommit" || hookChoice === "both") {
7453
7472
  const precommitResult = installPreCommitHook();
@@ -7463,6 +7482,31 @@ ${agentRefs.join(" ")}
7463
7482
  if (hookChoice === "skip") {
7464
7483
  console.log(chalk11.dim(" Skipped auto-sync hooks. Run ") + chalk11.hex("#83D1EB")("caliber hooks --install") + chalk11.dim(" later to enable."));
7465
7484
  }
7485
+ const hasLearnableAgent = targetAgent.includes("claude") || targetAgent.includes("cursor");
7486
+ if (hasLearnableAgent) {
7487
+ if (!options.autoApprove) {
7488
+ const enableLearn = await promptLearnInstall(targetAgent);
7489
+ trackInitLearnEnabled(enableLearn);
7490
+ if (enableLearn) {
7491
+ if (targetAgent.includes("claude")) {
7492
+ const r = installLearningHooks();
7493
+ if (r.installed) console.log(` ${chalk11.green("\u2713")} Learning hooks installed for Claude Code`);
7494
+ else if (r.alreadyInstalled) console.log(chalk11.dim(" Claude Code learning hooks already installed"));
7495
+ }
7496
+ if (targetAgent.includes("cursor")) {
7497
+ const r = installCursorLearningHooks();
7498
+ if (r.installed) console.log(` ${chalk11.green("\u2713")} Learning hooks installed for Cursor`);
7499
+ else if (r.alreadyInstalled) console.log(chalk11.dim(" Cursor learning hooks already installed"));
7500
+ }
7501
+ console.log(chalk11.dim(" Run ") + chalk11.hex("#83D1EB")("caliber learn status") + chalk11.dim(" to see insights"));
7502
+ } else {
7503
+ console.log(chalk11.dim(" Skipped. Run ") + chalk11.hex("#83D1EB")("caliber learn install") + chalk11.dim(" later to enable."));
7504
+ }
7505
+ } else {
7506
+ if (targetAgent.includes("claude")) installLearningHooks();
7507
+ if (targetAgent.includes("cursor")) installCursorLearningHooks();
7508
+ }
7509
+ }
7466
7510
  console.log(chalk11.bold.green("\n Setup complete!"));
7467
7511
  console.log(chalk11.dim(" Your AI agents now understand your project's architecture, build commands,"));
7468
7512
  console.log(chalk11.dim(" testing patterns, and conventions. All changes are backed up automatically.\n"));
@@ -7619,6 +7663,25 @@ async function promptHookType(targetAgent) {
7619
7663
  choices
7620
7664
  });
7621
7665
  }
7666
+ async function promptLearnInstall(targetAgent) {
7667
+ const hasClaude = targetAgent.includes("claude");
7668
+ const hasCursor = targetAgent.includes("cursor");
7669
+ const agentName = hasClaude && hasCursor ? "Claude and Cursor" : hasClaude ? "Claude" : "Cursor";
7670
+ console.log(chalk11.bold(`
7671
+ Session Learning
7672
+ `));
7673
+ console.log(chalk11.dim(` Caliber can learn from your ${agentName} sessions \u2014 when a tool fails`));
7674
+ console.log(chalk11.dim(` or you correct a mistake, it captures the lesson so it won't`));
7675
+ console.log(chalk11.dim(` happen again. Runs once at session end using the fast model.
7676
+ `));
7677
+ return select5({
7678
+ message: "Enable session learning?",
7679
+ choices: [
7680
+ { name: "Enable session learning (recommended)", value: true },
7681
+ { name: "Skip for now", value: false }
7682
+ ]
7683
+ });
7684
+ }
7622
7685
  async function promptReviewAction(hasSkillResults = false) {
7623
7686
  const acceptLabel = hasSkillResults ? "Accept and continue to community skills" : "Accept and apply";
7624
7687
  return select5({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.20.0-dev.1773695082",
3
+ "version": "1.20.0-dev.1773695578",
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": {