baro-ai 0.127.0 → 0.129.0

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/cli.mjs CHANGED
@@ -71597,6 +71597,7 @@ var IntegrationWorktree = class {
71597
71597
  return false;
71598
71598
  }
71599
71599
  );
71600
+ if (branchExists) await this.releaseStaleHolders(goalBranch);
71600
71601
  await git(
71601
71602
  branchExists ? ["worktree", "add", integrationRoot, goalBranch] : ["worktree", "add", "-b", goalBranch, integrationRoot, startPoint],
71602
71603
  repoRoot
@@ -71717,6 +71718,28 @@ var IntegrationWorktree = class {
71717
71718
  release?.();
71718
71719
  }
71719
71720
  }
71721
+ /**
71722
+ * A run that was stopped (baro_plan stops Baro once it has the plan) leaves
71723
+ * its integration worktree holding the goal branch, and git refuses to
71724
+ * check one branch out twice, so resuming that goal died. Only another
71725
+ * run's `__run` worktree is removed; anything else holding the branch is
71726
+ * the user's and stays, with git's own error.
71727
+ */
71728
+ async releaseStaleHolders(goalBranch) {
71729
+ const listing = await git(["worktree", "list", "--porcelain"], this.repoRoot);
71730
+ const own = canonicalPath(this.integrationRoot);
71731
+ for (const entry of listing.split(/\n\s*\n/u)) {
71732
+ const lines = entry.split("\n");
71733
+ const path7 = lines.find((line) => line.startsWith("worktree "))?.slice("worktree ".length);
71734
+ const branch = lines.find((line) => line.startsWith("branch "))?.slice("branch ".length);
71735
+ if (!path7 || branch !== `refs/heads/${goalBranch}`) continue;
71736
+ if (canonicalPath(path7) === own || !isIntegrationWorktreeRoot(path7)) continue;
71737
+ this.log(`[integration] releasing ${goalBranch} from a stopped run's worktree ${path7}`);
71738
+ await gitQuiet(["worktree", "remove", "--force", path7], this.repoRoot);
71739
+ if (existsSync3(path7)) rmSync(path7, { recursive: true, force: true });
71740
+ }
71741
+ await git(["worktree", "prune"], this.repoRoot);
71742
+ }
71720
71743
  async isRegistered() {
71721
71744
  const listing = await git(["worktree", "list", "--porcelain"], this.repoRoot);
71722
71745
  const target = canonicalPath(this.integrationRoot);