@snapcommit/cli 3.9.15 → 3.9.17

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.
@@ -771,9 +771,71 @@ async function executeGitHubCommand(intent) {
771
771
  case 'new_pr':
772
772
  const isDraft = intent.options?.draft || false;
773
773
  console.log(chalk_1.default.blue(`\nšŸ”„ Creating ${isDraft ? 'draft ' : ''}PR...`));
774
- const pr = await github.createPullRequest(intent.options || {});
775
- console.log(chalk_1.default.green(`āœ“ ${isDraft ? 'Draft ' : ''}PR #${pr.number} created`));
776
- console.log(chalk_1.default.cyan(` ${pr.html_url}\n`));
774
+ try {
775
+ const pr = await github.createPullRequest(intent.options || {});
776
+ console.log(chalk_1.default.green(`āœ“ ${isDraft ? 'Draft ' : ''}PR #${pr.number} created`));
777
+ console.log(chalk_1.default.cyan(` ${pr.html_url}\n`));
778
+ }
779
+ catch (error) {
780
+ console.log(chalk_1.default.red('\nāŒ Cannot create PR\n'));
781
+ // Check if it's because we're on main branch
782
+ try {
783
+ const currentBranch = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' }).trim();
784
+ const defaultBranch = (0, child_process_1.execSync)('git symbolic-ref refs/remotes/origin/HEAD', { encoding: 'utf-8' }).trim().replace('refs/remotes/origin/', '');
785
+ if (currentBranch === defaultBranch || currentBranch === 'main' || currentBranch === 'master') {
786
+ console.log(chalk_1.default.yellow('āš ļø You\'re on the main branch!\n'));
787
+ console.log(chalk_1.default.white('Why this fails:'));
788
+ console.log(chalk_1.default.gray(' • PRs merge FROM a feature branch TO main'));
789
+ console.log(chalk_1.default.gray(' • You can\'t create a PR from main to main\n'));
790
+ console.log(chalk_1.default.cyan('šŸ’” Here\'s what to do:\n'));
791
+ console.log(chalk_1.default.white('1. Create a new branch:'));
792
+ console.log(chalk_1.default.cyan(' create a new branch called feature/your-feature\n'));
793
+ console.log(chalk_1.default.white('2. Make your changes'));
794
+ console.log(chalk_1.default.white('3. Commit and push:'));
795
+ console.log(chalk_1.default.cyan(' commit and push changes\n'));
796
+ console.log(chalk_1.default.white('4. Then create PR:'));
797
+ console.log(chalk_1.default.cyan(' create a PR to main\n'));
798
+ return;
799
+ }
800
+ }
801
+ catch (branchError) {
802
+ // If we can't determine branch, show generic error
803
+ }
804
+ // Check if there are no commits to push
805
+ try {
806
+ const commitsAhead = (0, child_process_1.execSync)('git rev-list --count @{u}..HEAD 2>/dev/null || echo 0', { encoding: 'utf-8' }).trim();
807
+ if (commitsAhead === '0') {
808
+ console.log(chalk_1.default.yellow('āš ļø No new commits on this branch!\n'));
809
+ console.log(chalk_1.default.white('Why this fails:'));
810
+ console.log(chalk_1.default.gray(' • PRs need at least 1 commit that\'s not in main'));
811
+ console.log(chalk_1.default.gray(' • Your branch is identical to main\n'));
812
+ console.log(chalk_1.default.cyan('šŸ’” Here\'s what to do:\n'));
813
+ console.log(chalk_1.default.white('1. Make some changes to your code'));
814
+ console.log(chalk_1.default.white('2. Commit and push:'));
815
+ console.log(chalk_1.default.cyan(' commit and push changes\n'));
816
+ console.log(chalk_1.default.white('3. Then create PR:'));
817
+ console.log(chalk_1.default.cyan(' create a PR to main\n'));
818
+ return;
819
+ }
820
+ }
821
+ catch (commitError) {
822
+ // If we can't check commits, continue to generic error
823
+ }
824
+ // Generic error with helpful message
825
+ console.log(chalk_1.default.white('Common reasons:'));
826
+ console.log(chalk_1.default.gray(' • Branch is up to date with main (no changes)'));
827
+ console.log(chalk_1.default.gray(' • PR already exists for this branch'));
828
+ console.log(chalk_1.default.gray(' • No commits on this branch\n'));
829
+ console.log(chalk_1.default.cyan('šŸ’” Try:\n'));
830
+ console.log(chalk_1.default.white('• Check existing PRs:'));
831
+ console.log(chalk_1.default.cyan(' show all PRs\n'));
832
+ console.log(chalk_1.default.white('• Check your branch:'));
833
+ console.log(chalk_1.default.cyan(' what branch am i on'));
834
+ console.log(chalk_1.default.cyan(' show last 5 commits\n'));
835
+ if (error.message) {
836
+ console.log(chalk_1.default.gray(`\nError: ${error.message}\n`));
837
+ }
838
+ }
777
839
  break;
778
840
  case 'pr_list':
779
841
  case 'list_prs':
@@ -865,6 +927,7 @@ async function executeGitHubCommand(intent) {
865
927
  console.log(chalk_1.default.green(`āœ“ Issue #${closeIssueNum} closed\n`));
866
928
  break;
867
929
  case 'issue_reopen':
930
+ case 'reopen_issue':
868
931
  const reopenIssueNum = intent.target || intent.options?.number;
869
932
  if (!reopenIssueNum) {
870
933
  console.log(chalk_1.default.red('\nāŒ Issue number required\n'));
@@ -928,6 +991,8 @@ async function executeGitHubCommand(intent) {
928
991
  console.log(chalk_1.default.green(`āœ“ Comment added\n`));
929
992
  break;
930
993
  case 'issue_comment':
994
+ case 'comment_issue':
995
+ case 'add_issue_comment':
931
996
  const commentIssueNum = intent.target || intent.options?.number;
932
997
  if (!commentIssueNum) {
933
998
  console.log(chalk_1.default.red('\nāŒ Issue number required\n'));
@@ -1006,6 +1071,9 @@ async function executeGitHubCommand(intent) {
1006
1071
  console.log();
1007
1072
  break;
1008
1073
  case 'workflow_rerun':
1074
+ case 'rerun_workflow':
1075
+ case 'retry_ci':
1076
+ case 'rerun_ci':
1009
1077
  const runId = intent.target || intent.options?.runId;
1010
1078
  if (!runId) {
1011
1079
  console.log(chalk_1.default.red('\nāŒ Workflow run ID required\n'));
@@ -1016,10 +1084,16 @@ async function executeGitHubCommand(intent) {
1016
1084
  console.log(chalk_1.default.green(`āœ“ Workflow re-run started\n`));
1017
1085
  break;
1018
1086
  case 'pr_label':
1019
- const labelPrNum = intent.target || intent.options?.number;
1087
+ case 'label_pr':
1088
+ case 'add_labels':
1089
+ let labelPrNum = intent.target || intent.options?.number;
1090
+ // Smart PR detection
1020
1091
  if (!labelPrNum) {
1021
- console.log(chalk_1.default.red('\nāŒ PR number required\n'));
1022
- return;
1092
+ labelPrNum = await github.findPRNumber('current');
1093
+ if (!labelPrNum) {
1094
+ console.log(chalk_1.default.red('\nāŒ No PR found for current branch\n'));
1095
+ return;
1096
+ }
1023
1097
  }
1024
1098
  const labels = intent.options?.labels || [];
1025
1099
  if (labels.length === 0) {
@@ -1076,6 +1150,8 @@ async function executeGitHubCommand(intent) {
1076
1150
  }
1077
1151
  break;
1078
1152
  case 'pr_stack_create':
1153
+ case 'create_stacked_prs':
1154
+ case 'create_stack':
1079
1155
  const branches = intent.options?.branches || [];
1080
1156
  if (branches.length < 2) {
1081
1157
  console.log(chalk_1.default.red('\nāŒ Need at least 2 branches for stacked PRs\n'));
@@ -1110,10 +1186,16 @@ async function executeGitHubCommand(intent) {
1110
1186
  console.log(chalk_1.default.gray('šŸ’” Merge from bottom to top for best results!\n'));
1111
1187
  break;
1112
1188
  case 'pr_mark_ready':
1113
- const readyPrNum = intent.target || intent.options?.number;
1189
+ case 'mark_ready':
1190
+ case 'ready_for_review':
1191
+ let readyPrNum = intent.target || intent.options?.number;
1192
+ // Smart PR detection
1114
1193
  if (!readyPrNum) {
1115
- console.log(chalk_1.default.red('\nāŒ PR number required\n'));
1116
- return;
1194
+ readyPrNum = await github.findPRNumber('current');
1195
+ if (!readyPrNum) {
1196
+ console.log(chalk_1.default.red('\nāŒ No PR found for current branch\n'));
1197
+ return;
1198
+ }
1117
1199
  }
1118
1200
  console.log(chalk_1.default.blue(`\nšŸ”„ Marking PR #${readyPrNum} as ready for review...`));
1119
1201
  await github.markPRReady(readyPrNum);
@@ -1201,6 +1283,8 @@ async function executeGitHubCommand(intent) {
1201
1283
  }
1202
1284
  break;
1203
1285
  case 'merge_queue_remove':
1286
+ case 'remove_from_queue':
1287
+ case 'disable_auto_merge':
1204
1288
  // Disable auto-merge
1205
1289
  let removePrNum = intent.target || intent.options?.number;
1206
1290
  if (!removePrNum) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcommit/cli",
3
- "version": "3.9.15",
3
+ "version": "3.9.17",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {