@startanaicompany/cli 1.4.4 → 1.4.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startanaicompany/cli",
3
- "version": "1.4.4",
3
+ "version": "1.4.8",
4
4
  "description": "Official CLI for StartAnAiCompany.com - Deploy AI recruitment sites with ease",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -66,7 +66,11 @@ async function status() {
66
66
 
67
67
  // Show account info
68
68
  logger.field('User ID', userData.id);
69
- logger.field('Git Username', userData.git_username || 'Not set');
69
+ if (userData.git_username) {
70
+ logger.field('Git Username', userData.git_username);
71
+ } else {
72
+ logger.field('Git Connection', 'Not connected (use OAuth to connect)');
73
+ }
70
74
  logger.field('Applications', `${userData.application_count} / ${userData.max_applications}`);
71
75
 
72
76
  logger.newline();
@@ -64,13 +64,17 @@ async function verify(code) {
64
64
 
65
65
  logger.newline();
66
66
  logger.success('Your account is now verified!');
67
- logger.info('You can now create and deploy applications.');
68
67
 
69
68
  // Show API key if provided (FULL key, not truncated)
70
69
  if (result.api_key) {
71
70
  logger.newline();
72
71
  logger.field('API Key', result.api_key);
73
72
  logger.warn('Save your API key securely. It will not be shown again.');
73
+ logger.newline();
74
+ logger.info('Next step: Login with your API key');
75
+ logger.log(` saac login -e ${user.email} -k ${result.api_key}`);
76
+ logger.newline();
77
+ logger.info('After login, you can create and deploy applications.');
74
78
  }
75
79
 
76
80
  // Show expiration if session token was updated
package/src/lib/oauth.js CHANGED
@@ -47,7 +47,7 @@ async function connectGitAccount(gitHost, apiKey) {
47
47
 
48
48
  // Build authorization URL
49
49
  const baseUrl = getApiUrl().replace('/api/v1', ''); // Remove /api/v1 suffix
50
- const authUrl = `${baseUrl}/oauth/authorize?git_host=${encodeURIComponent(gitHost)}&session_id=${sessionId}`;
50
+ const authUrl = `${baseUrl}/oauth/authorize?git_host=${encodeURIComponent(gitHost)}&session_id=${sessionId}&token=${encodeURIComponent(apiKey)}`;
51
51
 
52
52
  logger.info('Opening browser for authentication...');
53
53
  logger.newline();
@@ -90,6 +90,9 @@ async function pollForCompletion(sessionId, apiKey) {
90
90
 
91
91
  const baseUrl = getApiUrl().replace('/api/v1', ''); // Remove /api/v1 suffix
92
92
 
93
+ // Give user time to complete OAuth flow in browser (60 seconds)
94
+ await sleep(60000);
95
+
93
96
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
94
97
  await sleep(pollInterval);
95
98
 
@@ -116,14 +119,21 @@ async function pollForCompletion(sessionId, apiKey) {
116
119
  // Still pending, continue polling
117
120
  // Silent polling - spinner shows progress
118
121
  } catch (error) {
119
- if (error.response?.status === 404) {
120
- throw new Error('OAuth session not found or expired');
122
+ // During polling, 401/404 errors are expected while user completes OAuth in browser
123
+ // Only fail on other error types or after timeout
124
+ const status = error.response?.status;
125
+
126
+ if (status === 401 || status === 404) {
127
+ // Session not found yet or not authorized yet - continue polling
128
+ continue;
121
129
  }
130
+
131
+ // For other errors (500, network errors, etc.), throw immediately
122
132
  throw error;
123
133
  }
124
134
  }
125
135
 
126
- throw new Error('OAuth authorization timed out (5 minutes). Please try again.');
136
+ throw new Error('OAuth authorization timed out (5 minutes). Please complete the authorization in your browser and try again.');
127
137
  }
128
138
 
129
139
  /**