@callumvass/forgeflow-dev 0.4.1 → 0.4.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.
@@ -422,9 +422,15 @@ var JIRA_BRANCH_RE = /feat\/([A-Z]+-\d+)/;
422
422
  async function ensureBranch(cwd, branch) {
423
423
  const currentBranch = await exec("git branch --show-current", cwd);
424
424
  if (currentBranch === branch) return;
425
- const exists = await exec(`git rev-parse --verify ${branch} 2>/dev/null && echo yes || echo no`, cwd);
426
- if (exists === "yes") {
425
+ const localExists = await exec(`git rev-parse --verify ${branch} 2>/dev/null && echo yes || echo no`, cwd);
426
+ if (localExists === "yes") {
427
427
  await exec(`git checkout ${branch}`, cwd);
428
+ return;
429
+ }
430
+ await exec("git fetch origin", cwd);
431
+ const remoteExists = await exec(`git rev-parse --verify origin/${branch} 2>/dev/null && echo yes || echo no`, cwd);
432
+ if (remoteExists === "yes") {
433
+ await exec(`git checkout -b ${branch} origin/${branch}`, cwd);
428
434
  } else {
429
435
  await exec(`git checkout -b ${branch}`, cwd);
430
436
  }
@@ -749,11 +755,12 @@ ${flags.customPrompt}` : "";
749
755
  };
750
756
  }
751
757
  if (resolved.branch) {
752
- const branchExists = await exec(
753
- `git rev-parse --verify ${resolved.branch} 2>/dev/null && echo yes || echo no`,
758
+ const localExists = await exec(`git rev-parse --verify ${resolved.branch} 2>/dev/null && echo yes || echo no`, cwd);
759
+ const remoteExists = localExists === "yes" ? "no" : await exec(
760
+ `git fetch origin && git rev-parse --verify origin/${resolved.branch} 2>/dev/null && echo yes || echo no`,
754
761
  cwd
755
762
  );
756
- if (branchExists === "yes") {
763
+ if (localExists === "yes" || remoteExists === "yes") {
757
764
  await ensureBranch(cwd, resolved.branch);
758
765
  const ahead = await exec(`git rev-list main..${resolved.branch} --count`, cwd);
759
766
  if (parseInt(ahead, 10) > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@callumvass/forgeflow-dev",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "Dev pipeline for Pi — TDD implementation, code review, architecture, and skill discovery.",
6
6
  "keywords": [