opencara 0.105.2 → 0.105.3

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 +23 -2
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -1206,7 +1206,7 @@ function resolveLocalAcpAdapter(command, args) {
1206
1206
  }
1207
1207
 
1208
1208
  // src/commands/run.ts
1209
- var PKG_VERSION = "0.105.2";
1209
+ var PKG_VERSION = "0.105.3";
1210
1210
  var LOG_FLUSH_MS = 800;
1211
1211
  var MAX_CHUNK_SIZE = 4 * 1024;
1212
1212
  async function run(opts = {}) {
@@ -1533,7 +1533,17 @@ function worktreeCreate(args) {
1533
1533
  mkdirSync2(sessionDir, { recursive: true });
1534
1534
  if (existsSync4(join2(checkoutDir, ".git"))) {
1535
1535
  git(checkoutDir, ["fetch", "origin"]);
1536
- git(checkoutDir, ["checkout", "-B", branch, `origin/${branch}`]);
1536
+ if (refExists(checkoutDir, `refs/remotes/origin/${branch}`)) {
1537
+ git(checkoutDir, ["checkout", "-B", branch, `origin/${branch}`]);
1538
+ } else if (refExists(checkoutDir, `refs/heads/${branch}`)) {
1539
+ git(checkoutDir, ["checkout", branch]);
1540
+ } else if (fromBranch) {
1541
+ git(checkoutDir, ["checkout", "-B", branch, `origin/${fromBranch}`]);
1542
+ } else {
1543
+ fail(
1544
+ `worktree create: '${branch}' missing locally and on origin/, no --from-branch to fall back to`
1545
+ );
1546
+ }
1537
1547
  } else {
1538
1548
  mkdirSync2(checkoutDir, { recursive: true });
1539
1549
  const cloneArgs = ["-c", `credential.helper=${HELPER_SNIPPET}`, "clone"];
@@ -1635,6 +1645,17 @@ function worktreeRemove(args) {
1635
1645
  function git(cwd, args) {
1636
1646
  execFileSync("git", args, { cwd, stdio: ["ignore", "ignore", "inherit"] });
1637
1647
  }
1648
+ function refExists(cwd, ref) {
1649
+ try {
1650
+ execFileSync("git", ["rev-parse", "--verify", "--quiet", ref], {
1651
+ cwd,
1652
+ stdio: ["ignore", "ignore", "ignore"]
1653
+ });
1654
+ return true;
1655
+ } catch {
1656
+ return false;
1657
+ }
1658
+ }
1638
1659
  function pickFlag(argv, name) {
1639
1660
  const i = argv.indexOf(name);
1640
1661
  if (i === -1) return void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencara",
3
- "version": "0.105.2",
3
+ "version": "0.105.3",
4
4
  "description": "OpenCara agent-host CLI: register a machine as an agent host and run dispatched agents.",
5
5
  "license": "MIT",
6
6
  "repository": {