qkpr 1.0.4 → 1.0.5-beta.1
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/index.mjs +55 -3
- package/dist/pr-C2AR97YR.mjs +3 -0
- package/package.json +1 -1
- package/dist/pr-3u9dEVEc.mjs +0 -3
package/dist/index.mjs
CHANGED
|
@@ -235,6 +235,29 @@ function createMergeBranch(targetBranch, mergeBranchName) {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
|
+
* 合并原始分支到合并分支
|
|
239
|
+
*/
|
|
240
|
+
function mergeSourceToMergeBranch(sourceBranch) {
|
|
241
|
+
try {
|
|
242
|
+
console.log(cyan(`\n🔄 Merging source branch '${sourceBranch}' into current merge branch...`));
|
|
243
|
+
execSync(`git merge ${sourceBranch}`, { stdio: "inherit" });
|
|
244
|
+
console.log(green(`✅ Successfully merged '${sourceBranch}' into merge branch`));
|
|
245
|
+
return true;
|
|
246
|
+
} catch (error) {
|
|
247
|
+
if (error.status === 1 && error.stdout?.includes("CONFLICT")) {
|
|
248
|
+
console.log(yellow(`⚠️ Merge conflicts detected!`));
|
|
249
|
+
console.log(dim(` Please resolve conflicts manually and then run:`));
|
|
250
|
+
console.log(dim(` git add <resolved-files>`));
|
|
251
|
+
console.log(dim(` git commit`));
|
|
252
|
+
return false;
|
|
253
|
+
} else {
|
|
254
|
+
console.log(red("❌ Failed to merge source branch"));
|
|
255
|
+
console.log(dim(`Error: ${error.message || "Unknown error"}`));
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
238
261
|
* 复制文本到剪贴板
|
|
239
262
|
*/
|
|
240
263
|
function copyToClipboard(text) {
|
|
@@ -1333,11 +1356,25 @@ async function promptCreateMergeBranch(mergeBranchName) {
|
|
|
1333
1356
|
type: "confirm",
|
|
1334
1357
|
name: "createMergeBranch",
|
|
1335
1358
|
message: "Do you want to create a merge branch for conflict resolution?",
|
|
1336
|
-
default:
|
|
1359
|
+
default: true
|
|
1337
1360
|
}]);
|
|
1338
1361
|
return createMergeBranch$1;
|
|
1339
1362
|
}
|
|
1340
1363
|
/**
|
|
1364
|
+
* 确认是否自动合并原始分支到合并分支
|
|
1365
|
+
*/
|
|
1366
|
+
async function promptAutoMergeSource(sourceBranch, targetBranch) {
|
|
1367
|
+
console.log(yellow(`\n🔄 Merge branch created successfully!`));
|
|
1368
|
+
console.log(dim(` This branch is based on '${targetBranch}' and can be used to test the merge.`));
|
|
1369
|
+
const { shouldAutoMerge } = await inquirer.prompt([{
|
|
1370
|
+
type: "confirm",
|
|
1371
|
+
name: "shouldAutoMerge",
|
|
1372
|
+
message: `Auto-merge '${sourceBranch}' to detect potential conflicts now?`,
|
|
1373
|
+
default: false
|
|
1374
|
+
}]);
|
|
1375
|
+
return shouldAutoMerge;
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1341
1378
|
* 显示 PR 信息
|
|
1342
1379
|
*/
|
|
1343
1380
|
function displayPRInfo(prMessage, prUrl) {
|
|
@@ -1363,7 +1400,7 @@ async function handlePinCommand(branchName) {
|
|
|
1363
1400
|
addPinnedBranch(branchName);
|
|
1364
1401
|
console.log(green(`✅ Branch '${branchName}' has been pinned`));
|
|
1365
1402
|
} else {
|
|
1366
|
-
const { getAllBranches: getAllBranches$1 } = await import("./pr-
|
|
1403
|
+
const { getAllBranches: getAllBranches$1 } = await import("./pr-C2AR97YR.mjs");
|
|
1367
1404
|
const branches = getAllBranches$1();
|
|
1368
1405
|
if (branches.length === 0) {
|
|
1369
1406
|
console.log(yellow("⚠️ No branches found"));
|
|
@@ -1809,6 +1846,21 @@ async function handlePRCommand() {
|
|
|
1809
1846
|
}
|
|
1810
1847
|
if (await promptCreateMergeBranch(prInfo.mergeBranchName)) {
|
|
1811
1848
|
if (!createMergeBranch(targetBranch, prInfo.mergeBranchName)) return;
|
|
1849
|
+
if (await promptAutoMergeSource(gitInfo.currentBranch, targetBranch)) {
|
|
1850
|
+
console.log(yellow(`\n🔄 Merging '${gitInfo.currentBranch}' to detect conflicts...`));
|
|
1851
|
+
if (!mergeSourceToMergeBranch(gitInfo.currentBranch)) {
|
|
1852
|
+
console.log(yellow("\n⚠️ Merge conflicts detected! Please resolve them manually:"));
|
|
1853
|
+
console.log(dim(` 1. Resolve conflicts in your editor`));
|
|
1854
|
+
console.log(dim(` 2. Run: git add <resolved-files>`));
|
|
1855
|
+
console.log(dim(` 3. Run: git commit`));
|
|
1856
|
+
console.log(dim(` 4. Push the merge branch when ready`));
|
|
1857
|
+
}
|
|
1858
|
+
} else {
|
|
1859
|
+
console.log(green(`\n✅ Merge branch '${prInfo.mergeBranchName}' created without merging.`));
|
|
1860
|
+
console.log(dim(` You can manually merge later when ready:`));
|
|
1861
|
+
console.log(dim(` git checkout ${prInfo.mergeBranchName}`));
|
|
1862
|
+
console.log(dim(` git merge ${gitInfo.currentBranch}`));
|
|
1863
|
+
}
|
|
1812
1864
|
}
|
|
1813
1865
|
console.log(green("\n🎉 PR creation process completed!\n"));
|
|
1814
1866
|
}
|
|
@@ -1857,4 +1909,4 @@ yargs(hideBin(process.argv)).scriptName("qkpr").usage("Usage: $0 <command> [opti
|
|
|
1857
1909
|
}).version(version).alias("v", "version").help("h").alias("h", "help").epilog("For more information, visit https://github.com/KazooTTT/qkpr").argv;
|
|
1858
1910
|
|
|
1859
1911
|
//#endregion
|
|
1860
|
-
export { generatePRMessage as a, getBranchCategory as c, getCommitsBetweenBranches as d, getGitInfo as f, generateMergeBranchName as i, getBranchLastCommitTime as l, createMergeBranch as n, generatePRUrl as o,
|
|
1912
|
+
export { generatePRMessage as a, getBranchCategory as c, getCommitsBetweenBranches as d, getGitInfo as f, generateMergeBranchName as i, getBranchLastCommitTime as l, parseRemoteUrl as m, createMergeBranch as n, generatePRUrl as o, mergeSourceToMergeBranch as p, createPullRequest as r, getAllBranches as s, copyToClipboard as t, getBranchesWithInfo as u };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as generatePRMessage, c as getBranchCategory, d as getCommitsBetweenBranches, f as getGitInfo, i as generateMergeBranchName, l as getBranchLastCommitTime, m as parseRemoteUrl, n as createMergeBranch, o as generatePRUrl, p as mergeSourceToMergeBranch, r as createPullRequest, s as getAllBranches, t as copyToClipboard, u as getBranchesWithInfo } from "./index.mjs";
|
|
2
|
+
|
|
3
|
+
export { copyToClipboard, createMergeBranch, createPullRequest, generateMergeBranchName, generatePRMessage, generatePRUrl, getAllBranches, getBranchCategory, getBranchLastCommitTime, getBranchesWithInfo, getCommitsBetweenBranches, getGitInfo, mergeSourceToMergeBranch, parseRemoteUrl };
|
package/package.json
CHANGED
package/dist/pr-3u9dEVEc.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { a as generatePRMessage, c as getBranchCategory, d as getCommitsBetweenBranches, f as getGitInfo, i as generateMergeBranchName, l as getBranchLastCommitTime, n as createMergeBranch, o as generatePRUrl, p as parseRemoteUrl, r as createPullRequest, s as getAllBranches, t as copyToClipboard, u as getBranchesWithInfo } from "./index.mjs";
|
|
2
|
-
|
|
3
|
-
export { copyToClipboard, createMergeBranch, createPullRequest, generateMergeBranchName, generatePRMessage, generatePRUrl, getAllBranches, getBranchCategory, getBranchLastCommitTime, getBranchesWithInfo, getCommitsBetweenBranches, getGitInfo, parseRemoteUrl };
|