@callumvass/forgeflow-dev 0.4.2 → 0.4.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.
- package/extensions/index.js +33 -38
- package/package.json +1 -1
package/extensions/index.js
CHANGED
|
@@ -756,14 +756,10 @@ ${flags.customPrompt}` : "";
|
|
|
756
756
|
}
|
|
757
757
|
if (resolved.branch) {
|
|
758
758
|
const localExists = await exec(`git rev-parse --verify ${resolved.branch} 2>/dev/null && echo yes || echo no`, cwd);
|
|
759
|
-
|
|
760
|
-
`git fetch origin && git rev-parse --verify origin/${resolved.branch} 2>/dev/null && echo yes || echo no`,
|
|
761
|
-
cwd
|
|
762
|
-
);
|
|
763
|
-
if (localExists === "yes" || remoteExists === "yes") {
|
|
764
|
-
await ensureBranch(cwd, resolved.branch);
|
|
759
|
+
if (localExists === "yes") {
|
|
765
760
|
const ahead = await exec(`git rev-list main..${resolved.branch} --count`, cwd);
|
|
766
761
|
if (parseInt(ahead, 10) > 0) {
|
|
762
|
+
await ensureBranch(cwd, resolved.branch);
|
|
767
763
|
await exec(`git push -u origin ${resolved.branch}`, cwd);
|
|
768
764
|
const prBody = buildPrBody(cwd, resolved);
|
|
769
765
|
await createPr(cwd, resolved.title, prBody, resolved.branch);
|
|
@@ -774,6 +770,37 @@ ${flags.customPrompt}` : "";
|
|
|
774
770
|
details: { pipeline: "implement", stages: stages2 }
|
|
775
771
|
};
|
|
776
772
|
}
|
|
773
|
+
await exec(`git branch -D ${resolved.branch}`, cwd);
|
|
774
|
+
}
|
|
775
|
+
const currentBranch = await exec("git branch --show-current", cwd);
|
|
776
|
+
if (currentBranch === "main" || currentBranch === "master") {
|
|
777
|
+
const dirty = await exec("git status --porcelain", cwd);
|
|
778
|
+
if (dirty) {
|
|
779
|
+
return {
|
|
780
|
+
content: [
|
|
781
|
+
{
|
|
782
|
+
type: "text",
|
|
783
|
+
text: `Cannot switch to ${resolved.branch} \u2014 working tree is dirty. Please commit or stash your changes first.`
|
|
784
|
+
}
|
|
785
|
+
],
|
|
786
|
+
details: { pipeline: "implement", stages: [] },
|
|
787
|
+
isError: true
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
await ensureBranch(cwd, resolved.branch);
|
|
792
|
+
const afterBranch = await exec("git branch --show-current", cwd);
|
|
793
|
+
if (afterBranch !== resolved.branch) {
|
|
794
|
+
return {
|
|
795
|
+
content: [
|
|
796
|
+
{
|
|
797
|
+
type: "text",
|
|
798
|
+
text: `Failed to switch to ${resolved.branch} (still on ${afterBranch}). Check git state and retry.`
|
|
799
|
+
}
|
|
800
|
+
],
|
|
801
|
+
details: { pipeline: "implement", stages: [] },
|
|
802
|
+
isError: true
|
|
803
|
+
};
|
|
777
804
|
}
|
|
778
805
|
}
|
|
779
806
|
const stageList = [];
|
|
@@ -814,38 +841,6 @@ ${issueContext}${customPromptSection}`,
|
|
|
814
841
|
}
|
|
815
842
|
}
|
|
816
843
|
}
|
|
817
|
-
if (resolved.branch) {
|
|
818
|
-
const currentBranch = await exec("git branch --show-current", cwd);
|
|
819
|
-
if (currentBranch === "main" || currentBranch === "master") {
|
|
820
|
-
const dirty = await exec("git status --porcelain", cwd);
|
|
821
|
-
if (dirty) {
|
|
822
|
-
return {
|
|
823
|
-
content: [
|
|
824
|
-
{
|
|
825
|
-
type: "text",
|
|
826
|
-
text: `Cannot switch to ${resolved.branch} \u2014 working tree is dirty. Please commit or stash your changes first.`
|
|
827
|
-
}
|
|
828
|
-
],
|
|
829
|
-
details: { pipeline: "implement", stages: [] },
|
|
830
|
-
isError: true
|
|
831
|
-
};
|
|
832
|
-
}
|
|
833
|
-
await ensureBranch(cwd, resolved.branch);
|
|
834
|
-
const afterBranch = await exec("git branch --show-current", cwd);
|
|
835
|
-
if (afterBranch !== resolved.branch) {
|
|
836
|
-
return {
|
|
837
|
-
content: [
|
|
838
|
-
{
|
|
839
|
-
type: "text",
|
|
840
|
-
text: `Failed to switch to ${resolved.branch} (still on ${afterBranch}). Check git state and retry.`
|
|
841
|
-
}
|
|
842
|
-
],
|
|
843
|
-
details: { pipeline: "implement", stages: [] },
|
|
844
|
-
isError: true
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
844
|
cleanSignal(cwd, "blocked");
|
|
850
845
|
const planSection = plan ? `
|
|
851
846
|
|