@caliber-ai/cli 0.20.0 → 0.20.2

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 CHANGED
@@ -1514,7 +1514,7 @@ function stageFiles(files, projectDir) {
1514
1514
  fs15.mkdirSync(path14.dirname(currentPath), { recursive: true });
1515
1515
  fs15.copyFileSync(originalPath, currentPath);
1516
1516
  modifiedFiles++;
1517
- stagedFiles.push({ relativePath: file.path, proposedPath, currentPath, isNew: false });
1517
+ stagedFiles.push({ relativePath: file.path, proposedPath, currentPath, originalPath, isNew: false });
1518
1518
  } else {
1519
1519
  newFiles++;
1520
1520
  stagedFiles.push({ relativePath: file.path, proposedPath, isNew: true });
@@ -1529,7 +1529,7 @@ function cleanupStaging() {
1529
1529
  }
1530
1530
 
1531
1531
  // src/utils/editor.ts
1532
- import { execSync as execSync2, spawnSync } from "child_process";
1532
+ import { execSync as execSync2, spawn } from "child_process";
1533
1533
  function commandExists(cmd) {
1534
1534
  try {
1535
1535
  execSync2(`which ${cmd}`, { stdio: "ignore" });
@@ -1549,10 +1549,16 @@ function openDiffsInEditor(editor, files) {
1549
1549
  const cmd = editor === "cursor" ? "cursor" : "code";
1550
1550
  for (const file of files) {
1551
1551
  try {
1552
- if (file.currentPath) {
1553
- spawnSync(cmd, ["--diff", file.currentPath, file.proposedPath], { stdio: "ignore" });
1552
+ if (file.originalPath) {
1553
+ spawn(cmd, ["--diff", file.originalPath, file.proposedPath], {
1554
+ stdio: "ignore",
1555
+ detached: true
1556
+ }).unref();
1554
1557
  } else {
1555
- spawnSync(cmd, [file.proposedPath], { stdio: "ignore" });
1558
+ spawn(cmd, [file.proposedPath], {
1559
+ stdio: "ignore",
1560
+ detached: true
1561
+ }).unref();
1556
1562
  }
1557
1563
  } catch {
1558
1564
  continue;
@@ -2049,9 +2055,8 @@ async function initCommand(options) {
2049
2055
  console.log(chalk3.bold.green("\nSetup complete! Your coding agent is now configured."));
2050
2056
  console.log(chalk3.dim("Run `caliber undo` to revert changes.\n"));
2051
2057
  console.log(chalk3.bold(" Next steps:\n"));
2052
- console.log(` ${chalk3.hex("#6366f1")("caliber health")} Check your config quality and fix issues`);
2053
2058
  console.log(` ${chalk3.hex("#6366f1")("caliber recommend")} Discover additional skills for your stack`);
2054
- console.log(` ${chalk3.hex("#6366f1")("caliber diff")} See what changed since last setup`);
2059
+ console.log(` ${chalk3.hex("#6366f1")("caliber undo")} Revert all changes from this run`);
2055
2060
  console.log("");
2056
2061
  }
2057
2062
  async function refineLoop(currentSetup, _targetAgent) {
@@ -2068,6 +2073,7 @@ async function refineLoop(currentSetup, _targetAgent) {
2068
2073
  refinementRound++;
2069
2074
  trackEvent("refinement_message_sent", { refinement_round: refinementRound });
2070
2075
  let refined = null;
2076
+ let streamError = null;
2071
2077
  const refineSpinner = ora2("Refining setup...").start();
2072
2078
  const refineMessages = new SpinnerMessages(refineSpinner, REFINE_MESSAGES);
2073
2079
  refineMessages.start();
@@ -2080,21 +2086,26 @@ async function refineLoop(currentSetup, _targetAgent) {
2080
2086
  refined = payload.setup;
2081
2087
  },
2082
2088
  (error) => {
2083
- refineMessages.stop();
2084
- refineSpinner.fail(`Refinement error: ${error}`);
2089
+ streamError = error;
2085
2090
  },
2086
2091
  (status) => {
2087
2092
  refineMessages.handleServerStatus(status);
2088
2093
  }
2089
2094
  );
2090
2095
  refineMessages.stop();
2091
- if (refined) {
2096
+ if (streamError) {
2097
+ refineSpinner.fail(`Refinement failed: ${streamError}`);
2098
+ console.log(chalk3.dim('Try rephrasing your request, or type "done" to keep the current setup.'));
2099
+ } else if (refined) {
2092
2100
  currentSetup = refined;
2093
2101
  history.push({ role: "user", content: message });
2094
2102
  history.push({ role: "assistant", content: JSON.stringify(refined) });
2095
2103
  refineSpinner.succeed("Setup updated");
2096
2104
  printSetupSummary(refined);
2097
2105
  console.log(chalk3.dim('Type "done" to accept, or describe more changes.'));
2106
+ } else {
2107
+ refineSpinner.fail("Refinement failed \u2014 could not parse AI response.");
2108
+ console.log(chalk3.dim('Try rephrasing your request, or type "done" to keep the current setup.'));
2098
2109
  }
2099
2110
  }
2100
2111
  }
@@ -2135,7 +2146,7 @@ async function promptReviewMethod() {
2135
2146
  function openReview(method, stagedFiles) {
2136
2147
  if (method === "cursor" || method === "vscode") {
2137
2148
  openDiffsInEditor(method, stagedFiles.map((f) => ({
2138
- currentPath: f.currentPath,
2149
+ originalPath: f.originalPath,
2139
2150
  proposedPath: f.proposedPath
2140
2151
  })));
2141
2152
  console.log(chalk3.dim(" Diffs opened in your editor.\n"));