@startanaicompany/cli 1.4.12 → 1.4.14

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/CLAUDE.md CHANGED
@@ -493,7 +493,7 @@ The wrapper API expects Git repositories to be hosted on the StartAnAiCompany Gi
493
493
  - During registration, Gitea username can be auto-detected or manually provided
494
494
  - Applications reference repositories in the format: `git@git.startanaicompany.com:user/repo.git`
495
495
 
496
- ## Current Status - Version 1.4.12
496
+ ## Current Status - Version 1.4.14
497
497
 
498
498
  ### Completed Features
499
499
 
@@ -706,4 +706,4 @@ Before publishing to npm:
706
706
  - `dotenv` - Environment variables
707
707
  - `open` - Open browser for OAuth (v8.4.2 for compatibility with chalk v4)
708
708
 
709
- **Version:** 1.4.12 (current)
709
+ **Version:** 1.4.14 (current)
File without changes
package/PUBLISHING.md CHANGED
File without changes
package/README.md CHANGED
@@ -29,10 +29,16 @@ saac register --email user@example.com
29
29
  # 2. Verify your email (check MailHog)
30
30
  saac verify 123456
31
31
 
32
- # 3. Create a new application
33
- saac create my-recruitment-site
32
+ # 3. Login with your API key
33
+ saac login -e user@example.com -k cw_your_api_key
34
34
 
35
- # 4. Deploy!
35
+ # 4. Connect your Git account (OAuth)
36
+ saac git connect
37
+
38
+ # 5. Create a new application
39
+ saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
40
+
41
+ # 6. Deploy!
36
42
  saac deploy
37
43
  ```
38
44
 
@@ -40,11 +46,11 @@ saac deploy
40
46
 
41
47
  ## Git Authentication
42
48
 
43
- SAAC CLI supports two methods for Git authentication:
49
+ SAAC CLI uses **OAuth-only authentication** for Git access. You must connect your Git account before creating applications.
44
50
 
45
- ### Method 1: OAuth (Recommended ✨ NEW in 1.4.0)
51
+ ### Connect Your Git Account
46
52
 
47
- Connect your Git account once, deploy unlimited applications without providing tokens:
53
+ Connect your Git account once, deploy unlimited applications:
48
54
 
49
55
  ```bash
50
56
  # Connect Git account (interactive)
@@ -65,28 +71,18 @@ saac git disconnect git.startanaicompany.com
65
71
  - ✅ No need to remember or copy tokens
66
72
  - ✅ Tokens stored encrypted on server
67
73
  - ✅ Supports Gitea, GitHub, and GitLab
74
+ - 🔒 More secure than manual tokens
68
75
 
69
76
  **Creating apps with OAuth:**
70
77
  ```bash
71
- # No token needed if OAuth connected!
78
+ # OAuth connection required!
72
79
  saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
73
80
 
74
81
  # CLI automatically uses your connected account
75
82
  # ✅ Using connected account: username@git.startanaicompany.com
76
83
  ```
77
84
 
78
- ### Method 2: Manual Token (Fallback)
79
-
80
- Provide Git API token for each application:
81
-
82
- ```bash
83
- saac create my-app \
84
- -s myapp \
85
- -r git@git.startanaicompany.com:user/repo.git \
86
- -t your_gitea_token_here
87
- ```
88
-
89
- **Note:** OAuth automatically takes precedence. Manual tokens are only used as fallback if no OAuth connection exists.
85
+ **⚠️ Important:** You must connect your Git account with `saac git connect` before creating applications. Manual tokens are no longer supported.
90
86
 
91
87
  ---
92
88
 
@@ -216,11 +212,11 @@ saac init
216
212
  Create a new application
217
213
 
218
214
  ```bash
219
- # Basic application
220
- saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git -t abc123
215
+ # Basic application (OAuth required!)
216
+ saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
221
217
 
222
218
  # Advanced with health checks and migration
223
- saac create api -s api -r git@git... -t abc123 \
219
+ saac create api -s api -r git@git... \
224
220
  --build-pack nixpacks \
225
221
  --port 8080 \
226
222
  --pre-deploy-cmd "npm run migrate" \
@@ -233,7 +229,9 @@ saac create api -s api -r git@git... -t abc123 \
233
229
  - `<name>` - Application name
234
230
  - `-s, --subdomain <subdomain>` - Subdomain for your app
235
231
  - `-r, --repository <url>` - Git repository URL (SSH format)
236
- - `-t, --git-token <token>` - Git API token (optional if OAuth connected)
232
+
233
+ **Prerequisites:**
234
+ - You must connect your Git account first: `saac git connect`
237
235
 
238
236
  **Optional:**
239
237
  - `-b, --branch <branch>` - Git branch (default: master)
@@ -413,20 +411,26 @@ saac register -e dev@company.com
413
411
  # Check MailHog for code
414
412
  saac verify 123456
415
413
 
416
- # Step 2: Clone or create your project
414
+ # Step 2: Login
415
+ saac login -e dev@company.com -k cw_your_api_key
416
+
417
+ # Step 3: Connect your Git account (OAuth)
418
+ saac git connect
419
+
420
+ # Step 4: Clone or create your project
417
421
  git clone git@git.startanaicompany.com:user/mysite.git
418
422
  cd mysite
419
423
 
420
- # Step 3: Initialize SAAC
421
- saac init --subdomain mycompany
424
+ # Step 5: Create application
425
+ saac create mysite -s mysite -r git@git.startanaicompany.com:user/mysite.git
422
426
 
423
- # Step 4: Deploy
427
+ # Step 6: Deploy
424
428
  saac deploy
425
429
 
426
- # Step 5: View logs
430
+ # Step 7: View logs
427
431
  saac logs --follow
428
432
 
429
- # Step 6: Update environment variables
433
+ # Step 8: Update environment variables
430
434
  saac env set COMPANY_NAME="My Company"
431
435
  saac deploy # Redeploy to apply changes
432
436
  ```
@@ -448,7 +452,13 @@ saac env set CONTACT_EMAIL="contact@acme.com"
448
452
 
449
453
  ### "Not logged in"
450
454
  ```bash
451
- saac login
455
+ saac login -e your@email.com -k cw_your_api_key
456
+ ```
457
+
458
+ ### "Git account not connected"
459
+ You must connect your Git account before creating applications:
460
+ ```bash
461
+ saac git connect
452
462
  ```
453
463
 
454
464
  ### "No application found"
File without changes
package/bin/saac.js CHANGED
@@ -117,7 +117,6 @@ program
117
117
  // Required options
118
118
  .option('-s, --subdomain <subdomain>', 'Subdomain')
119
119
  .option('-r, --repository <url>', 'Git repository URL (SSH format)')
120
- .option('-t, --git-token <token>', 'Git API token')
121
120
  // Basic options
122
121
  .option('-b, --branch <branch>', 'Git branch', 'master')
123
122
  .option('-d, --domain-suffix <suffix>', 'Domain suffix', 'startanaicompany.com')
File without changes
package/git_auth.md CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startanaicompany/cli",
3
- "version": "1.4.12",
3
+ "version": "1.4.14",
4
4
  "description": "Official CLI for StartAnAiCompany.com - Deploy AI recruitment sites with ease",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -29,7 +29,6 @@ async function create(name, options) {
29
29
  logger.info('Required options:');
30
30
  logger.log(' -s, --subdomain <subdomain> Subdomain for your app');
31
31
  logger.log(' -r, --repository <url> Git repository URL (SSH format)');
32
- logger.log(' -t, --git-token <token> Git API token (optional if OAuth connected)');
33
32
  logger.newline();
34
33
  logger.info('Optional options:');
35
34
  logger.log(' -b, --branch <branch> Git branch (default: master)');
@@ -51,9 +50,9 @@ async function create(name, options) {
51
50
  logger.log(' --env <KEY=VALUE> Environment variable (can be used multiple times)');
52
51
  logger.newline();
53
52
  logger.info('Example:');
54
- logger.log(' saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git -t abc123');
55
- logger.log(' saac create api -s api -r git@git... -t abc123 --build-pack nixpacks --port 8080');
56
- logger.log(' saac create web -s web -r git@git... -t abc123 --health-check --pre-deploy-cmd "npm run migrate"');
53
+ logger.log(' saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git');
54
+ logger.log(' saac create api -s api -r git@git... --build-pack nixpacks --port 8080');
55
+ logger.log(' saac create web -s web -r git@git... --health-check --pre-deploy-cmd "npm run migrate"');
57
56
  process.exit(1);
58
57
  }
59
58
 
@@ -62,7 +61,8 @@ async function create(name, options) {
62
61
  logger.newline();
63
62
  logger.info('Example:');
64
63
  logger.log(` saac create ${name} -s myapp -r git@git.startanaicompany.com:user/repo.git`);
65
- logger.log(` saac create ${name} -s myapp -r git@git... -t your_token # With manual token`);
64
+ logger.newline();
65
+ logger.info('Note: Git OAuth connection required. Connect with: saac git connect');
66
66
  process.exit(1);
67
67
  }
68
68
 
@@ -77,36 +77,16 @@ async function create(name, options) {
77
77
  if (connection) {
78
78
  logger.success(`Using connected account: ${connection.gitUsername}@${connection.gitHost}`);
79
79
  logger.newline();
80
- } else if (!options.gitToken) {
81
- // No OAuth connection AND no manual token provided
82
- logger.warn(`Git account not connected for ${gitHost}`);
80
+ } else {
81
+ // No OAuth connection - must connect
82
+ logger.error(`Git account not connected for ${gitHost}`);
83
83
  logger.newline();
84
-
85
- const { shouldConnect } = await inquirer.prompt([
86
- {
87
- type: 'confirm',
88
- name: 'shouldConnect',
89
- message: 'Would you like to connect now?',
90
- default: true,
91
- },
92
- ]);
93
-
94
- if (!shouldConnect) {
95
- logger.newline();
96
- logger.error('Cannot create application without Git authentication');
97
- logger.newline();
98
- logger.info('Options:');
99
- logger.log(' 1. Connect Git account: saac git connect');
100
- logger.log(' 2. Provide token: saac create ... --git-token <token>');
101
- process.exit(1);
102
- }
103
-
104
- // Initiate OAuth flow
105
- await oauth.connectGitAccount(gitHost, user.sessionToken || user.apiKey);
106
-
84
+ logger.info('Git OAuth connection is required to create applications');
107
85
  logger.newline();
108
- logger.section('Continuing with application creation');
86
+ logger.info('Connect now:');
87
+ logger.log(' saac git connect');
109
88
  logger.newline();
89
+ process.exit(1);
110
90
  }
111
91
 
112
92
  // Build application payload
@@ -118,26 +98,24 @@ async function create(name, options) {
118
98
  git_branch: options.branch || 'master',
119
99
  };
120
100
 
121
- // Only include git_api_token if provided (OAuth will be used if available)
122
- if (options.gitToken) {
123
- appData.git_api_token = options.gitToken;
124
- }
101
+ // OAuth tokens are retrieved from database by wrapper
102
+ // No manual git_api_token field needed
125
103
 
126
104
  // Optional: Port configuration
127
105
  if (options.port) {
128
106
  appData.ports_exposes = options.port;
129
107
  }
130
108
 
131
- // Optional: Build pack
132
- if (options.buildPack) {
133
- const validBuildPacks = ['dockercompose', 'nixpacks', 'dockerfile', 'static'];
134
- if (!validBuildPacks.includes(options.buildPack)) {
135
- logger.error(`Invalid build pack: ${options.buildPack}`);
136
- logger.info(`Must be one of: ${validBuildPacks.join(', ')}`);
137
- process.exit(1);
138
- }
139
- appData.build_pack = options.buildPack;
109
+ // Optional: Build pack (defaults to dockercompose)
110
+ const validBuildPacks = ['dockercompose', 'nixpacks', 'dockerfile', 'static'];
111
+ const buildPack = options.buildPack || 'dockercompose';
112
+
113
+ if (!validBuildPacks.includes(buildPack)) {
114
+ logger.error(`Invalid build pack: ${buildPack}`);
115
+ logger.info(`Must be one of: ${validBuildPacks.join(', ')}`);
116
+ process.exit(1);
140
117
  }
118
+ appData.build_pack = buildPack;
141
119
 
142
120
  // Optional: Custom commands
143
121
  if (options.installCmd) {
@@ -304,9 +282,17 @@ async function create(name, options) {
304
282
  logger.error('Validation failed');
305
283
  if (data.details) {
306
284
  logger.newline();
307
- Object.entries(data.details).forEach(([field, message]) => {
308
- logger.log(` ${logger.chalk.yellow(field)}: ${message}`);
309
- });
285
+ // Backend sends details as array: [{field, message, type}, ...]
286
+ if (Array.isArray(data.details)) {
287
+ data.details.forEach((detail) => {
288
+ logger.log(` ${logger.chalk.yellow(detail.field)}: ${detail.message}`);
289
+ });
290
+ } else {
291
+ // Fallback for object format: {field: message, ...}
292
+ Object.entries(data.details).forEach(([field, message]) => {
293
+ logger.log(` ${logger.chalk.yellow(field)}: ${message}`);
294
+ });
295
+ }
310
296
  } else {
311
297
  logger.log(` ${data.message || data.error}`);
312
298
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -259,9 +259,17 @@ async function update(options) {
259
259
  logger.error('Validation failed');
260
260
  if (data.details) {
261
261
  logger.newline();
262
- Object.entries(data.details).forEach(([field, message]) => {
263
- logger.log(` ${logger.chalk.yellow(field)}: ${message}`);
264
- });
262
+ // Backend sends details as array: [{field, message, type}, ...]
263
+ if (Array.isArray(data.details)) {
264
+ data.details.forEach((detail) => {
265
+ logger.log(` ${logger.chalk.yellow(detail.field)}: ${detail.message}`);
266
+ });
267
+ } else {
268
+ // Fallback for object format: {field: message, ...}
269
+ Object.entries(data.details).forEach(([field, message]) => {
270
+ logger.log(` ${logger.chalk.yellow(field)}: ${message}`);
271
+ });
272
+ }
265
273
  } else {
266
274
  logger.log(` ${data.message || data.error}`);
267
275
  }
File without changes
File without changes
package/src/lib/api.js CHANGED
File without changes
package/src/lib/config.js CHANGED
File without changes
package/src/lib/logger.js CHANGED
File without changes
package/src/lib/oauth.js CHANGED
File without changes
File without changes