opencara 0.22.2 → 0.22.4

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/index.js +32 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3821,6 +3821,31 @@ function ghExec(args, cwd) {
3821
3821
  throw new Error(sanitizeTokens(message));
3822
3822
  }
3823
3823
  }
3824
+ function detectDefaultBranch(repoPath) {
3825
+ const candidates = [
3826
+ { ref: "origin/main", branch: "main" },
3827
+ { ref: "origin/master", branch: "master" },
3828
+ // Bare clone refs (local branches — no remote tracking in bare repos)
3829
+ { ref: "refs/heads/main", branch: "main" },
3830
+ { ref: "refs/heads/master", branch: "master" }
3831
+ ];
3832
+ for (const { ref, branch } of candidates) {
3833
+ try {
3834
+ gitExec2(["rev-parse", "--verify", ref], repoPath);
3835
+ return branch;
3836
+ } catch {
3837
+ }
3838
+ }
3839
+ throw new Error("Cannot determine default branch \u2014 neither main nor master exists");
3840
+ }
3841
+ function resolveStartRef(repoPath, branch) {
3842
+ try {
3843
+ gitExec2(["rev-parse", "--verify", `origin/${branch}`], repoPath);
3844
+ return `origin/${branch}`;
3845
+ } catch {
3846
+ return branch;
3847
+ }
3848
+ }
3824
3849
  function checkoutForImplement(owner, repo, issueNumber, branchName, baseDir) {
3825
3850
  validatePathSegment(owner, "owner");
3826
3851
  validatePathSegment(repo, "repo");
@@ -3853,20 +3878,9 @@ function checkoutForImplement(owner, repo, issueNumber, branchName, baseDir) {
3853
3878
  ).trim();
3854
3879
  defaultBranch = defaultBranch.replace(/^origin\//, "");
3855
3880
  } catch {
3856
- try {
3857
- gitExec2(["rev-parse", "--verify", "origin/main"], bareRepoPath);
3858
- defaultBranch = "main";
3859
- } catch {
3860
- try {
3861
- gitExec2(["rev-parse", "--verify", "origin/master"], bareRepoPath);
3862
- defaultBranch = "master";
3863
- } catch {
3864
- throw new Error(
3865
- "Cannot determine default branch \u2014 neither origin/main nor origin/master exists"
3866
- );
3867
- }
3868
- }
3881
+ defaultBranch = detectDefaultBranch(bareRepoPath);
3869
3882
  }
3883
+ const startRef = resolveStartRef(bareRepoPath, defaultBranch);
3870
3884
  const worktreeBase = path8.join(path8.dirname(bareRepoPath), `${repo}-worktrees`);
3871
3885
  const worktreeKey = `implement-${issueNumber}`;
3872
3886
  const worktreePath = path8.join(worktreeBase, worktreeKey);
@@ -3883,10 +3897,7 @@ function checkoutForImplement(owner, repo, issueNumber, branchName, baseDir) {
3883
3897
  } catch {
3884
3898
  }
3885
3899
  fs8.mkdirSync(worktreeBase, { recursive: true });
3886
- gitExec2(
3887
- ["worktree", "add", "-b", branchName, worktreePath, `origin/${defaultBranch}`],
3888
- bareRepoPath
3889
- );
3900
+ gitExec2(["worktree", "add", "-b", branchName, worktreePath, startRef], bareRepoPath);
3890
3901
  return { worktreePath, bareRepoPath };
3891
3902
  }
3892
3903
  function cleanupImplementWorktree(bareRepoPath, worktreePath) {
@@ -5516,7 +5527,7 @@ function sleep2(ms, signal) {
5516
5527
  async function startAgent(agentId, platformUrl, agentInfo, reviewDeps, consumptionDeps, options) {
5517
5528
  const client = new ApiClient(platformUrl, {
5518
5529
  authToken: options?.authToken,
5519
- cliVersion: "0.22.2",
5530
+ cliVersion: "0.22.4",
5520
5531
  versionOverride: options?.versionOverride,
5521
5532
  onTokenRefresh: options?.onTokenRefresh
5522
5533
  });
@@ -5802,7 +5813,7 @@ async function startBatchAgents(config, agents, pollIntervalMs, oauthToken, opti
5802
5813
  const { versionOverride, verbose, instancesOverride, agentOwner, userOrgs } = options;
5803
5814
  const client = new ApiClient(config.platformUrl, {
5804
5815
  authToken: oauthToken,
5805
- cliVersion: "0.22.2",
5816
+ cliVersion: "0.22.4",
5806
5817
  versionOverride,
5807
5818
  onTokenRefresh: () => getValidToken(config.platformUrl, { configPath: config.authFile })
5808
5819
  });
@@ -6145,7 +6156,7 @@ agentCommand.command("start").description("Start agents in polling mode").option
6145
6156
  }
6146
6157
  config = loadConfig();
6147
6158
  }
6148
- console.log(formatVersionBanner("0.22.2", "f92b498"));
6159
+ console.log(formatVersionBanner("0.22.4", "d9e98a4"));
6149
6160
  if (config.agents && config.agents.length > 0) {
6150
6161
  const toolEntries = config.agents.map((a) => ({
6151
6162
  tool: a.tool,
@@ -6968,7 +6979,7 @@ var statusCommand = new Command4("status").description("Show agent config, conne
6968
6979
  });
6969
6980
 
6970
6981
  // src/index.ts
6971
- var program = new Command5().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version(`${"0.22.2"} (${"f92b498"})`);
6982
+ var program = new Command5().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version(`${"0.22.4"} (${"d9e98a4"})`);
6972
6983
  program.addCommand(agentCommand);
6973
6984
  program.addCommand(authCommand());
6974
6985
  program.addCommand(dedupCommand());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencara",
3
- "version": "0.22.2",
3
+ "version": "0.22.4",
4
4
  "description": "Distributed AI code review agent — poll, review, and submit PR reviews using your own AI tools",
5
5
  "type": "module",
6
6
  "license": "MIT",