@snapcommit/cli 3.8.17 → 3.8.18
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.
|
@@ -180,20 +180,61 @@ async function githubConnectCommand(tokenArg) {
|
|
|
180
180
|
console.log(chalk_1.default.cyan(' • "list my open PRs"\n'));
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
|
-
// Token not found -
|
|
184
|
-
console.log(chalk_1.default.yellow('\n⚠️ GitHub not
|
|
185
|
-
console.log(chalk_1.default.
|
|
183
|
+
// Token not found - try to sync from Supabase auth
|
|
184
|
+
console.log(chalk_1.default.yellow('\n⚠️ GitHub token not found in CLI cache\n'));
|
|
185
|
+
console.log(chalk_1.default.cyan('🔄 Attempting to sync from your account...\n'));
|
|
186
|
+
const authConfig = (0, auth_1.getAuthConfig)();
|
|
187
|
+
if (!authConfig || !authConfig.token) {
|
|
188
|
+
console.log(chalk_1.default.red('❌ You must be logged in first!'));
|
|
189
|
+
console.log(chalk_1.default.gray(' Run: ') + chalk_1.default.cyan('snap login\n'));
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
// Call sync endpoint
|
|
194
|
+
const syncResponse = await fetch('https://snapcommit.dev/api/github/sync', {
|
|
195
|
+
method: 'POST',
|
|
196
|
+
headers: {
|
|
197
|
+
'Content-Type': 'application/json',
|
|
198
|
+
},
|
|
199
|
+
body: JSON.stringify({ token: authConfig.token }),
|
|
200
|
+
});
|
|
201
|
+
if (syncResponse.ok) {
|
|
202
|
+
const syncData = await syncResponse.json();
|
|
203
|
+
console.log(chalk_1.default.green('✅ GitHub token synced from your account!\n'));
|
|
204
|
+
// Try to fetch again
|
|
205
|
+
const autoConfig3 = await autoFetchGitHubToken();
|
|
206
|
+
if (autoConfig3) {
|
|
207
|
+
saveGitHubToken(autoConfig3);
|
|
208
|
+
console.log(chalk_1.default.green.bold('✅ GITHUB AUTO-CONNECTED! 🎉\n'));
|
|
209
|
+
console.log(chalk_1.default.white(` Connected as: ${chalk_1.default.bold('@' + autoConfig3.username)}\n`));
|
|
210
|
+
console.log(chalk_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
211
|
+
console.log(chalk_1.default.bold('🚀 You can now use GitHub features!\n'));
|
|
212
|
+
console.log(chalk_1.default.gray(' Try these commands in snap REPL:\n'));
|
|
213
|
+
console.log(chalk_1.default.cyan(' • "create a pull request"'));
|
|
214
|
+
console.log(chalk_1.default.cyan(' • "check CI status"'));
|
|
215
|
+
console.log(chalk_1.default.cyan(' • "list my open PRs"\n'));
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Sync failed - user needs to sign up with GitHub
|
|
220
|
+
const error = await syncResponse.json();
|
|
221
|
+
console.log(chalk_1.default.red(`❌ ${error.message || error.error}\n`));
|
|
222
|
+
}
|
|
223
|
+
catch (syncError) {
|
|
224
|
+
console.log(chalk_1.default.red(`❌ Sync failed: ${syncError.message}\n`));
|
|
225
|
+
}
|
|
226
|
+
// Show signup instructions
|
|
227
|
+
console.log(chalk_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
228
|
+
console.log(chalk_1.default.white('To use GitHub features, sign up with GitHub on our website.\n'));
|
|
186
229
|
console.log(chalk_1.default.bold.cyan('📝 Quick Setup:\n'));
|
|
187
230
|
console.log(chalk_1.default.gray(' 1. Visit: ') + chalk_1.default.cyan.underline('https://snapcommit.dev'));
|
|
188
231
|
console.log(chalk_1.default.gray(' 2. Click "Get Started"'));
|
|
189
232
|
console.log(chalk_1.default.gray(' 3. Sign up with GitHub'));
|
|
190
233
|
console.log(chalk_1.default.gray(' 4. Come back here and run ') + chalk_1.default.cyan('github connect') + chalk_1.default.gray(' again\n'));
|
|
191
|
-
console.log(chalk_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
192
234
|
console.log(chalk_1.default.bold('💡 Why sign up on the website?\n'));
|
|
193
235
|
console.log(chalk_1.default.gray(' • Your GitHub account is automatically connected'));
|
|
194
236
|
console.log(chalk_1.default.gray(' • Secure OAuth flow through Supabase'));
|
|
195
237
|
console.log(chalk_1.default.gray(' • Works seamlessly with the CLI\n'));
|
|
196
|
-
console.log(chalk_1.default.gray('After signing up, run: ') + chalk_1.default.cyan('github connect\n'));
|
|
197
238
|
}
|
|
198
239
|
/**
|
|
199
240
|
* GitHub status command
|