@startanaicompany/cli 1.4.9 → 1.4.11

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.9",
3
+ "version": "1.4.11",
4
4
  "description": "Official CLI for StartAnAiCompany.com - Deploy AI recruitment sites with ease",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -36,7 +36,7 @@ async function connect(host) {
36
36
  name: 'choice',
37
37
  message: 'Select Git provider:',
38
38
  choices: [
39
- { name: 'git.startanaicompany.com (Gitea)', value: 'git.startanaicompany.com' },
39
+ { name: 'git.startanaicompany.com (Git StartanAICompany)', value: 'git.startanaicompany.com' },
40
40
  { name: 'github.com', value: 'github.com' },
41
41
  { name: 'gitlab.com', value: 'gitlab.com' },
42
42
  { name: 'Custom host', value: 'custom' },
@@ -66,11 +66,18 @@ async function status() {
66
66
 
67
67
  // Show account info
68
68
  logger.field('User ID', userData.id);
69
- if (userData.git_username) {
70
- logger.field('Git Username', userData.git_username);
69
+
70
+ // Show OAuth connections
71
+ if (userData.git_connections && userData.git_connections.length > 0) {
72
+ // Show all OAuth connections
73
+ userData.git_connections.forEach((conn, index) => {
74
+ const label = index === 0 ? 'Git Connection' : ' '; // Align subsequent connections
75
+ logger.field(label, `${conn.gitUsername} @ ${conn.gitHost}`);
76
+ });
71
77
  } else {
72
- logger.field('Git Connection', 'Not connected (use OAuth to connect)');
78
+ logger.field('Git Connection', 'Not connected (use: saac git connect)');
73
79
  }
80
+
74
81
  logger.field('Applications', `${userData.application_count} / ${userData.max_applications}`);
75
82
 
76
83
  logger.newline();
package/src/lib/oauth.js CHANGED
@@ -145,13 +145,14 @@ async function pollForCompletion(sessionId, apiKey) {
145
145
  */
146
146
  async function getConnection(gitHost, apiKey) {
147
147
  try {
148
+ // Use correct header based on token type
149
+ const headers = apiKey.startsWith('st_')
150
+ ? { 'X-Session-Token': apiKey }
151
+ : { 'X-API-Key': apiKey };
152
+
148
153
  const response = await axios.get(
149
154
  `${getApiUrl()}/users/me/oauth`,
150
- {
151
- headers: {
152
- 'X-API-Key': apiKey,
153
- },
154
- }
155
+ { headers }
155
156
  );
156
157
 
157
158
  const connection = response.data.connections.find(
@@ -170,13 +171,14 @@ async function getConnection(gitHost, apiKey) {
170
171
  * @returns {Promise<array>} - Array of connection objects
171
172
  */
172
173
  async function listConnections(apiKey) {
174
+ // Use correct header based on token type
175
+ const headers = apiKey.startsWith('st_')
176
+ ? { 'X-Session-Token': apiKey }
177
+ : { 'X-API-Key': apiKey };
178
+
173
179
  const response = await axios.get(
174
180
  `${getApiUrl()}/users/me/oauth`,
175
- {
176
- headers: {
177
- 'X-API-Key': apiKey,
178
- },
179
- }
181
+ { headers }
180
182
  );
181
183
 
182
184
  return response.data.connections || [];
@@ -188,13 +190,14 @@ async function listConnections(apiKey) {
188
190
  * @param {string} apiKey - User's API key
189
191
  */
190
192
  async function revokeConnection(gitHost, apiKey) {
193
+ // Use correct header based on token type
194
+ const headers = apiKey.startsWith('st_')
195
+ ? { 'X-Session-Token': apiKey }
196
+ : { 'X-API-Key': apiKey };
197
+
191
198
  await axios.delete(
192
199
  `${getApiUrl()}/users/me/oauth/${encodeURIComponent(gitHost)}`,
193
- {
194
- headers: {
195
- 'X-API-Key': apiKey,
196
- },
197
- }
200
+ { headers }
198
201
  );
199
202
  }
200
203