@snapcommit/cli 3.5.0 → 3.7.0

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.
@@ -504,6 +504,13 @@ async function tryAdvancedConflictResolution() {
504
504
  async function resolveConflictWithAI(filename, base, ours, theirs) {
505
505
  try {
506
506
  const axios = (await Promise.resolve().then(() => __importStar(require('axios')))).default;
507
+ const { getAuthConfig } = await Promise.resolve().then(() => __importStar(require('../lib/auth')));
508
+ // Get auth token
509
+ const authConfig = getAuthConfig();
510
+ if (!authConfig || !authConfig.token) {
511
+ console.log(chalk_1.default.yellow('⚠️ Authentication required for AI conflict resolution'));
512
+ return null;
513
+ }
507
514
  // Get the backend URL from env or default
508
515
  const backendUrl = process.env.SNAPCOMMIT_BACKEND_URL || 'https://snapcommit.dev';
509
516
  const response = await axios.post(`${backendUrl}/api/ai/resolve-conflict`, {
@@ -511,6 +518,7 @@ async function resolveConflictWithAI(filename, base, ours, theirs) {
511
518
  base,
512
519
  ours,
513
520
  theirs,
521
+ token: authConfig.token,
514
522
  }, {
515
523
  headers: {
516
524
  'Content-Type': 'application/json',
@@ -524,6 +532,10 @@ async function resolveConflictWithAI(filename, base, ours, theirs) {
524
532
  }
525
533
  catch (error) {
526
534
  // AI resolution failed - fall back to manual choice
535
+ if (error.response?.status === 403) {
536
+ console.log(chalk_1.default.red('\n❌ Subscription required for AI conflict resolution'));
537
+ console.log(chalk_1.default.cyan('Visit: https://snapcommit.dev/pricing\n'));
538
+ }
527
539
  return null;
528
540
  }
529
541
  }
@@ -117,20 +117,21 @@ function clearGitHubToken() {
117
117
  */
118
118
  async function githubConnectCommand(tokenArg) {
119
119
  console.log(chalk_1.default.bold.cyan('\n╔════════════════════════════════════════╗'));
120
- console.log(chalk_1.default.bold.cyan('║ Connect GitHub to SnapCommit ║'));
120
+ console.log(chalk_1.default.bold.cyan('║ 🐙 Connect GitHub CLI (Optional) ║'));
121
121
  console.log(chalk_1.default.bold.cyan('╚════════════════════════════════════════╝\n'));
122
- console.log(chalk_1.default.gray('GitHub integration allows you to:\n'));
122
+ console.log(chalk_1.default.green('✅ Your GitHub account is already connected via snapcommit.dev!\n'));
123
+ console.log(chalk_1.default.gray('This CLI token enables GitHub features in your terminal:\n'));
123
124
  console.log(chalk_1.default.white(' • Create pull requests'));
124
125
  console.log(chalk_1.default.white(' • Check CI/workflow status'));
125
- console.log(chalk_1.default.white(' • List and manage PRs'));
126
+ console.log(chalk_1.default.white(' • Manage issues and PRs'));
126
127
  console.log(chalk_1.default.white(' • All with natural language!\n'));
127
128
  console.log(chalk_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
128
- console.log(chalk_1.default.bold.white('How to get your GitHub token:\n'));
129
+ console.log(chalk_1.default.bold.white('Quick Setup (2 minutes):\n'));
129
130
  console.log(chalk_1.default.gray(' 1. Go to: ') + chalk_1.default.cyan('https://github.com/settings/tokens'));
130
131
  console.log(chalk_1.default.gray(' 2. Click "Generate new token (classic)"'));
131
- console.log(chalk_1.default.gray(' 3. Give it a name: ') + chalk_1.default.white('"SnapCommit"'));
132
- console.log(chalk_1.default.gray(' 4. Select scopes: ') + chalk_1.default.white('repo, workflow, read:user'));
133
- console.log(chalk_1.default.gray(' 5. Click "Generate token" and copy it\n'));
132
+ console.log(chalk_1.default.gray(' 3. Name: ') + chalk_1.default.white('"SnapCommit CLI"'));
133
+ console.log(chalk_1.default.gray(' 4. Scopes: ') + chalk_1.default.white('repo, workflow, read:user'));
134
+ console.log(chalk_1.default.gray(' 5. Generate & copy the token\n'));
134
135
  console.log(chalk_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
135
136
  let token = tokenArg;
136
137
  if (!token) {
package/dist/lib/auth.js CHANGED
@@ -101,11 +101,12 @@ async function promptAuth() {
101
101
  console.log(chalk_1.default.bold.cyan('╚════════════════════════════════════════╝\n'));
102
102
  console.log(chalk_1.default.gray('SnapCommit needs authentication to provide AI-powered features.\n'));
103
103
  console.log(chalk_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
104
- console.log(chalk_1.default.bold.white('Step 1: ') + chalk_1.default.gray('Sign up or log in'));
104
+ console.log(chalk_1.default.bold.white('Step 1: ') + chalk_1.default.gray('Sign in with GitHub (one-click!)'));
105
105
  console.log(chalk_1.default.cyan(' 👉 https://snapcommit.dev/login\n'));
106
- console.log(chalk_1.default.bold.white('Step 2: ') + chalk_1.default.gray('Go to your dashboard and click "Generate Token"'));
106
+ console.log(chalk_1.default.bold.white('Step 2: ') + chalk_1.default.gray('Subscribe ($9.99/mo or $100/year)'));
107
+ console.log(chalk_1.default.cyan(' 👉 Choose your plan on the dashboard\n'));
108
+ console.log(chalk_1.default.bold.white('Step 3: ') + chalk_1.default.gray('Generate & paste your CLI token'));
107
109
  console.log(chalk_1.default.cyan(' 👉 https://snapcommit.dev/dashboard\n'));
108
- console.log(chalk_1.default.bold.white('Step 3: ') + chalk_1.default.gray('Copy the token and paste it below\n'));
109
110
  console.log(chalk_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
110
111
  const token = await askQuestion(chalk_1.default.yellow('🔑 Paste your authentication token: '));
111
112
  if (!token || token.trim().length === 0) {
package/dist/repl.js CHANGED
@@ -90,18 +90,14 @@ async function startREPL() {
90
90
  console.log(chalk_1.default.gray(' ') + chalk_1.default.cyan('"check CI status"'));
91
91
  }
92
92
  console.log(chalk_1.default.gray(' Other: ') + chalk_1.default.cyan('stats') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('cd <path>') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('exit') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('help') + chalk_1.default.gray(' • ') + chalk_1.default.cyan('update\n'));
93
- // Show GitHub setup reminder if not connected
93
+ // Show GitHub setup reminder if not connected (UPDATED FOR OAUTH)
94
94
  if (!githubConnected) {
95
95
  console.log(chalk_1.default.yellow.bold('┌─────────────────────────────────────────┐'));
96
- console.log(chalk_1.default.yellow.bold('│ 💡 UNLOCK GITHUB FEATURES! │'));
96
+ console.log(chalk_1.default.yellow.bold('│ 🐙 GITHUB FEATURES (OPTIONAL) │'));
97
97
  console.log(chalk_1.default.yellow.bold('└─────────────────────────────────────────┘\n'));
98
- console.log(chalk_1.default.white(' Create PRs, check CI, manage issues—all with natural language!\n'));
99
- console.log(chalk_1.default.cyan.bold(' Quick Setup:'));
100
- console.log(chalk_1.default.gray(' 1. Run: ') + chalk_1.default.cyan('snap github connect'));
101
- console.log(chalk_1.default.gray(' 2. Get token: ') + chalk_1.default.cyan('https://github.com/settings/tokens'));
102
- console.log(chalk_1.default.gray(' 3. Scopes needed: ') + chalk_1.default.white('repo, workflow, read:user'));
103
- console.log(chalk_1.default.gray(' 4. Paste token when prompted'));
104
- console.log(chalk_1.default.gray(' 💡 Tip: Set no expiration!\n'));
98
+ console.log(chalk_1.default.white(' Your GitHub account is already connected via snapcommit.dev!\n'));
99
+ console.log(chalk_1.default.gray(' To use GitHub features in this CLI, run: ') + chalk_1.default.cyan('snap github connect'));
100
+ console.log(chalk_1.default.gray(' This creates a CLI token for terminal GitHub API access.\n'));
105
101
  }
106
102
  console.log(chalk_1.default.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
107
103
  console.log(chalk_1.default.bold.yellow('🎯 Try it now! Type what you want to do:\n'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcommit/cli",
3
- "version": "3.5.0",
3
+ "version": "3.7.0",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {