@startanaicompany/cli 1.4.2 → 1.4.4

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.2",
3
+ "version": "1.4.4",
4
4
  "description": "Official CLI for StartAnAiCompany.com - Deploy AI recruitment sites with ease",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -82,16 +82,8 @@ async function register(options) {
82
82
  logger.newline();
83
83
  logger.field('Email', email);
84
84
 
85
- // Show session token or API key info
86
- if (result.session_token) {
87
- logger.field('Session Token', result.session_token.substring(0, 20) + '...');
88
- if (result.expires_at) {
89
- const expirationDate = new Date(result.expires_at);
90
- logger.field('Expires', expirationDate.toLocaleDateString());
91
- }
92
- } else if (result.api_key) {
93
- logger.field('API Key', result.api_key.substring(0, 20) + '...');
94
- }
85
+ // Session token is automatically saved, no need to show it
86
+ // User will get their API key after verification
95
87
 
96
88
  } catch (error) {
97
89
  spin.fail('Registration failed');
@@ -21,7 +21,7 @@ async function verify(code) {
21
21
 
22
22
  const user = getUser();
23
23
 
24
- if (!user || !user.email) {
24
+ if (!user || !user.userId) {
25
25
  logger.error('No user found. Please register first');
26
26
  logger.newline();
27
27
  logger.info('Run:');
@@ -39,17 +39,22 @@ async function verify(code) {
39
39
  const spin = logger.spinner('Verifying email...').start();
40
40
 
41
41
  try {
42
- const result = await api.verifyEmail(user.email, code);
42
+ const result = await api.verifyEmail(user.userId, code);
43
43
 
44
44
  spin.succeed('Email verified successfully!');
45
45
 
46
- // Update user verification status and session token if provided
46
+ // Update user verification status and save API key
47
47
  const updatedUser = {
48
48
  ...user,
49
49
  verified: true,
50
50
  };
51
51
 
52
- // If backend returns new session token after verification, update it
52
+ // Save API key if returned (only returned once on verification)
53
+ if (result.api_key) {
54
+ updatedUser.apiKey = result.api_key;
55
+ }
56
+
57
+ // If backend returns session token after verification, update it
53
58
  if (result.session_token) {
54
59
  updatedUser.sessionToken = result.session_token;
55
60
  updatedUser.expiresAt = result.expires_at;
@@ -61,6 +66,13 @@ async function verify(code) {
61
66
  logger.success('Your account is now verified!');
62
67
  logger.info('You can now create and deploy applications.');
63
68
 
69
+ // Show API key if provided (FULL key, not truncated)
70
+ if (result.api_key) {
71
+ logger.newline();
72
+ logger.field('API Key', result.api_key);
73
+ logger.warn('Save your API key securely. It will not be shown again.');
74
+ }
75
+
64
76
  // Show expiration if session token was updated
65
77
  if (result.expires_at) {
66
78
  const expirationDate = new Date(result.expires_at);
package/src/lib/api.js CHANGED
@@ -68,10 +68,10 @@ async function register(email) {
68
68
  /**
69
69
  * Verify email with code
70
70
  */
71
- async function verifyEmail(email, code) {
71
+ async function verifyEmail(userId, code) {
72
72
  const client = createClient();
73
73
  const response = await client.post('/users/verify', {
74
- email,
74
+ user_id: userId,
75
75
  verification_code: code,
76
76
  });
77
77
  return response.data;