qkpr 1.0.2 → 1.0.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/index.mjs +16 -61
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1252,37 +1252,9 @@ async function promptBranchSelection(branches, options) {
1252
1252
  pinnedBranches.sort((a, b) => {
1253
1253
  return pinnedBranchNames.indexOf(a.name) - pinnedBranchNames.indexOf(b.name);
1254
1254
  });
1255
- const categorizedBranches = /* @__PURE__ */ new Map();
1256
- regularBranches.forEach((branch) => {
1257
- if (!categorizedBranches.has(branch.category)) categorizedBranches.set(branch.category, []);
1258
- categorizedBranches.get(branch.category).push(branch);
1259
- });
1260
- categorizedBranches.forEach((branches$1) => {
1261
- branches$1.sort((a, b) => b.lastCommitTime - a.lastCommitTime);
1262
- });
1263
- const categoryOrder = [
1264
- "main",
1265
- "release",
1266
- "feat",
1267
- "fix",
1268
- "merge",
1269
- "refactor",
1270
- "hotfix",
1271
- "chore",
1272
- "docs",
1273
- "test",
1274
- "style"
1275
- ];
1276
- const sortedCategories = Array.from(categorizedBranches.keys()).sort((a, b) => {
1277
- const aIndex = categoryOrder.indexOf(a);
1278
- const bIndex = categoryOrder.indexOf(b);
1279
- if (aIndex !== -1 && bIndex !== -1) return aIndex - bIndex;
1280
- if (aIndex !== -1) return -1;
1281
- if (bIndex !== -1) return 1;
1282
- if (a === "other") return 1;
1283
- if (b === "other") return -1;
1284
- return a.localeCompare(b);
1285
- });
1255
+ regularBranches.sort((a, b) => a.name.localeCompare(b.name));
1256
+ const MAX_BRANCHES = 100;
1257
+ if (regularBranches.length > MAX_BRANCHES) regularBranches.splice(MAX_BRANCHES);
1286
1258
  const choices = [];
1287
1259
  if (pinnedBranches.length > 0) {
1288
1260
  choices.push(new inquirer.Separator(magenta("━━━━━━━━ 📌 Pinned Branches ━━━━━━━━")));
@@ -1295,25 +1267,17 @@ async function promptBranchSelection(branches, options) {
1295
1267
  });
1296
1268
  choices.push(new inquirer.Separator(" "));
1297
1269
  }
1298
- sortedCategories.forEach((category) => {
1299
- const branches$1 = categorizedBranches.get(category);
1300
- if (branches$1.length > 0) {
1301
- let categoryLabel;
1302
- if (category === "other") categoryLabel = "Other Branches";
1303
- else if (category === "main") categoryLabel = "Main Branches";
1304
- else if (category === "release") categoryLabel = "Release Branches";
1305
- else categoryLabel = `${category}/*`;
1306
- choices.push(new inquirer.Separator(cyan(`━━━━━━━━ ${categoryLabel} ━━━━━━━━`)));
1307
- branches$1.forEach((branch) => {
1308
- choices.push({
1309
- name: ` ${branch.name.padEnd(45)} ${dim(`(${branch.lastCommitTimeFormatted})`)}`,
1310
- value: branch.name,
1311
- short: branch.name
1312
- });
1270
+ if (regularBranches.length > 0) {
1271
+ choices.push(new inquirer.Separator(cyan("━━━━━━━━ 🌿 All Branches (Alphabetical) ━━━━━━━━")));
1272
+ regularBranches.forEach((branch) => {
1273
+ choices.push({
1274
+ name: ` ${branch.name.padEnd(45)} ${dim(`(${branch.lastCommitTimeFormatted})`)}`,
1275
+ value: branch.name,
1276
+ short: branch.name
1313
1277
  });
1314
- choices.push(new inquirer.Separator(" "));
1315
- }
1316
- });
1278
+ });
1279
+ choices.push(new inquirer.Separator(" "));
1280
+ }
1317
1281
  const searchBranches = async (_answers, input = "") => {
1318
1282
  const lowerInput = input.toLowerCase();
1319
1283
  return choices.filter((choice) => {
@@ -1332,20 +1296,11 @@ async function promptBranchSelection(branches, options) {
1332
1296
  }]);
1333
1297
  return selectedBranch;
1334
1298
  } else {
1335
- const allBranches = [...pinnedBranches, ...regularBranches];
1336
- allBranches.sort((a, b) => a.name.localeCompare(b.name));
1337
- const simpleChoices = allBranches.map((branch) => {
1338
- return {
1339
- name: `${pinnedBranchNames.includes(branch.name) ? "📌 " : " "}${branch.name.padEnd(45)} ${dim(`(${branch.lastCommitTimeFormatted})`)}`,
1340
- value: branch.name,
1341
- short: branch.name
1342
- };
1343
- });
1344
1299
  const { selectedBranches } = await inquirer.prompt([{
1345
1300
  type: "search-checkbox",
1346
1301
  name: "selectedBranches",
1347
1302
  message,
1348
- choices: simpleChoices
1303
+ choices
1349
1304
  }]);
1350
1305
  return selectedBranches || [];
1351
1306
  }
@@ -1784,9 +1739,9 @@ async function showMainMenu() {
1784
1739
  }
1785
1740
  function printPRBanner() {
1786
1741
  console.log(bold(cyan("\n╔══════════════════════════════════════════════════════════════╗")));
1787
- console.log(bold(cyan("║ 🔧 Quick PR Creator ║")));
1742
+ console.log(bold(cyan("║ 🔧 Quick PR Creator ║")));
1788
1743
  console.log(bold(cyan("║ ║")));
1789
- console.log(bold(cyan("║ Interactive PR Creation Tool ║")));
1744
+ console.log(bold(cyan("║ Interactive PR Creation Tool ║")));
1790
1745
  console.log(bold(cyan("╚══════════════════════════════════════════════════════════════╝")));
1791
1746
  console.log(` Version: ${version}\n`);
1792
1747
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qkpr",
3
3
  "type": "module",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "description": "Create a Pull Request with interactive branch selection",
6
6
  "author": "KazooTTT <work@kazoottt.top>",
7
7
  "license": "MIT",