@startanaicompany/cli 1.4.13 → 1.4.15

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.13
496
+ ## Current Status - Version 1.4.15
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.13 (current)
709
+ **Version:** 1.4.15 (current)
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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startanaicompany/cli",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "description": "Official CLI for StartAnAiCompany.com - Deploy AI recruitment sites with ease",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -3,10 +3,11 @@
3
3
  */
4
4
 
5
5
  const api = require('../lib/api');
6
- const { isAuthenticated, saveProjectConfig, getUser } = require('../lib/config');
6
+ const { isAuthenticated, saveProjectConfig, getUser, getProjectConfig } = require('../lib/config');
7
7
  const logger = require('../lib/logger');
8
8
  const oauth = require('../lib/oauth');
9
9
  const inquirer = require('inquirer');
10
+ const { execSync } = require('child_process');
10
11
 
11
12
  async function create(name, options) {
12
13
  try {
@@ -19,6 +20,65 @@ async function create(name, options) {
19
20
  process.exit(1);
20
21
  }
21
22
 
23
+ // Check if application already exists in this directory
24
+ const existingConfig = getProjectConfig();
25
+ if (existingConfig) {
26
+ logger.error('Application already published');
27
+ logger.newline();
28
+ logger.info('This directory is already linked to an application:');
29
+ if (existingConfig.applicationName) {
30
+ logger.field('Name', existingConfig.applicationName);
31
+ }
32
+ if (existingConfig.subdomain && existingConfig.domainSuffix) {
33
+ const domain = `https://${existingConfig.subdomain}.${existingConfig.domainSuffix}`;
34
+ logger.field('Domain', domain);
35
+ logger.newline();
36
+ logger.info(`Your application should be available at: ${domain}`);
37
+ }
38
+ logger.newline();
39
+ logger.info('To manage this application, use:');
40
+ logger.log(' saac deploy Deploy changes');
41
+ logger.log(' saac update [options] Update configuration');
42
+ logger.log(' saac env set KEY=VALUE Set environment variables');
43
+ logger.log(' saac logs --follow View logs');
44
+ logger.log(' saac status Check status');
45
+ logger.newline();
46
+ logger.warn('To create a new application, use a different directory');
47
+ process.exit(1);
48
+ }
49
+
50
+ // Check current git branch
51
+ let currentBranch = null;
52
+ try {
53
+ currentBranch = execSync('git rev-parse --abbrev-ref HEAD', {
54
+ encoding: 'utf8',
55
+ stdio: ['pipe', 'pipe', 'ignore']
56
+ }).trim();
57
+ } catch (error) {
58
+ // Not in a git repository or git not available - continue anyway
59
+ }
60
+
61
+ if (currentBranch && currentBranch !== 'master' && currentBranch !== 'main') {
62
+ const specifiedBranch = options.branch;
63
+
64
+ if (!specifiedBranch || specifiedBranch !== currentBranch) {
65
+ logger.error(`You are currently on branch: ${logger.chalk.yellow(currentBranch)}`);
66
+ logger.newline();
67
+ logger.warn('This is not the master or main branch!');
68
+ logger.newline();
69
+ logger.info('If you really want to use this branch, confirm by specifying it explicitly:');
70
+ logger.log(` saac create ${name} -s ${options.subdomain || '<subdomain>'} -r ${options.repository || '<repository>'} --branch ${currentBranch}`);
71
+ logger.newline();
72
+ logger.info('Or switch to master/main branch:');
73
+ logger.log(' git checkout master');
74
+ logger.log(' git checkout main');
75
+ process.exit(1);
76
+ } else {
77
+ logger.warn(`Using branch: ${logger.chalk.yellow(currentBranch)}`);
78
+ logger.newline();
79
+ }
80
+ }
81
+
22
82
  // Validate required fields
23
83
  if (!name) {
24
84
  logger.error('Application name is required');
@@ -106,16 +166,16 @@ async function create(name, options) {
106
166
  appData.ports_exposes = options.port;
107
167
  }
108
168
 
109
- // Optional: Build pack
110
- if (options.buildPack) {
111
- const validBuildPacks = ['dockercompose', 'nixpacks', 'dockerfile', 'static'];
112
- if (!validBuildPacks.includes(options.buildPack)) {
113
- logger.error(`Invalid build pack: ${options.buildPack}`);
114
- logger.info(`Must be one of: ${validBuildPacks.join(', ')}`);
115
- process.exit(1);
116
- }
117
- appData.build_pack = options.buildPack;
169
+ // Optional: Build pack (defaults to dockercompose)
170
+ const validBuildPacks = ['dockercompose', 'nixpacks', 'dockerfile', 'static'];
171
+ const buildPack = options.buildPack || 'dockercompose';
172
+
173
+ if (!validBuildPacks.includes(buildPack)) {
174
+ logger.error(`Invalid build pack: ${buildPack}`);
175
+ logger.info(`Must be one of: ${validBuildPacks.join(', ')}`);
176
+ process.exit(1);
118
177
  }
178
+ appData.build_pack = buildPack;
119
179
 
120
180
  // Optional: Custom commands
121
181
  if (options.installCmd) {
@@ -92,12 +92,13 @@ async function status() {
92
92
  const hasMore = applications.length > 5;
93
93
 
94
94
  const data = [
95
- ['Name', 'Domain', 'Status', 'Created'],
95
+ ['Name', 'Domain', 'Status', 'Branch', 'Created'],
96
96
  ];
97
97
 
98
98
  displayApps.forEach((app) => {
99
99
  const created = new Date(app.created_at).toLocaleDateString();
100
100
  const status = app.status || 'unknown';
101
+ const branch = app.git_branch || 'unknown';
101
102
 
102
103
  // Status with icons (handle both Coolify format and documented format)
103
104
  let statusDisplay;
@@ -128,6 +129,7 @@ async function status() {
128
129
  app.name,
129
130
  app.domain || `${app.subdomain}.startanaicompany.com`,
130
131
  statusDisplay,
132
+ branch,
131
133
  created
132
134
  ]);
133
135
  });