@startanaicompany/cli 1.4.20 → 1.5.0

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/README.md CHANGED
@@ -8,11 +8,14 @@
8
8
  ## Features
9
9
 
10
10
  - ✨ **Simple & Intuitive** - Deploy with a single command
11
- - 🔐 **Secure** - API key-based authentication
11
+ - 🔐 **Secure** - Session token + OAuth-based authentication
12
12
  - 🚀 **Fast** - Optimized for quick deployments
13
13
  - 📦 **Zero Configuration** - Works out of the box
14
14
  - 🎨 **Beautiful CLI** - Color-coded output and progress indicators
15
15
  - 🔄 **Auto-healing** - Automatically fixes common deployment issues
16
+ - 🖥️ **Remote Shell** - Access your container via WebSocket (Project Aurora)
17
+ - 🔧 **Remote Execution** - Run commands inside your container
18
+ - 📊 **Real-time Logs** - View runtime and deployment logs
16
19
 
17
20
  ## Installation
18
21
 
@@ -24,15 +27,15 @@ npm install -g @startanaicompany/cli
24
27
 
25
28
  ```bash
26
29
  # 1. Register for an account
27
- saac register --email user@example.com
30
+ saac register -e user@example.com
28
31
 
29
- # 2. Verify your email (check MailHog)
32
+ # 2. Verify your email (check MailHog at https://mailhog.goryan.io)
30
33
  saac verify 123456
31
34
 
32
- # 3. Login with your API key
33
- saac login -e user@example.com -k cw_your_api_key
35
+ # 3. Login with your API key (shown after verification)
36
+ saac login -e user@example.com -k cw_your_api_key_here
34
37
 
35
- # 4. Connect your Git account (OAuth)
38
+ # 4. Connect your Git account (OAuth - required!)
36
39
  saac git connect
37
40
 
38
41
  # 5. Create a new application
@@ -40,448 +43,2398 @@ saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
40
43
 
41
44
  # 6. Deploy!
42
45
  saac deploy
46
+
47
+ # 7. View logs
48
+ saac logs
49
+
50
+ # 8. Access your container shell
51
+ saac shell
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Table of Contents
57
+
58
+ - [Authentication](#authentication)
59
+ - [Register & Login](#register--login)
60
+ - [Session Management](#session-management)
61
+ - [API Keys](#api-keys)
62
+ - [Git OAuth](#git-oauth)
63
+ - [Application Management](#application-management)
64
+ - [Environment Variables](#environment-variables)
65
+ - [Remote Access](#remote-access)
66
+ - [Remote Shell (saac shell)](#remote-shell)
67
+ - [Remote Execution (saac exec)](#remote-execution)
68
+ - [Local Development (saac run)](#local-development)
69
+ - [Logs & Monitoring](#logs--monitoring)
70
+ - [Domain Management](#domain-management)
71
+ - [Complete Workflows](#complete-workflows)
72
+ - [Troubleshooting](#troubleshooting)
73
+
74
+ ---
75
+
76
+ ## Authentication
77
+
78
+ ### Register & Login
79
+
80
+ SAAC uses a **session token-based authentication** system for security and ease of use.
81
+
82
+ #### `saac register -e <email>`
83
+
84
+ Register for a new account. Your Git username will be auto-detected from your email.
85
+
86
+ ```bash
87
+ # Register with email
88
+ saac register -e user@example.com
89
+
90
+ # With custom Git username (optional)
91
+ saac register -e user@example.com --git-username myusername
92
+ ```
93
+
94
+ **What happens:**
95
+ 1. Account created in database
96
+ 2. Verification code sent to email
97
+ 3. You're prompted to verify your email
98
+
99
+ **Required:**
100
+ - `-e, --email <email>` - Your email address
101
+
102
+ **Optional:**
103
+ - `--git-username <username>` - Git username (auto-detected from email if not provided)
104
+
105
+ #### `saac verify <code>`
106
+
107
+ Verify your email address with the 6-digit code from your email.
108
+
109
+ ```bash
110
+ saac verify 123456
111
+ ```
112
+
113
+ **Important:** The verification response shows your **API key** (starts with `cw_`). **Save this immediately** - it's only shown once!
114
+
115
+ ```
116
+ ✓ Email verified successfully!
117
+
118
+ Your API Key (save this now!):
119
+
120
+ cw_kgzfNByNNrtrDsAW07h6ORwTtP3POK6O98klH9Rm8jTt9ByHojeH7zDmGwaF
121
+
122
+ ⚠️ This API key is shown only once. Store it securely!
123
+ ```
124
+
125
+ **Where to check for codes:** https://mailhog.goryan.io (development environment)
126
+
127
+ #### `saac login -e <email> -k <api-key>`
128
+
129
+ Login with your email and API key. This exchanges your permanent API key for a temporary session token (valid for 1 year).
130
+
131
+ ```bash
132
+ saac login -e user@example.com -k cw_your_api_key_here
133
+ ```
134
+
135
+ **What happens:**
136
+ 1. API key verified with backend
137
+ 2. Session token generated (valid for 1 year)
138
+ 3. Session token stored locally in `~/.config/startanaicompany/config.json`
139
+ 4. All future commands use session token automatically
140
+
141
+ **Required:**
142
+ - `-e, --email <email>` - Your email address
143
+ - `-k, --api-key <key>` - Your API key (from verification step)
144
+
145
+ **Alternative: OTP Login (Optional)**
146
+
147
+ You can also login with a one-time password sent to your email:
148
+
149
+ ```bash
150
+ saac login -e user@example.com --otp 123456
151
+ ```
152
+
153
+ ### Session Management
154
+
155
+ #### `saac sessions`
156
+
157
+ List all active sessions across all devices.
158
+
159
+ ```bash
160
+ saac sessions
161
+ ```
162
+
163
+ **Shows:**
164
+ - Device/location
165
+ - Session creation date
166
+ - Last used timestamp
167
+ - IP address
168
+ - Expiration date
169
+
170
+ **Example output:**
171
+ ```
172
+ Active Sessions
173
+ ───────────────
174
+
175
+ Session 1
176
+ Created: Jan 26, 2026, 10:00 AM
177
+ Last Used: Jan 29, 2026, 9:00 AM
178
+ IP: 192.168.1.100
179
+ Expires: Jan 26, 2027
180
+
181
+ Session 2
182
+ Created: Jan 20, 2026, 2:00 PM
183
+ Last Used: Jan 28, 2026, 5:00 PM
184
+ IP: 10.0.0.50
185
+ Expires: Jan 20, 2027
186
+
187
+ Total: 2 active sessions
188
+ ```
189
+
190
+ #### `saac logout`
191
+
192
+ Logout from current device (revokes current session token only).
193
+
194
+ ```bash
195
+ saac logout
196
+ ```
197
+
198
+ **What happens:**
199
+ - Current session token revoked on server
200
+ - Local config cleared
201
+ - Other devices remain logged in
202
+
203
+ #### `saac logout-all [-y]`
204
+
205
+ Logout from **all devices** (revokes all session tokens).
206
+
207
+ ```bash
208
+ # With confirmation prompt
209
+ saac logout-all
210
+
211
+ # Skip confirmation
212
+ saac logout-all --yes
213
+ saac logout-all -y
214
+ ```
215
+
216
+ **What happens:**
217
+ - ALL session tokens revoked on server
218
+ - Local config cleared
219
+ - All devices logged out
220
+ - You'll need to login again on all devices
221
+
222
+ **Use case:** Security - if you suspect your session was compromised.
223
+
224
+ ### API Keys
225
+
226
+ #### `saac keys show`
227
+
228
+ Show your API key information (masked for security).
229
+
230
+ ```bash
231
+ saac keys show
232
+ saac keys info # Alias
233
+ ```
234
+
235
+ **Shows:**
236
+ - API key (masked)
237
+ - Creation date
238
+ - Last used timestamp
239
+
240
+ #### `saac keys regenerate`
241
+
242
+ Generate a new API key (invalidates the old one).
243
+
244
+ ```bash
245
+ saac keys regenerate
246
+ ```
247
+
248
+ **⚠️ Warning:** Your old API key will stop working immediately! Save the new key securely.
249
+
250
+ **What happens:**
251
+ 1. Old API key invalidated
252
+ 2. New API key generated
253
+ 3. New key displayed (only shown once)
254
+ 4. You'll need to update any scripts/automation using the old key
255
+
256
+ #### `saac whoami`
257
+
258
+ Show current user information.
259
+
260
+ ```bash
261
+ saac whoami
262
+ ```
263
+
264
+ **Shows:**
265
+ - Email
266
+ - User ID
267
+ - Verification status
268
+ - Member since date
269
+ - Connected Git accounts
270
+ - Application quotas
271
+ - Available commands
272
+
273
+ ---
274
+
275
+ ## Environment Variables for CI/CD
276
+
277
+ The SAAC CLI supports **automatic authentication** via environment variables, perfect for CI/CD pipelines, Docker containers, and automation scripts.
278
+
279
+ ### How It Works
280
+
281
+ When you run any SAAC command:
282
+ 1. CLI checks if you're already logged in (session token exists)
283
+ 2. If not logged in, checks for `SAAC_USER_API_KEY` and `SAAC_USER_EMAIL` environment variables
284
+ 3. If both are present, **automatically logs in** via API
285
+ 4. Session token is cached for subsequent commands (same performance as manual login)
286
+
287
+ ### Required Environment Variables
288
+
289
+ - `SAAC_USER_API_KEY` - Your API key (format: `cw_...`)
290
+ - `SAAC_USER_EMAIL` - Your email address
291
+
292
+ **Both variables must be set** for auto-login to work.
293
+
294
+ ### Usage Examples
295
+
296
+ #### GitHub Actions
297
+
298
+ ```yaml
299
+ name: Deploy to SAAC
300
+ on:
301
+ push:
302
+ branches: [main]
303
+
304
+ jobs:
305
+ deploy:
306
+ runs-on: ubuntu-latest
307
+ steps:
308
+ - uses: actions/checkout@v3
309
+
310
+ - name: Install SAAC CLI
311
+ run: npm install -g @startanaicompany/cli
312
+
313
+ - name: Deploy Application
314
+ env:
315
+ SAAC_USER_API_KEY: ${{ secrets.SAAC_API_KEY }}
316
+ SAAC_USER_EMAIL: ${{ secrets.SAAC_EMAIL }}
317
+ run: |
318
+ saac deploy
319
+ saac logs --deployment
320
+ ```
321
+
322
+ **Setup:**
323
+ 1. Go to your repo → Settings → Secrets → Actions
324
+ 2. Add `SAAC_API_KEY` with your API key
325
+ 3. Add `SAAC_EMAIL` with your email address
326
+
327
+ #### GitLab CI/CD
328
+
329
+ ```yaml
330
+ deploy:
331
+ stage: deploy
332
+ image: node:18
333
+ variables:
334
+ SAAC_USER_API_KEY: $CI_SAAC_API_KEY
335
+ SAAC_USER_EMAIL: $CI_SAAC_EMAIL
336
+ script:
337
+ - npm install -g @startanaicompany/cli
338
+ - saac deploy
339
+ - saac logs --deployment
340
+ only:
341
+ - main
342
+ ```
343
+
344
+ **Setup:**
345
+ 1. Go to your project → Settings → CI/CD → Variables
346
+ 2. Add `CI_SAAC_API_KEY` (protected, masked)
347
+ 3. Add `CI_SAAC_EMAIL`
348
+
349
+ #### Docker
350
+
351
+ ```dockerfile
352
+ FROM node:18
353
+
354
+ # Install SAAC CLI
355
+ RUN npm install -g @startanaicompany/cli
356
+
357
+ # Set environment variables (use build args for security)
358
+ ARG SAAC_API_KEY
359
+ ARG SAAC_EMAIL
360
+ ENV SAAC_USER_API_KEY=$SAAC_API_KEY
361
+ ENV SAAC_USER_EMAIL=$SAAC_EMAIL
362
+
363
+ # Your application code
364
+ WORKDIR /app
365
+ COPY . .
366
+
367
+ # Deploy on container startup
368
+ CMD ["sh", "-c", "saac deploy && npm start"]
369
+ ```
370
+
371
+ **Build with secrets:**
372
+ ```bash
373
+ docker build \
374
+ --build-arg SAAC_API_KEY=cw_your_key \
375
+ --build-arg SAAC_EMAIL=your@email.com \
376
+ -t my-app .
377
+ ```
378
+
379
+ #### Local Shell Script
380
+
381
+ ```bash
382
+ #!/bin/bash
383
+ set -e
384
+
385
+ # Set environment variables
386
+ export SAAC_USER_API_KEY=cw_your_api_key_here
387
+ export SAAC_USER_EMAIL=your@email.com
388
+
389
+ # Run SAAC commands
390
+ saac deploy
391
+ saac logs --deployment
392
+ saac status
393
+
394
+ echo "Deployment complete!"
395
+ ```
396
+
397
+ #### With .env File (Local Development)
398
+
399
+ Create `.env` file (**add to `.gitignore`!**):
400
+ ```bash
401
+ SAAC_USER_API_KEY=cw_your_api_key_here
402
+ SAAC_USER_EMAIL=your@email.com
403
+ ```
404
+
405
+ Use with a script:
406
+ ```bash
407
+ #!/bin/bash
408
+ # Load .env file
409
+ set -a
410
+ source .env
411
+ set +a
412
+
413
+ # Run SAAC commands
414
+ saac list
415
+ saac status
416
+ ```
417
+
418
+ ### Security Best Practices
419
+
420
+ ✅ **DO:**
421
+ - Store API keys in secrets management (GitHub Secrets, GitLab Variables, AWS Secrets Manager, etc.)
422
+ - Use environment variables for automation
423
+ - Add `.env` files to `.gitignore`
424
+ - Rotate API keys periodically with `saac keys regenerate`
425
+ - Use different API keys for different environments (dev, staging, prod)
426
+ - Set secrets as "protected" and "masked" in CI/CD systems
427
+
428
+ ❌ **DON'T:**
429
+ - Commit API keys to version control
430
+ - Share API keys in plain text (Slack, email, etc.)
431
+ - Hardcode API keys in scripts or Dockerfiles
432
+ - Use the same API key across multiple teams/projects
433
+ - Log API keys in CI/CD output
434
+
435
+ ### How It Differs from Manual Login
436
+
437
+ | Feature | Manual Login | Auto-Login (Env Vars) |
438
+ |---------|--------------|----------------------|
439
+ | Session token created | ✅ Yes | ✅ Yes |
440
+ | Session cached locally | ✅ Yes | ✅ Yes |
441
+ | Session expires | ✅ 1 year | ✅ 1 year |
442
+ | Requires user interaction | ❌ No (after first login) | ✅ Fully automated |
443
+ | Perfect for CI/CD | ⚠️ Requires manual setup | ✅ Native support |
444
+ | Performance | ⚡ Fast (cached) | ⚡ Fast (cached after first auto-login) |
445
+
446
+ ### Troubleshooting
447
+
448
+ **"Not logged in" despite setting environment variables:**
449
+ - Verify both `SAAC_USER_API_KEY` and `SAAC_USER_EMAIL` are set:
450
+ ```bash
451
+ echo $SAAC_USER_API_KEY
452
+ echo $SAAC_USER_EMAIL
453
+ ```
454
+ - Ensure API key is valid (not revoked or expired)
455
+ - Check API key format starts with `cw_`
456
+ - Try logging in manually to verify credentials work:
457
+ ```bash
458
+ saac login -e $SAAC_USER_EMAIL -k $SAAC_USER_API_KEY
459
+ ```
460
+
461
+ **Environment variables not being read:**
462
+ - Make sure variables are exported: `export SAAC_USER_API_KEY=...`
463
+ - Check for typos in variable names (must be exact)
464
+ - In Docker, ensure ENV is set or use build args correctly
465
+ - In CI/CD, verify secrets are configured correctly
466
+
467
+ **Security concerns:**
468
+ - Never print environment variables in logs: `echo $SAAC_USER_API_KEY` ❌
469
+ - Use masked/protected secrets in CI/CD systems
470
+ - Regenerate API key if accidentally exposed: `saac keys regenerate`
471
+ - Monitor active sessions: `saac sessions`
472
+
473
+ ### Example: Complete CI/CD Workflow
474
+
475
+ ```yaml
476
+ name: Full Deployment Workflow
477
+ on:
478
+ push:
479
+ branches: [main, staging]
480
+
481
+ jobs:
482
+ deploy:
483
+ runs-on: ubuntu-latest
484
+ steps:
485
+ - uses: actions/checkout@v3
486
+
487
+ - name: Setup Node.js
488
+ uses: actions/setup-node@v3
489
+ with:
490
+ node-version: '18'
491
+
492
+ - name: Install Dependencies
493
+ run: npm install
494
+
495
+ - name: Run Tests
496
+ run: npm test
497
+
498
+ - name: Install SAAC CLI
499
+ run: npm install -g @startanaicompany/cli
500
+
501
+ - name: Deploy to SAAC
502
+ env:
503
+ SAAC_USER_API_KEY: ${{ secrets.SAAC_API_KEY }}
504
+ SAAC_USER_EMAIL: ${{ secrets.SAAC_EMAIL }}
505
+ run: |
506
+ # Auto-login happens automatically!
507
+ saac deploy
508
+
509
+ # Wait for deployment to complete (built-in timeout)
510
+ echo "Deployment finished!"
511
+
512
+ - name: Check Application Status
513
+ env:
514
+ SAAC_USER_API_KEY: ${{ secrets.SAAC_API_KEY }}
515
+ SAAC_USER_EMAIL: ${{ secrets.SAAC_EMAIL }}
516
+ run: |
517
+ saac status
518
+ saac logs --deployment | tail -20
519
+
520
+ - name: Notify on Failure
521
+ if: failure()
522
+ run: |
523
+ echo "Deployment failed! Check logs with: saac logs --deployment"
524
+ ```
525
+
526
+ ---
527
+
528
+ ## Git OAuth
529
+
530
+ SAAC CLI uses **OAuth-only authentication** for Git access. You must connect your Git account before creating applications.
531
+
532
+ ### Why OAuth?
533
+
534
+ **Benefits:**
535
+ - ✅ Connect once, deploy unlimited apps
536
+ - ✅ No need to remember or manually provide tokens
537
+ - ✅ Tokens stored encrypted on server (AES-256-GCM)
538
+ - ✅ Auto-refresh for expired tokens
539
+ - ✅ Supports multiple Git providers (Gitea, GitHub, GitLab)
540
+ - 🔒 More secure than manual token management
541
+
542
+ ### `saac git connect [host]`
543
+
544
+ Connect a Git account via OAuth.
545
+
546
+ ```bash
547
+ # Interactive mode - select from providers
548
+ saac git connect
549
+
550
+ # Connect to specific host
551
+ saac git connect git.startanaicompany.com
552
+
553
+ # Connect from repository URL
554
+ saac git connect git@git.startanaicompany.com:user/repo.git
555
+ ```
556
+
557
+ **What happens:**
558
+ 1. Browser opens to OAuth authorization page
559
+ 2. You authorize on the Git provider
560
+ 3. CLI polls for completion (every 2 seconds, max 5 minutes)
561
+ 4. Connection saved encrypted on server
562
+ 5. Future app creations use this connection automatically
563
+
564
+ **Example output:**
565
+ ```
566
+ Git OAuth Connection
567
+ ────────────────────
568
+
569
+ ℹ Opening browser for OAuth authorization...
570
+ ℹ Authorize the application in your browser
571
+
572
+ ⏳ Waiting for authorization... (0s)
573
+
574
+ ✓ Git account connected successfully!
575
+
576
+ Provider: gitea
577
+ Host: git.startanaicompany.com
578
+ Username: ryan.gogo
579
+ Expires: Never (auto-refreshed)
580
+
581
+ ℹ You can now create applications without providing Git tokens:
582
+ saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
583
+ ```
584
+
585
+ ### `saac git list`
586
+
587
+ List all connected Git accounts.
588
+
589
+ ```bash
590
+ saac git list
591
+ saac git ls # Alias
592
+ ```
593
+
594
+ **Shows:**
595
+ - Git host
596
+ - Username
597
+ - Provider (gitea/github/gitlab)
598
+ - Connection date
599
+ - Expiration (if applicable)
600
+ - Last used timestamp
601
+
602
+ **Example output:**
603
+ ```
604
+ Connected Git Accounts
605
+ ──────────────────────
606
+
607
+ ┌─────────────────────────────┬────────────┬──────────┬──────────────┐
608
+ │ Host │ Username │ Provider │ Connected │
609
+ ├─────────────────────────────┼────────────┼──────────┼──────────────┤
610
+ │ git.startanaicompany.com │ ryan.gogo │ gitea │ Jan 26, 2026 │
611
+ └─────────────────────────────┴────────────┴──────────┴──────────────┘
612
+
613
+ Total: 1 connection(s)
614
+ ```
615
+
616
+ ### `saac git disconnect <host>`
617
+
618
+ Disconnect (revoke) a Git account connection.
619
+
620
+ ```bash
621
+ saac git disconnect git.startanaicompany.com
622
+ ```
623
+
624
+ **What happens:**
625
+ - OAuth token revoked on server
626
+ - Connection removed
627
+ - Existing applications continue to work
628
+ - New applications will require reconnection
629
+
630
+ ### `saac git repos <host>`
631
+
632
+ List repositories from a connected Git host.
633
+
634
+ ```bash
635
+ # Basic usage
636
+ saac git repos git.startanaicompany.com
637
+ saac git repos github.com
638
+
639
+ # Include latest commit information
640
+ saac git repos github.com --commits
641
+
642
+ # Filter by visibility
643
+ saac git repos github.com --visibility private
644
+ saac git repos github.com --visibility public
645
+
646
+ # With pagination
647
+ saac git repos github.com --page 2 --per-page 10
648
+
649
+ # Sort repositories
650
+ saac git repos github.com --sort created
651
+ saac git repos github.com --sort name
652
+
653
+ # JSON output for scripting
654
+ saac git repos github.com --json
655
+
656
+ # Combine options
657
+ saac git repos github.com --commits --visibility private --per-page 20
658
+ ```
659
+
660
+ **Options:**
661
+ - `-p, --page <number>` - Page number for pagination (default: 1)
662
+ - `-n, --per-page <number>` - Results per page, max 100 (default: 20)
663
+ - `-s, --sort <type>` - Sort order: `updated`, `created`, `name` (default: `updated`)
664
+ - `-v, --visibility <type>` - Filter: `all`, `public`, `private` (default: `all`)
665
+ - `-c, --commits` - Include latest commit info for each repository
666
+ - `--json` - Output as JSON for scripting
667
+
668
+ **Shows:**
669
+ - Repository name
670
+ - Visibility (public/private)
671
+ - Last updated timestamp
672
+ - Default branch
673
+ - Primary language
674
+ - Latest commit (with `--commits` flag)
675
+
676
+ **Example output (without commits):**
677
+ ```
678
+ Repositories on git.startanaicompany.com (ryan.gogo)
679
+ ────────────────────────────────────────────────────
680
+
681
+ NAME VISIBILITY UPDATED BRANCH LANGUAGE
682
+ mysimpleflowershop private 1/27/2026, 12:52:18 AM master JavaScript
683
+ api-server private 1/26/2026, 8:30:00 PM main TypeScript
684
+ landing-page public 1/25/2026, 3:15:00 PM master HTML
685
+
686
+ Showing 3 repositories (page 1)
687
+ ```
688
+
689
+ **Example output (with `--commits`):**
690
+ ```
691
+ Repositories on git.startanaicompany.com (ryan.gogo)
692
+ ────────────────────────────────────────────────────
693
+
694
+ NAME VISIBILITY LAST COMMIT
695
+ mysimpleflowershop private 4b2c63f Initial commit - Simple Flower (3d ago)
696
+ api-server private a90373d Add user authentication (1d ago)
697
+ landing-page public f1e2d3c Update homepage design (5h ago)
698
+
699
+ Showing 3 repositories (page 1)
700
+ ```
701
+
702
+ **JSON output:**
703
+ ```bash
704
+ $ saac git repos github.com --json
705
+
706
+ {
707
+ "success": true,
708
+ "git_host": "github.com",
709
+ "username": "johndoe",
710
+ "provider_type": "github",
711
+ "repositories": [
712
+ {
713
+ "name": "my-app",
714
+ "fullName": "johndoe/my-app",
715
+ "description": "A cool application",
716
+ "private": false,
717
+ "sshUrl": "git@github.com:johndoe/my-app.git",
718
+ "cloneUrl": "https://github.com/johndoe/my-app.git",
719
+ "htmlUrl": "https://github.com/johndoe/my-app",
720
+ "defaultBranch": "main",
721
+ "updatedAt": "2026-01-30T12:00:00Z",
722
+ "language": "JavaScript",
723
+ "latestCommit": {
724
+ "sha": "abc1234",
725
+ "message": "Fix authentication bug",
726
+ "author": "John Doe",
727
+ "date": "2026-01-30T11:30:00Z"
728
+ }
729
+ }
730
+ ],
731
+ "count": 1,
732
+ "page": 1,
733
+ "per_page": 100
734
+ }
735
+ ```
736
+
737
+ **Use Cases:**
738
+ - Browse available repositories before creating an application
739
+ - Find repository SSH URLs for `saac create` command
740
+ - Check latest commits without visiting Git provider
741
+ - Script repository discovery and automation
742
+ - Filter personal vs organization repositories
743
+
744
+ **Performance Notes:**
745
+ - Without `--commits`: Fast (single API call)
746
+ - With `--commits`: Slower (fetches commit info for each repo in parallel)
747
+ - Use `--commits` only when you need commit information
748
+
749
+ **Example Workflow:**
750
+ ```bash
751
+ # 1. Connect to Git host
752
+ saac git connect github.com
753
+
754
+ # 2. List your repositories
755
+ saac git repos github.com
756
+
757
+ # 3. Find the repository you want to deploy
758
+ saac git repos github.com --visibility private
759
+
760
+ # 4. Copy the SSH URL from the output
761
+ # 5. Create application with that repository
762
+ saac create my-app -s myapp -r git@github.com:username/my-app.git
763
+ ```
764
+
765
+ ---
766
+
767
+ ## Application Management
768
+
769
+ ### `saac init`
770
+
771
+ Link an existing SAAC application to the current directory.
772
+
773
+ ```bash
774
+ cd my-project
775
+ saac init
776
+ ```
777
+
778
+ **Use case:** When you:
779
+ - Clone a Git repository
780
+ - Have an existing project
781
+ - Want to manage an application from a different directory
782
+
783
+ **Smart Auto-Detection (NEW!):**
784
+
785
+ If you're in a Git repository, `saac init` automatically detects the remote URL and matches it to your applications:
786
+
787
+ ```bash
788
+ $ cd mysimpleflowershop
789
+ $ saac init
790
+
791
+ Initialize SAAC Project
792
+ ───────────────────────
793
+
794
+ ✓ Found 3 application(s)
795
+
796
+ ℹ Auto-detected Git repository: git@git.startanaicompany.com:ryan.gogo/mysimpleflowershop.git
797
+
798
+ Matched Application: mysimpleflowershop
799
+ Domain: mysimpleflowershop.startanaicompany.com
800
+ Status: running:healthy
801
+
802
+ ? Link this application to the current directory? (Y/n) Yes
803
+
804
+ ✓ Project initialized!
805
+
806
+ Application: mysimpleflowershop
807
+ UUID: abc123-def456...
808
+ Domain: mysimpleflowershop.startanaicompany.com
809
+ Status: running:healthy
810
+
811
+ You can now use:
812
+ saac deploy Deploy your application
813
+ saac logs --follow View deployment logs
814
+ saac status Check application status
815
+ saac update --port 8080 Update configuration
816
+ ```
817
+
818
+ **How Auto-Detection Works:**
819
+ 1. Reads Git remote URL from `.git/config`
820
+ 2. Normalizes both Git remote and application repositories
821
+ 3. Matches against your applications automatically
822
+ 4. Asks for confirmation (defaults to Yes)
823
+ 5. Falls back to manual selection if no match found or if you decline
824
+
825
+ **Supports:**
826
+ - SSH URLs: `git@github.com:user/repo.git`
827
+ - HTTPS URLs: `https://github.com/user/repo.git`
828
+ - With or without `.git` suffix
829
+ - Case-insensitive matching
830
+
831
+ **Manual Selection (fallback):**
832
+
833
+ If not in a Git repository or no match found, shows interactive list:
834
+
835
+ ```bash
836
+ $ saac init
837
+
838
+ ? Select application to link to this directory:
839
+ ❯ mysimpleflowershop - mysimpleflowershop.startanaicompany.com (running:healthy)
840
+ api-server - api.startanaicompany.com (running:healthy)
841
+ landing-page - landing.startanaicompany.com (stopped)
842
+ ```
843
+
844
+ **What it saves:**
845
+
846
+ Creates `.saac/config.json` in current directory:
847
+ ```json
848
+ {
849
+ "applicationUuid": "abc123-def456...",
850
+ "applicationName": "mysimpleflowershop",
851
+ "subdomain": "mysimpleflowershop",
852
+ "domainSuffix": "startanaicompany.com",
853
+ "gitRepository": "git@git.startanaicompany.com:ryan.gogo/mysimpleflowershop.git"
854
+ }
855
+ ```
856
+
857
+ ### `saac create <name>`
858
+
859
+ Create a new application with full configuration options.
860
+
861
+ ```bash
862
+ # Basic application (OAuth required!)
863
+ saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
864
+
865
+ # Advanced with health checks and migrations
866
+ saac create api \
867
+ -s api \
868
+ -r git@git.startanaicompany.com:user/api-server.git \
869
+ --build-pack nixpacks \
870
+ --port 8080 \
871
+ --pre-deploy-cmd "npm run migrate" \
872
+ --post-deploy-cmd "npm run seed" \
873
+ --health-check \
874
+ --health-path /api/health \
875
+ --health-interval 30 \
876
+ --health-timeout 10 \
877
+ --health-retries 3 \
878
+ --cpu-limit 2 \
879
+ --memory-limit 2G \
880
+ --env NODE_ENV=production \
881
+ --env LOG_LEVEL=debug \
882
+ --env DATABASE_URL=postgresql://...
883
+ ```
884
+
885
+ **Prerequisites:**
886
+ - ✅ You must be logged in: `saac login`
887
+ - ✅ You must connect Git account: `saac git connect`
888
+
889
+ **Required:**
890
+ - `<name>` - Application name (alphanumeric, hyphens allowed)
891
+ - `-s, --subdomain <subdomain>` - Subdomain (e.g., `myapp` → `myapp.startanaicompany.com`)
892
+ - `-r, --repository <url>` - Git repository URL in SSH format
893
+
894
+ **Basic Options:**
895
+ - `-b, --branch <branch>` - Git branch (default: `master`)
896
+ - `-d, --domain-suffix <suffix>` - Domain suffix (default: `startanaicompany.com`)
897
+ - `-p, --port <port>` - Port to expose (default: `3000`)
898
+
899
+ **Build Pack Options:**
900
+ - `--build-pack <pack>` - Build system to use:
901
+ - `nixpacks` (default) - Auto-detects language and builds
902
+ - `dockerfile` - Uses Dockerfile in repository
903
+ - `dockercompose` - Uses docker-compose.yml
904
+ - `static` - Static site hosting
905
+
906
+ **Custom Commands:**
907
+ - `--install-cmd <command>` - Install command (e.g., `pnpm install`)
908
+ - `--build-cmd <command>` - Build command (e.g., `npm run build`)
909
+ - `--start-cmd <command>` - Start command (e.g., `node dist/server.js`)
910
+ - `--pre-deploy-cmd <command>` - Pre-deployment hook (e.g., `npm run migrate`)
911
+ - `--post-deploy-cmd <command>` - Post-deployment hook (e.g., `npm run seed`)
912
+
913
+ **Resource Limits:**
914
+ - `--cpu-limit <limit>` - CPU limit (e.g., `1`, `2.5`)
915
+ - `--memory-limit <limit>` - Memory limit (e.g., `512M`, `1G`, `2G`)
916
+
917
+ **Note:** Free tier limited to 1 vCPU, 1024M RAM. Upgrades required for higher limits.
918
+
919
+ **Health Checks:**
920
+ - `--health-check` - Enable health checks
921
+ - `--health-path <path>` - Health check endpoint (default: `/health`)
922
+ - `--health-interval <seconds>` - Check interval (default: 30s)
923
+ - `--health-timeout <seconds>` - Check timeout (default: 10s)
924
+ - `--health-retries <count>` - Number of retries before marking unhealthy (1-10)
925
+
926
+ **Environment Variables:**
927
+ - `--env <KEY=VALUE>` - Set environment variable (can be used multiple times)
928
+ - Maximum 50 variables per application
929
+
930
+ **Example with all features:**
931
+ ```bash
932
+ saac create production-api \
933
+ -s api \
934
+ -r git@git.startanaicompany.com:company/api.git \
935
+ -b main \
936
+ --build-pack nixpacks \
937
+ --port 8080 \
938
+ --pre-deploy-cmd "npm run db:migrate" \
939
+ --start-cmd "node dist/index.js" \
940
+ --cpu-limit 2 \
941
+ --memory-limit 2G \
942
+ --health-check \
943
+ --health-path /api/health \
944
+ --health-interval 30 \
945
+ --health-timeout 10 \
946
+ --health-retries 3 \
947
+ --env NODE_ENV=production \
948
+ --env LOG_LEVEL=info \
949
+ --env DATABASE_URL=postgresql://user:pass@host/db \
950
+ --env REDIS_URL=redis://redis:6379
951
+ ```
952
+
953
+ **What happens:**
954
+ 1. Validates all inputs
955
+ 2. Checks Git OAuth connection
956
+ 3. Creates application on Coolify via wrapper API
957
+ 4. Saves configuration to `.saac/config.json`
958
+ 5. Shows next steps (deploy, logs, status)
959
+
960
+ ### `saac update`
961
+
962
+ Update application configuration after creation.
963
+
964
+ ```bash
965
+ # Update port and enable health checks
966
+ saac update --port 8080 --health-check --health-path /api/health
967
+
968
+ # Switch to Nixpacks and update resource limits
969
+ saac update --build-pack nixpacks --cpu-limit 2 --memory-limit 2G
970
+
971
+ # Update custom commands
972
+ saac update --pre-deploy-cmd "npm run migrate" --start-cmd "npm start"
973
+
974
+ # Disable health checks
975
+ saac update --no-health-check
976
+
977
+ # Update environment variables
978
+ saac update --env NODE_ENV=production --env DEBUG=true
979
+
980
+ # Change restart policy
981
+ saac update --restart on-failure
982
+ ```
983
+
984
+ **Options:** All options from `create` command can be updated individually.
985
+
986
+ **Important:** Configuration changes require redeployment to take effect:
987
+ ```bash
988
+ saac deploy
989
+ ```
990
+
991
+ **Supported Updates:**
992
+ - Basic: name, branch, port
993
+ - Build pack and custom commands
994
+ - Resource limits (subject to tier limits)
995
+ - Health checks (enable/disable and all parameters)
996
+ - Restart policy: `always`, `on-failure`, `unless-stopped`, `no`
997
+ - Environment variables
998
+
999
+ **Note:** Only the fields you specify will be updated (partial updates).
1000
+
1001
+ ### `saac deploy [-f]`
1002
+
1003
+ Trigger deployment of your application.
1004
+
1005
+ ```bash
1006
+ # Normal deployment
1007
+ saac deploy
1008
+
1009
+ # Force deployment (rebuild from scratch)
1010
+ saac deploy --force
1011
+ saac deploy -f
1012
+ ```
1013
+
1014
+ **What happens:**
1015
+ 1. Validates authentication and project config
1016
+ 2. Triggers deployment on Coolify via wrapper API
1017
+ 3. Shows deployment ID and status
1018
+ 4. Provides command to follow logs
1019
+
1020
+ **Options:**
1021
+ - `-f, --force` - Force rebuild (ignore cache)
1022
+
1023
+ **Example output:**
1024
+ ```
1025
+ Deploying Application
1026
+ ─────────────────────
1027
+
1028
+ ℹ Application: mysimpleflowershop
1029
+ ℹ Repository: git@git.startanaicompany.com:user/repo.git
1030
+ ℹ Branch: master
1031
+
1032
+ ⏳ Triggering deployment...
1033
+
1034
+ ✓ Deployment triggered successfully!
1035
+
1036
+ Status: queued
1037
+ Deployment ID: dp_abc123def456
1038
+ Domain: mysimpleflowershop.startanaicompany.com
1039
+
1040
+ ℹ Follow deployment logs:
1041
+ saac logs --deployment
1042
+ ```
1043
+
1044
+ ### `saac deployments`
1045
+
1046
+ View deployment history for your application.
1047
+
1048
+ ```bash
1049
+ # List recent deployments (default: 20)
1050
+ saac deployments
1051
+ saac deploys # Alias
1052
+
1053
+ # Show more deployments
1054
+ saac deployments --limit 50
1055
+
1056
+ # Pagination
1057
+ saac deployments --limit 20 --offset 20
1058
+ ```
1059
+
1060
+ **Options:**
1061
+ - `-l, --limit <number>` - Number of deployments to show (default: 20)
1062
+ - `-o, --offset <number>` - Offset for pagination (default: 0)
1063
+
1064
+ **Shows:**
1065
+ - Deployment ID
1066
+ - Status (finished, failed, running, queued)
1067
+ - Started/finished timestamps
1068
+ - Duration
1069
+ - Commit hash and message
1070
+ - Branch
1071
+
1072
+ **Example output:**
1073
+ ```
1074
+ Deployment History: mysimpleflowershop
1075
+ ─────────────────────────────────────
1076
+
1077
+ ┌──────────────────┬──────────┬─────────────┬──────────┬──────────────┐
1078
+ │ ID │ Status │ Started │ Duration │ Commit │
1079
+ ├──────────────────┼──────────┼─────────────┼──────────┼──────────────┤
1080
+ │ dp_abc123... │ finished │ 10:30 AM │ 45s │ a1b2c3d Fix │
1081
+ │ dp_def456... │ failed │ 9:15 AM │ 12s │ e4f5g6h Add │
1082
+ │ dp_ghi789... │ finished │ Yesterday │ 52s │ i7j8k9l Upd │
1083
+ └──────────────────┴──────────┴─────────────┴──────────┴──────────────┘
1084
+
1085
+ Total: 3 deployments
1086
+ ```
1087
+
1088
+ ### `saac list`
1089
+
1090
+ List all your applications.
1091
+
1092
+ ```bash
1093
+ saac list
1094
+ saac ls # Alias
1095
+ ```
1096
+
1097
+ **Shows:**
1098
+ - Application name
1099
+ - Domain
1100
+ - Status (running, stopped, error, etc.)
1101
+ - Git branch
1102
+ - Creation date
1103
+
1104
+ **Example output:**
1105
+ ```
1106
+ Your Applications (3)
1107
+ ─────────────────────
1108
+
1109
+ ┌──────────────────────┬──────────────────────────────────┬─────────────┬────────┬──────────────┐
1110
+ │ Name │ Domain │ Status │ Branch │ Created │
1111
+ ├──────────────────────┼──────────────────────────────────┼─────────────┼────────┼──────────────┤
1112
+ │ mysimpleflowershop │ shop.startanaicompany.com │ Running ✓ │ master │ Jan 26, 2026 │
1113
+ │ api-server │ api.startanaicompany.com │ Running ✓ │ main │ Jan 20, 2026 │
1114
+ │ landing-page │ landing.startanaicompany.com │ Stopped │ master │ Jan 15, 2026 │
1115
+ └──────────────────────┴──────────────────────────────────┴─────────────┴────────┴──────────────┘
1116
+
1117
+ Total: 3 applications
1118
+ ```
1119
+
1120
+ ### `saac status`
1121
+
1122
+ Show current application status and configuration.
1123
+
1124
+ ```bash
1125
+ saac status
1126
+ ```
1127
+
1128
+ **Shows:**
1129
+ - Application details (name, UUID, domain)
1130
+ - Git repository and branch
1131
+ - Current status (running/stopped/error)
1132
+ - Resource usage (CPU, memory)
1133
+ - Health check status
1134
+ - Environment variables count
1135
+ - Recent deployments
1136
+
1137
+ **Example output:**
1138
+ ```
1139
+ Application Status
1140
+ ──────────────────
1141
+
1142
+ Name: mysimpleflowershop
1143
+ UUID: abc123def456
1144
+ Domain: shop.startanaicompany.com
1145
+ Status: Running ✓
1146
+ Branch: master
1147
+ Repository: git@git.startanaicompany.com:user/repo.git
1148
+
1149
+ Resources
1150
+ ─────────
1151
+ CPU: 0.5 / 1.0 vCPU
1152
+ Memory: 256M / 1024M
1153
+ Health: Healthy ✓
1154
+
1155
+ Configuration
1156
+ ─────────────
1157
+ Build Pack: nixpacks
1158
+ Port: 3000
1159
+ Env Variables: 5 / 50
1160
+
1161
+ Recent Deployments
1162
+ ──────────────────
1163
+ Last Deploy: Jan 29, 2026, 10:30 AM (finished)
1164
+ Duration: 45 seconds
1165
+ Commit: a1b2c3d Fix bug in auth
1166
+ ```
1167
+
1168
+ ### `saac delete`
1169
+
1170
+ Delete current application.
1171
+
1172
+ ```bash
1173
+ # With confirmation prompt
1174
+ saac delete
1175
+
1176
+ # Skip confirmation
1177
+ saac delete --yes
1178
+ saac delete -y
1179
+
1180
+ # Alias
1181
+ saac rm
1182
+ ```
1183
+
1184
+ **⚠️ Warning:** This action is **irreversible**! All data will be deleted.
1185
+
1186
+ **What gets deleted:**
1187
+ - Application container
1188
+ - Environment variables
1189
+ - Deployment history
1190
+ - Logs
1191
+ - Domain configuration
1192
+
1193
+ **What stays:**
1194
+ - Git repository (not affected)
1195
+ - Local `.saac/config.json` (you can delete manually)
1196
+
1197
+ ### `saac manual`
1198
+
1199
+ Display full documentation from GitHub README.
1200
+
1201
+ ```bash
1202
+ saac manual
1203
+ ```
1204
+
1205
+ Fetches and displays the latest README.md from the GitHub repository.
1206
+
1207
+ ---
1208
+
1209
+ ## Environment Variables
1210
+
1211
+ Manage environment variables for your application. Changes require redeployment to take effect.
1212
+
1213
+ ### `saac env set <vars...>`
1214
+
1215
+ Set or update environment variables.
1216
+
1217
+ ```bash
1218
+ # Set single variable
1219
+ saac env set NODE_ENV=production
1220
+
1221
+ # Set multiple variables
1222
+ saac env set NODE_ENV=production LOG_LEVEL=debug API_URL=https://api.example.com
1223
+
1224
+ # Set variable with special characters
1225
+ saac env set DATABASE_URL="postgresql://user:p@ss!word@host:5432/db"
1226
+
1227
+ # Set variable with spaces (must quote the entire KEY=VALUE)
1228
+ saac env set "WELCOME_MESSAGE=Hello World"
1229
+ ```
1230
+
1231
+ **Rules:**
1232
+ - **Key format:** `^[A-Z_][A-Z0-9_]*$` (uppercase, alphanumeric, underscores)
1233
+ - **Valid keys:** `NODE_ENV`, `DATABASE_URL`, `API_KEY`, `LOG_LEVEL`
1234
+ - **Invalid keys:** `node-env` (hyphen), `2KEY` (starts with number), `key!` (special char)
1235
+ - **Value length:** 0-10,000 characters
1236
+ - **Maximum variables:** 50 per application
1237
+
1238
+ **Example output:**
1239
+ ```
1240
+ Updating Environment Variables
1241
+ ──────────────────────────────
1242
+
1243
+ ℹ Variables to set:
1244
+ NODE_ENV: production
1245
+ DATABASE_URL: postgresql://use***@32/db
1246
+ API_KEY: sk_t***123
1247
+
1248
+ ⏳ Updating environment variables...
1249
+
1250
+ ✔ Environment variables updated successfully!
1251
+
1252
+ ✓ Set 3 variable(s)
1253
+
1254
+ ⚠ Changes require redeployment to take effect
1255
+ ℹ Run:
1256
+ saac deploy
1257
+ ```
1258
+
1259
+ **Important:** Environment variable values with sensitive patterns are automatically masked in output:
1260
+ - `PASSWORD`, `SECRET`, `KEY`, `TOKEN`
1261
+ - `DATABASE_URL`, `DB_URL`, `PRIVATE`, `AUTH`
1262
+
1263
+ ### `saac env get [key]`
1264
+
1265
+ Get environment variable(s).
1266
+
1267
+ ```bash
1268
+ # Get all variables
1269
+ saac env get
1270
+
1271
+ # Get specific variable
1272
+ saac env get NODE_ENV
1273
+ ```
1274
+
1275
+ **Example output (all variables):**
1276
+ ```
1277
+ Environment Variables: mysimpleflowershop
1278
+
1279
+ ┌───────────────────┬─────────────────────────────────────┐
1280
+ │ Key │ Value │
1281
+ ├───────────────────┼─────────────────────────────────────┤
1282
+ │ NODE_ENV │ production │
1283
+ │ LOG_LEVEL │ debug │
1284
+ │ DATABASE_URL │ post***@32/db │
1285
+ │ API_KEY │ sk_t***123 │
1286
+ │ PORT │ 3000 │
1287
+ └───────────────────┴─────────────────────────────────────┘
1288
+
1289
+ Total: 5 / 50 variables
1290
+ ```
1291
+
1292
+ **Example output (specific variable):**
1293
+ ```
1294
+ Environment Variable: NODE_ENV
1295
+
1296
+ Key: NODE_ENV
1297
+ Value: production
1298
+ ```
1299
+
1300
+ ### `saac env list`
1301
+
1302
+ List all environment variables (alias for `saac env get`).
1303
+
1304
+ ```bash
1305
+ saac env list
1306
+ saac env ls # Alias
1307
+ ```
1308
+
1309
+ **Note:** This is exactly the same as `saac env get` with no arguments.
1310
+
1311
+ ### Environment Variables Workflow
1312
+
1313
+ ```bash
1314
+ # 1. Set your environment variables
1315
+ saac env set NODE_ENV=production \
1316
+ DATABASE_URL=postgresql://user:pass@host:5432/db \
1317
+ API_KEY=sk_test_123 \
1318
+ LOG_LEVEL=info
1319
+
1320
+ # 2. Verify what you set
1321
+ saac env list
1322
+
1323
+ # 3. Deploy to apply changes
1324
+ saac deploy
1325
+
1326
+ # 4. Check if application started correctly
1327
+ saac logs
1328
+
1329
+ # 5. Verify specific variable (if needed)
1330
+ saac env get DATABASE_URL
1331
+ ```
1332
+
1333
+ **Common Variables:**
1334
+ ```bash
1335
+ # Node.js applications
1336
+ saac env set NODE_ENV=production \
1337
+ PORT=3000 \
1338
+ LOG_LEVEL=info
1339
+
1340
+ # Database connections
1341
+ saac env set DATABASE_URL=postgresql://user:pass@db.internal:5432/myapp \
1342
+ REDIS_URL=redis://redis:6379
1343
+
1344
+ # API keys and secrets
1345
+ saac env set API_KEY=sk_live_... \
1346
+ JWT_SECRET=your-secret-key \
1347
+ STRIPE_SECRET_KEY=sk_live_...
1348
+
1349
+ # Application-specific
1350
+ saac env set COMPANY_NAME="Acme Corp" \
1351
+ PRIMARY_COLOR="#2563EB" \
1352
+ CONTACT_EMAIL=contact@acme.com
1353
+ ```
1354
+
1355
+ ---
1356
+
1357
+ ## Remote Access
1358
+
1359
+ Access and execute commands inside your deployed container.
1360
+
1361
+ ### Remote Shell
1362
+
1363
+ **Project Aurora** - TRUE remote shell access via WebSocket.
1364
+
1365
+ #### `saac shell`
1366
+
1367
+ Open an interactive remote shell session inside your container.
1368
+
1369
+ ```bash
1370
+ saac shell
1371
+ ```
1372
+
1373
+ **What happens:**
1374
+ 1. Connects to container via WebSocket
1375
+ 2. Creates or attaches to tmux session
1376
+ 3. Gives you a bash prompt inside the container
1377
+ 4. Session persists even if you disconnect
1378
+
1379
+ **Features:**
1380
+ - ✅ Real bash prompt from container
1381
+ - ✅ Working directory changes persist
1382
+ - ✅ Access to all remote files and tools
1383
+ - ✅ All environment variables available
1384
+ - ✅ Interactive tools work (vim, nano, htop, etc.)
1385
+ - ✅ Session persistence (up to 1 hour idle)
1386
+ - ✅ Auto-reconnection on network interruption
1387
+
1388
+ **Example session:**
1389
+ ```bash
1390
+ $ saac shell
1391
+
1392
+ ═══════════════════════════════════════════════════════════════
1393
+ Remote Shell: mysimpleflowershop
1394
+ ═══════════════════════════════════════════════════════════════
1395
+
1396
+ ℹ Connecting to container...
1397
+ ℹ This may take up to 30 seconds for container creation.
1398
+
1399
+ ✓ Connected to remote container
1400
+ ✓ Container is ready!
1401
+ ℹ Type commands below. Press Ctrl+D or type "exit" to quit.
1402
+
1403
+ root@container-abc123:/app# ls -la
1404
+ total 128
1405
+ drwxr-xr-x 8 root root 4096 Jan 29 09:00 .
1406
+ drwxr-xr-x 18 root root 4096 Jan 29 09:00 ..
1407
+ -rw-r--r-- 1 root root 1245 Jan 29 09:00 package.json
1408
+ drwxr-xr-x 2 root root 4096 Jan 29 09:00 node_modules
1409
+ -rw-r--r-- 1 root root 543 Jan 29 09:00 server.js
1410
+
1411
+ root@container-abc123:/app# npm run test
1412
+ > mysimpleflowershop@1.0.0 test
1413
+ > jest
1414
+
1415
+ PASS tests/auth.test.js
1416
+ PASS tests/api.test.js
1417
+
1418
+ Test Suites: 2 passed, 2 total
1419
+ Tests: 15 passed, 15 total
1420
+
1421
+ root@container-abc123:/app# echo $NODE_ENV
1422
+ production
1423
+
1424
+ root@container-abc123:/app# exit
1425
+
1426
+ ℹ Disconnecting from remote shell...
1427
+ ```
1428
+
1429
+ **Exit shell:**
1430
+ - Type `exit` or `quit`
1431
+ - Press `Ctrl+D`
1432
+
1433
+ **Session Persistence:**
1434
+ If you close your terminal and reconnect within 1 hour, you'll resume the same session:
1435
+
1436
+ ```bash
1437
+ # Terminal 1 (close after cd command)
1438
+ $ saac shell
1439
+ root@container:/app# cd src
1440
+ root@container:/app/src# [close terminal]
1441
+
1442
+ # Terminal 2 (5 minutes later, same machine)
1443
+ $ saac shell
1444
+ root@container:/app/src# pwd
1445
+ /app/src ← Same session, same directory!
1446
+ ```
1447
+
1448
+ **Use Cases:**
1449
+ - Debug production issues
1450
+ - Run database migrations manually
1451
+ - Check file contents
1452
+ - Install packages temporarily
1453
+ - Monitor processes
1454
+ - Test commands before adding to build scripts
1455
+
1456
+ ### Remote Execution
1457
+
1458
+ Run one-off commands inside your container without opening an interactive shell.
1459
+
1460
+ #### `saac exec <command>`
1461
+
1462
+ Execute a single command in the remote container.
1463
+
1464
+ ```bash
1465
+ # Run command
1466
+ saac exec "npm run db:migrate"
1467
+
1468
+ # Check Node.js version
1469
+ saac exec "node --version"
1470
+
1471
+ # View environment variables
1472
+ saac exec "printenv | grep NODE"
1473
+
1474
+ # Check running processes
1475
+ saac exec "ps aux"
1476
+
1477
+ # Custom working directory
1478
+ saac exec "npm test" --workdir /app/src
1479
+
1480
+ # Set timeout
1481
+ saac exec "npm run build" --timeout 300
1482
+ ```
1483
+
1484
+ **Options:**
1485
+ - `--workdir <path>` - Working directory (default: `/app`)
1486
+ - `--timeout <seconds>` - Timeout in seconds (default: 30, max: 300)
1487
+
1488
+ **Example output:**
1489
+ ```bash
1490
+ $ saac exec "npm run db:migrate"
1491
+
1492
+ Executing Command: npm run db:migrate
1493
+ ─────────────────────────────────────
1494
+
1495
+ ⏳ Executing remotely...
1496
+
1497
+ Output:
1498
+ ───────
1499
+ > mysimpleflowershop@1.0.0 db:migrate
1500
+ > knex migrate:latest
1501
+
1502
+ Batch 1 run: 3 migrations
1503
+ ✓ create_users_table
1504
+ ✓ create_posts_table
1505
+ ✓ create_comments_table
1506
+
1507
+ ✓ Command executed successfully
1508
+
1509
+ Exit Code: 0
1510
+ Duration: 2.5s
1511
+ Workdir: /app
1512
+ ```
1513
+
1514
+ #### `saac exec --history`
1515
+
1516
+ View execution history.
1517
+
1518
+ ```bash
1519
+ # View recent executions
1520
+ saac exec --history
1521
+
1522
+ # Show more history
1523
+ saac exec --history --limit 50
1524
+
1525
+ # Pagination
1526
+ saac exec --history --limit 20 --offset 20
1527
+ ```
1528
+
1529
+ **Options:**
1530
+ - `--limit <number>` - Limit for history (default: 20, max: 100)
1531
+ - `--offset <number>` - Offset for pagination (default: 0)
1532
+
1533
+ **Shows:**
1534
+ - Command executed
1535
+ - Exit code (success/failure)
1536
+ - Duration
1537
+ - Timestamp
1538
+ - Working directory
1539
+
1540
+ ### Local Development
1541
+
1542
+ Run local commands with remote environment variables.
1543
+
1544
+ #### `saac run <command>`
1545
+
1546
+ Execute a command locally with environment variables from your remote application.
1547
+
1548
+ ```bash
1549
+ # Run local dev server with remote env vars
1550
+ saac run npm run dev
1551
+
1552
+ # Run tests with remote database
1553
+ saac run npm test
1554
+
1555
+ # Run migrations locally
1556
+ saac run npm run migrate
1557
+
1558
+ # Force refresh env vars (skip cache)
1559
+ saac run npm start --sync
1560
+
1561
+ # Quiet mode (suppress warnings)
1562
+ saac run "node script.js" --quiet
1563
+ ```
1564
+
1565
+ **What happens:**
1566
+ 1. Fetches environment variables from remote application
1567
+ 2. Caches them locally for 1 hour
1568
+ 3. Spawns your command with those env vars
1569
+ 4. Command runs on your local machine (not in container)
1570
+
1571
+ **Options:**
1572
+ - `--sync` - Force refresh environment variables (skip cache)
1573
+ - `-q, --quiet` - Quiet mode (suppress warnings)
1574
+
1575
+ **Use Cases:**
1576
+ - Local development with production database
1577
+ - Running migrations before deployment
1578
+ - Testing with production API keys
1579
+ - Debugging with real environment
1580
+
1581
+ **Example:**
1582
+ ```bash
1583
+ $ saac run "node -e 'console.log(process.env.DATABASE_URL)'"
1584
+
1585
+ 🚀 Running command with remote environment variables
1586
+
1587
+ Application: mysimpleflowershop
1588
+ Variables: 5 loaded
1589
+ Cache: Fresh (expires in 58m)
1590
+
1591
+ ──────────────────────────────────────────────────────────────
1592
+
1593
+ postgresql://user:pass@db.internal:5432/myapp
1594
+
1595
+ ✓ Command completed successfully
1596
+ ```
1597
+
1598
+ **⚠️ Security Warning:** Remote secrets are exposed on your local machine. Only use this on trusted machines.
1599
+
1600
+ ---
1601
+
1602
+ ## Logs & Monitoring
1603
+
1604
+ View runtime logs and deployment logs for your application.
1605
+
1606
+ ### `saac logs`
1607
+
1608
+ View runtime logs (container stdout/stderr).
1609
+
1610
+ ```bash
1611
+ # View recent logs
1612
+ saac logs
1613
+
1614
+ # Show more lines
1615
+ saac logs --tail 200
1616
+
1617
+ # Follow logs in real-time (not yet implemented)
1618
+ saac logs --follow
1619
+
1620
+ # Show logs since timestamp
1621
+ saac logs --since "2026-01-29T10:00:00Z"
1622
+ ```
1623
+
1624
+ **Options:**
1625
+ - `-t, --tail <lines>` - Number of lines to show (default: 100)
1626
+ - `-f, --follow` - Follow log output (live streaming - not yet implemented)
1627
+ - `--since <time>` - Show logs since timestamp
1628
+
1629
+ **Example output:**
1630
+ ```
1631
+ Runtime Logs: mysimpleflowershop
1632
+ ───────────────────────────────
1633
+
1634
+ > mysimpleflowershop@1.0.0 start
1635
+ > node server.js
1636
+
1637
+ Server running on port 3000
1638
+ [2026-01-29T10:30:00.000Z] INFO: Database connected
1639
+ [2026-01-29T10:30:01.123Z] INFO: Application started successfully
1640
+ [2026-01-29T10:30:15.456Z] INFO: GET /api/users 200 25ms
1641
+ [2026-01-29T10:30:16.789Z] INFO: GET /api/posts 200 15ms
1642
+ [2026-01-29T10:31:00.000Z] WARN: Slow query detected (1.2s)
1643
+ ```
1644
+
1645
+ ### `saac logs --deployment [uuid]`
1646
+
1647
+ View deployment logs (build logs).
1648
+
1649
+ ```bash
1650
+ # View latest deployment logs
1651
+ saac logs --deployment
1652
+
1653
+ # View specific deployment logs
1654
+ saac logs --deployment dp_abc123def456
1655
+
1656
+ # Raw log format (no coloring)
1657
+ saac logs --deployment --raw
1658
+
1659
+ # Include hidden lines (debug output)
1660
+ saac logs --deployment --include-hidden
1661
+
1662
+ # Short form
1663
+ saac logs -d
1664
+ saac logs -d dp_abc123def456
1665
+ ```
1666
+
1667
+ **Options:**
1668
+ - `-d, --deployment [uuid]` - View deployment logs (if UUID omitted, shows latest)
1669
+ - `--raw` - Show raw log output (deployment logs only)
1670
+ - `--include-hidden` - Include hidden log lines (deployment logs only)
1671
+
1672
+ **Example output:**
1673
+ ```
1674
+ Deployment Logs: mysimpleflowershop
1675
+ ───────────────────────────────────
1676
+
1677
+ Deployment UUID: dp_abc123def456
1678
+ Application: mysimpleflowershop
1679
+ Status: finished
1680
+ Commit: a1b2c3d
1681
+ Message: Fix authentication bug
1682
+ Started: Jan 29, 2026, 10:30:00 AM
1683
+ Finished: Jan 29, 2026, 10:30:45 AM
1684
+ Duration: 45s
1685
+
1686
+ Log Output (234 lines):
1687
+ ────────────────────────────────────────────────────────────
1688
+
1689
+ [00:00:01] Cloning repository...
1690
+ [00:00:03] Checking out branch: master
1691
+ [00:00:05] Detecting language: Node.js
1692
+ [00:00:06] Installing dependencies...
1693
+ [00:00:15] Running npm install...
1694
+ [00:00:25] Building application...
1695
+ [00:00:30] Running npm run build...
1696
+ [00:00:40] Build completed successfully
1697
+ [00:00:42] Creating container image...
1698
+ [00:00:44] Pushing image to registry...
1699
+ [00:00:45] ✓ Deployment completed
1700
+ ```
1701
+
1702
+ ### Log Monitoring Workflow
1703
+
1704
+ ```bash
1705
+ # 1. Deploy application
1706
+ saac deploy
1707
+
1708
+ # 2. Watch deployment progress
1709
+ saac logs --deployment
1710
+
1711
+ # 3. If deployment succeeds, check runtime logs
1712
+ saac logs --tail 100
1713
+
1714
+ # 4. Monitor for errors
1715
+ saac logs | grep ERROR
1716
+
1717
+ # 5. Follow logs (when implemented)
1718
+ saac logs --follow
1719
+ ```
1720
+
1721
+ ---
1722
+
1723
+ ## Domain Management
1724
+
1725
+ Manage your application's domain and subdomain.
1726
+
1727
+ ### `saac domain show`
1728
+
1729
+ Show current domain configuration.
1730
+
1731
+ ```bash
1732
+ saac domain show
1733
+ ```
1734
+
1735
+ **Shows:**
1736
+ - Current domain
1737
+ - Subdomain
1738
+ - Domain suffix
1739
+ - SSL status (if applicable)
1740
+
1741
+ **Example output:**
1742
+ ```
1743
+ Domain Configuration
1744
+ ────────────────────
1745
+
1746
+ Domain: mysimpleflowershop.startanaicompany.com
1747
+ Subdomain: mysimpleflowershop
1748
+ Suffix: startanaicompany.com
1749
+ SSL: Enabled ✓
1750
+ ```
1751
+
1752
+ ### `saac domain set <subdomain>`
1753
+
1754
+ Change your application's subdomain.
1755
+
1756
+ ```bash
1757
+ # Change subdomain
1758
+ saac domain set newsubdomain
1759
+
1760
+ # With custom domain suffix
1761
+ saac domain set myapp --domain-suffix customdomain.com
1762
+ saac domain set myapp -d customdomain.com
43
1763
  ```
44
1764
 
45
- ## Commands
1765
+ **Options:**
1766
+ - `-d, --domain-suffix <suffix>` - Domain suffix (default: startanaicompany.com)
46
1767
 
47
- ## Git Authentication
1768
+ **What happens:**
1769
+ 1. Updates domain configuration
1770
+ 2. Reconfigures routing
1771
+ 3. Issues new SSL certificate (if applicable)
1772
+ 4. Old domain redirects to new domain
48
1773
 
49
- SAAC CLI uses **OAuth-only authentication** for Git access. You must connect your Git account before creating applications.
1774
+ **Important:** You may need to redeploy for changes to take full effect:
1775
+ ```bash
1776
+ saac deploy
1777
+ ```
1778
+
1779
+ ---
50
1780
 
51
- ### Connect Your Git Account
1781
+ ## Complete Workflows
52
1782
 
53
- Connect your Git account once, deploy unlimited applications:
1783
+ ### First-Time Setup (From Scratch)
54
1784
 
55
1785
  ```bash
56
- # Connect Git account (interactive)
57
- saac git connect
1786
+ # 1. Register account
1787
+ saac register -e developer@company.com
58
1788
 
59
- # Or specify host directly
1789
+ # 2. Check email for verification code
1790
+ # Visit: https://mailhog.goryan.io
1791
+
1792
+ # 3. Verify email (save API key shown after verification!)
1793
+ saac verify 123456
1794
+
1795
+ # 4. Login with API key
1796
+ saac login -e developer@company.com -k cw_abc123...
1797
+
1798
+ # 5. Connect Git account (required for creating apps)
60
1799
  saac git connect git.startanaicompany.com
61
1800
 
62
- # List connected accounts
63
- saac git list
1801
+ # 6. Clone or create your project
1802
+ git clone git@git.startanaicompany.com:company/myapp.git
1803
+ cd myapp
64
1804
 
65
- # Disconnect account
66
- saac git disconnect git.startanaicompany.com
1805
+ # 7. Create SAAC application
1806
+ saac create myapp \
1807
+ -s myapp \
1808
+ -r git@git.startanaicompany.com:company/myapp.git \
1809
+ -b main \
1810
+ --env NODE_ENV=production
1811
+
1812
+ # 8. Deploy
1813
+ saac deploy
1814
+
1815
+ # 9. View logs
1816
+ saac logs --deployment
1817
+
1818
+ # 10. Check application
1819
+ saac status
1820
+
1821
+ # 11. Access shell if needed
1822
+ saac shell
67
1823
  ```
68
1824
 
69
- **Benefits:**
70
- - ✅ Connect once, deploy unlimited apps
71
- - ✅ No need to remember or copy tokens
72
- - ✅ Tokens stored encrypted on server
73
- - ✅ Supports Gitea, GitHub, and GitLab
74
- - 🔒 More secure than manual tokens
1825
+ ### Existing Application (Link to Directory)
75
1826
 
76
- **Creating apps with OAuth:**
77
1827
  ```bash
78
- # OAuth connection required!
79
- saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
1828
+ # 1. Login (if not already logged in)
1829
+ saac login -e developer@company.com -k cw_abc123...
1830
+
1831
+ # 2. Clone the repository
1832
+ git clone git@git.startanaicompany.com:company/existing-app.git
1833
+ cd existing-app
1834
+
1835
+ # 3. Link to existing SAAC application
1836
+ saac init
1837
+ # Select "existing-app" from the list
80
1838
 
81
- # CLI automatically uses your connected account
82
- # ✅ Using connected account: username@git.startanaicompany.com
1839
+ # 4. Now you can manage it
1840
+ saac deploy
1841
+ saac logs
1842
+ saac status
83
1843
  ```
84
1844
 
85
- **⚠️ Important:** You must connect your Git account with `saac git connect` before creating applications. Manual tokens are no longer supported.
1845
+ ### Environment Variables Management
86
1846
 
87
- ---
1847
+ ```bash
1848
+ # 1. View current environment variables
1849
+ saac env list
88
1850
 
89
- ### Authentication
1851
+ # 2. Set new variables
1852
+ saac env set NODE_ENV=production \
1853
+ DATABASE_URL=postgresql://user:pass@host:5432/db \
1854
+ API_KEY=sk_live_123 \
1855
+ LOG_LEVEL=info
90
1856
 
91
- #### `saac register`
92
- Register for a new account
1857
+ # 3. Verify they were set
1858
+ saac env list
93
1859
 
94
- ```bash
95
- saac register --email user@example.com
96
- saac register -e user@example.com --gitea-username myuser
97
- ```
1860
+ # 4. Deploy to apply changes
1861
+ saac deploy
98
1862
 
99
- **Required:**
100
- - `-e, --email <email>` - Your email address
1863
+ # 5. Check if application started correctly
1864
+ saac logs
101
1865
 
102
- **Optional:**
103
- - `--gitea-username <username>` - Your Gitea username (auto-detected if not provided)
1866
+ # 6. Test specific variable (if needed)
1867
+ saac env get DATABASE_URL
1868
+ ```
104
1869
 
105
- #### `saac login`
106
- Login with existing credentials
1870
+ ### Debugging Production Issues
107
1871
 
108
1872
  ```bash
109
- saac login --email user@example.com --api-key cw_...
110
- saac login -e user@example.com -k cw_...
1873
+ # 1. Check application status
1874
+ saac status
1875
+
1876
+ # 2. View runtime logs
1877
+ saac logs --tail 200
1878
+
1879
+ # 3. Look for errors
1880
+ saac logs | grep ERROR
1881
+
1882
+ # 4. Access container shell
1883
+ saac shell
1884
+
1885
+ # Inside container:
1886
+ root@container:/app# ps aux
1887
+ root@container:/app# df -h
1888
+ root@container:/app# cat /app/logs/error.log
1889
+ root@container:/app# npm run db:status
1890
+ root@container:/app# exit
1891
+
1892
+ # 5. Run one-off diagnostic command
1893
+ saac exec "node scripts/health-check.js"
1894
+
1895
+ # 6. Check environment variables
1896
+ saac env list
1897
+
1898
+ # 7. View recent deployments
1899
+ saac deployments
1900
+
1901
+ # 8. Check specific deployment logs
1902
+ saac logs --deployment dp_abc123
111
1903
  ```
112
1904
 
113
- **Required:**
114
- - `-e, --email <email>` - Your email address
115
- - `-k, --api-key <key>` - Your API key
1905
+ ### Local Development with Remote Env
116
1906
 
117
- #### `saac verify <code>`
118
- Verify your email address
1907
+ ```bash
1908
+ # 1. Ensure you're in project directory
1909
+ cd ~/myapp
1910
+
1911
+ # 2. Link to SAAC application (if not already)
1912
+ saac init
1913
+
1914
+ # 3. Run local development server with remote env vars
1915
+ saac run npm run dev
1916
+
1917
+ # 4. Run tests with remote database
1918
+ saac run npm test
1919
+
1920
+ # 5. Run migrations locally (against remote database)
1921
+ saac run npm run migrate
1922
+
1923
+ # 6. Run custom scripts
1924
+ saac run "node scripts/seed-data.js"
1925
+ ```
1926
+
1927
+ ### Multi-Environment Setup
119
1928
 
120
1929
  ```bash
121
- saac verify 123456
1930
+ # Development environment
1931
+ saac create myapp-dev \
1932
+ -s myapp-dev \
1933
+ -r git@git.startanaicompany.com:company/myapp.git \
1934
+ -b develop \
1935
+ --env NODE_ENV=development \
1936
+ --env LOG_LEVEL=debug
1937
+
1938
+ # Staging environment
1939
+ saac create myapp-staging \
1940
+ -s myapp-staging \
1941
+ -r git@git.startanaicompany.com:company/myapp.git \
1942
+ -b staging \
1943
+ --env NODE_ENV=staging \
1944
+ --env LOG_LEVEL=info
1945
+
1946
+ # Production environment
1947
+ saac create myapp-prod \
1948
+ -s myapp \
1949
+ -r git@git.startanaicompany.com:company/myapp.git \
1950
+ -b main \
1951
+ --env NODE_ENV=production \
1952
+ --env LOG_LEVEL=warn \
1953
+ --health-check \
1954
+ --health-path /api/health \
1955
+ --cpu-limit 2 \
1956
+ --memory-limit 2G
1957
+
1958
+ # Switch between environments using different directories
1959
+ mkdir -p ~/projects/myapp-dev ~/projects/myapp-staging ~/projects/myapp-prod
1960
+
1961
+ cd ~/projects/myapp-dev
1962
+ saac init # Select myapp-dev
1963
+ saac deploy
1964
+
1965
+ cd ~/projects/myapp-staging
1966
+ saac init # Select myapp-staging
1967
+ saac deploy
1968
+
1969
+ cd ~/projects/myapp-prod
1970
+ saac init # Select myapp-prod
1971
+ saac deploy
122
1972
  ```
123
1973
 
124
- **Note:** Check MailHog at https://mailhog.goryan.io for verification codes
1974
+ ---
1975
+
1976
+ ## Troubleshooting
1977
+
1978
+ ### Authentication Issues
125
1979
 
126
- #### `saac logout`
127
- Logout from current device (revokes session token)
1980
+ #### "Not logged in"
128
1981
 
1982
+ **Problem:** Session token expired or not found.
1983
+
1984
+ **Solution:**
129
1985
  ```bash
130
- saac logout
1986
+ saac login -e your@email.com -k cw_your_api_key
1987
+ ```
1988
+
1989
+ **If you lost your API key:**
1990
+ ```bash
1991
+ # You need to have a valid session first (via OTP)
1992
+ # Contact support or check MailHog for OTP login
1993
+
1994
+ # Then regenerate API key
1995
+ saac keys regenerate
131
1996
  ```
132
1997
 
133
- #### `saac logout-all`
134
- Logout from all devices (revokes all session tokens)
1998
+ #### "Invalid or expired session token"
1999
+
2000
+ **Problem:** Session token expired (valid for 1 year).
135
2001
 
2002
+ **Solution:**
136
2003
  ```bash
137
- saac logout-all
138
- saac logout-all --yes # Skip confirmation
2004
+ saac logout
2005
+ saac login -e your@email.com -k cw_your_api_key
139
2006
  ```
140
2007
 
141
- **Options:**
142
- - `-y, --yes` - Skip confirmation prompt
2008
+ #### "Email not verified"
143
2009
 
144
- #### `saac sessions`
145
- List all active sessions
2010
+ **Problem:** You registered but didn't verify your email.
146
2011
 
2012
+ **Solution:**
147
2013
  ```bash
148
- saac sessions
2014
+ # Check MailHog for verification code
2015
+ # Visit: https://mailhog.goryan.io
2016
+
2017
+ # Verify with code
2018
+ saac verify 123456
149
2019
  ```
150
2020
 
151
- Shows all devices where you're currently logged in with creation date, last used time, IP address, and expiration date.
2021
+ ### Git OAuth Issues
152
2022
 
153
- #### `saac git connect [host]`
154
- Connect a Git account via OAuth
2023
+ #### "Git account not connected"
155
2024
 
2025
+ **Problem:** You must connect your Git account before creating applications.
2026
+
2027
+ **Solution:**
156
2028
  ```bash
157
- # Interactive mode - select from providers
158
2029
  saac git connect
159
2030
 
160
- # Connect to specific host
2031
+ # Or specify host directly
161
2032
  saac git connect git.startanaicompany.com
162
-
163
- # Connect from repository URL
164
- saac git connect git@git.startanaicompany.com:user/repo.git
165
2033
  ```
166
2034
 
167
- **What happens:**
168
- 1. Browser opens to OAuth authorization page
169
- 2. You authorize on the Git provider
170
- 3. Connection saved (encrypted on server)
171
- 4. Future app creations use this connection automatically
2035
+ #### "OAuth authorization failed"
172
2036
 
173
- #### `saac git list`
174
- List all connected Git accounts
2037
+ **Problem:** Browser OAuth flow was cancelled or failed.
175
2038
 
2039
+ **Solution:**
176
2040
  ```bash
177
- saac git list
178
- saac git ls # Alias
2041
+ # Try again with specific host
2042
+ saac git connect git.startanaicompany.com
2043
+
2044
+ # If browser doesn't open automatically, copy the URL from the terminal
179
2045
  ```
180
2046
 
181
- Shows host, username, provider, expiration date, and last used time.
2047
+ #### "OAuth connection expired"
182
2048
 
183
- #### `saac git disconnect <host>`
184
- Disconnect a Git account
2049
+ **Problem:** OAuth token expired or was revoked.
185
2050
 
2051
+ **Solution:**
186
2052
  ```bash
2053
+ # Disconnect and reconnect
187
2054
  saac git disconnect git.startanaicompany.com
2055
+ saac git connect git.startanaicompany.com
188
2056
  ```
189
2057
 
190
- ### Application Management
2058
+ ### Application Issues
2059
+
2060
+ #### "No application found in current directory"
191
2061
 
192
- #### `saac init`
193
- Link an existing SAAC application to the current directory
2062
+ **Problem:** No `.saac/config.json` file in current directory.
194
2063
 
2064
+ **Solution:**
195
2065
  ```bash
196
- # Interactive mode - select from your applications
197
- cd my-project
2066
+ # Link to existing application
198
2067
  saac init
199
- ```
200
2068
 
201
- **Use Case:** When you clone a Git repository or have an existing project and want to link it to a SAAC application.
202
-
203
- **What it does:**
204
- 1. Shows all your SAAC applications
205
- 2. Let you select which one to link to this directory
206
- 3. Saves the link to `.saac/config.json`
207
- 4. Now you can use `saac deploy`, `saac logs`, etc.
2069
+ # Or create new application
2070
+ saac create myapp -s myapp -r git@git...
2071
+ ```
208
2072
 
209
- **Note:** To create a new application, use `saac create` instead.
2073
+ #### "Application not found" (404)
210
2074
 
211
- #### `saac create <name>`
212
- Create a new application
2075
+ **Problem:** Application UUID is incorrect or application was deleted.
213
2076
 
2077
+ **Solution:**
214
2078
  ```bash
215
- # Basic application (OAuth required!)
216
- saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
2079
+ # List all your applications
2080
+ saac list
217
2081
 
218
- # Advanced with health checks and migration
219
- saac create api -s api -r git@git... \
220
- --build-pack nixpacks \
221
- --port 8080 \
222
- --pre-deploy-cmd "npm run migrate" \
223
- --health-check \
224
- --health-path /api/health \
225
- --env NODE_ENV=production
2082
+ # Re-initialize with correct application
2083
+ saac init
226
2084
  ```
227
2085
 
228
- **Required:**
229
- - `<name>` - Application name
230
- - `-s, --subdomain <subdomain>` - Subdomain for your app
231
- - `-r, --repository <url>` - Git repository URL (SSH format)
232
-
233
- **Prerequisites:**
234
- - You must connect your Git account first: `saac git connect`
235
-
236
- **Optional:**
237
- - `-b, --branch <branch>` - Git branch (default: master)
238
- - `-d, --domain-suffix <suffix>` - Domain suffix (default: startanaicompany.com)
239
- - `-p, --port <port>` - Port to expose (default: 3000)
240
- - `--build-pack <pack>` - Build pack: dockercompose, nixpacks, dockerfile, static
241
- - `--install-cmd <command>` - Install command
242
- - `--build-cmd <command>` - Build command
243
- - `--start-cmd <command>` - Start command
244
- - `--pre-deploy-cmd <command>` - Pre-deployment command (e.g., migrations)
245
- - `--post-deploy-cmd <command>` - Post-deployment command (e.g., seeding)
246
- - `--cpu-limit <limit>` - CPU limit (e.g., "1", "2.5")
247
- - `--memory-limit <limit>` - Memory limit (e.g., "512M", "2G")
248
- - `--health-check` - Enable health checks
249
- - `--health-path <path>` - Health check path (default: /health)
250
- - `--health-interval <seconds>` - Health check interval in seconds
251
- - `--health-timeout <seconds>` - Health check timeout in seconds
252
- - `--health-retries <count>` - Health check retries (1-10)
253
- - `--env <KEY=VALUE>` - Environment variable (can be used multiple times)
2086
+ ### Deployment Issues
254
2087
 
255
- **Note:** Free tier limited to 1 vCPU, 1024M RAM
2088
+ #### Deployment fails
256
2089
 
257
- #### `saac update`
258
- Update application configuration
2090
+ **Problem:** Various reasons - check logs.
259
2091
 
2092
+ **Solution:**
260
2093
  ```bash
261
- # Update port and enable health checks
262
- saac update --port 8080 --health-check --health-path /api/health
263
-
264
- # Switch to Nixpacks and update resource limits
265
- saac update --build-pack nixpacks --cpu-limit 2 --memory-limit 2G
2094
+ # View deployment logs to see what went wrong
2095
+ saac logs --deployment
266
2096
 
267
- # Update custom commands
268
- saac update --pre-deploy-cmd "npm run migrate"
2097
+ # Common issues:
2098
+ # - Build errors: Check your package.json, Dockerfile, etc.
2099
+ # - Missing dependencies: Ensure all dependencies are in package.json
2100
+ # - Port conflicts: Check --port setting
2101
+ # - Resource limits: Free tier is limited to 1 vCPU, 1GB RAM
269
2102
 
270
- # Disable health checks
271
- saac update --no-health-check
2103
+ # Try force deploy (rebuild from scratch)
2104
+ saac deploy --force
272
2105
  ```
273
2106
 
274
- **Options:** All options from `create` command can be updated individually
2107
+ #### "Health check failed"
275
2108
 
276
- **Important:** Configuration changes require redeployment to take effect:
2109
+ **Problem:** Health check endpoint not responding or returning errors.
2110
+
2111
+ **Solution:**
277
2112
  ```bash
278
- saac deploy
279
- ```
2113
+ # 1. Check if health endpoint exists
2114
+ saac shell
2115
+ root@container:/app# curl localhost:3000/health
280
2116
 
281
- #### `saac deploy`
282
- Deploy your application
2117
+ # 2. View logs for errors
2118
+ saac logs
283
2119
 
284
- ```bash
2120
+ # 3. Temporarily disable health checks
2121
+ saac update --no-health-check
2122
+ saac deploy
2123
+
2124
+ # 4. Fix your health endpoint, re-enable health checks
2125
+ saac update --health-check --health-path /api/health
285
2126
  saac deploy
286
- saac deploy --force
287
2127
  ```
288
2128
 
289
- #### `saac logs`
290
- View application logs
2129
+ ### Environment Variables Issues
291
2130
 
292
- ```bash
293
- saac logs
294
- saac logs --tail 50
295
- saac logs --follow
296
- ```
2131
+ #### "Failed to fetch environment variables" (500 error)
297
2132
 
298
- ### Environment Variables
2133
+ **Problem:** Backend database schema issue (known bug as of Jan 29, 2026).
299
2134
 
300
- #### `saac env set <vars...>`
301
- Set environment variables
2135
+ **Reported to backend team:** Column name mismatch in database query.
302
2136
 
2137
+ **Workaround:** Setting variables works fine:
303
2138
  ```bash
2139
+ # Setting works
304
2140
  saac env set KEY=value
305
- saac env set KEY1=value1 KEY2=value2
306
- ```
307
2141
 
308
- #### `saac env get [key]`
309
- Get environment variable(s)
2142
+ # Listing fails (backend issue)
2143
+ saac env list # Returns 500
310
2144
 
311
- ```bash
312
- saac env get
313
- saac env get KEY
2145
+ # Wait for backend team to fix database schema
314
2146
  ```
315
2147
 
316
- #### `saac env list`
317
- List all environment variables
2148
+ #### Changes not taking effect
2149
+
2150
+ **Problem:** Environment variable changes require redeployment.
318
2151
 
2152
+ **Solution:**
319
2153
  ```bash
320
- saac env list
2154
+ # After setting env vars, always redeploy
2155
+ saac env set NODE_ENV=production
2156
+ saac deploy
321
2157
  ```
322
2158
 
323
- ### Domain Management
2159
+ ### Logs Issues
324
2160
 
325
- #### `saac domain set <subdomain>`
326
- Change your application subdomain
2161
+ #### "No logs available"
327
2162
 
2163
+ **Problem:** Application not deployed yet or container not running.
2164
+
2165
+ **Solution:**
328
2166
  ```bash
329
- saac domain set newsubdomain
2167
+ # Check application status
2168
+ saac status
2169
+
2170
+ # Deploy if not deployed
2171
+ saac deploy
2172
+
2173
+ # Wait a moment for container to start
2174
+ sleep 10
2175
+
2176
+ # Try logs again
2177
+ saac logs
330
2178
  ```
331
2179
 
332
- #### `saac domain show`
333
- Show current domain
2180
+ #### "result.logs.forEach is not a function"
334
2181
 
2182
+ **Problem:** Fixed in version 1.4.20. Update your CLI.
2183
+
2184
+ **Solution:**
335
2185
  ```bash
336
- saac domain show
2186
+ npm update -g @startanaicompany/cli
337
2187
  ```
338
2188
 
339
- ### Information
2189
+ ### Shell Issues
340
2190
 
341
- #### `saac list`
342
- List all your applications
2191
+ #### "Connection timeout"
343
2192
 
2193
+ **Problem:** Container taking too long to start or network issues.
2194
+
2195
+ **Solution:**
344
2196
  ```bash
345
- saac list
346
- saac ls
2197
+ # Check application status
2198
+ saac status
2199
+
2200
+ # Ensure application is running
2201
+ saac deploy
2202
+
2203
+ # Wait for deployment to complete
2204
+ saac logs --deployment
2205
+
2206
+ # Try shell again
2207
+ saac shell
347
2208
  ```
348
2209
 
349
- #### `saac status`
350
- Show current application status
2210
+ #### "WebSocket connection failed"
2211
+
2212
+ **Problem:** Backend WebSocket server not available (Project Aurora not deployed yet).
351
2213
 
2214
+ **Status:** As of Jan 29, 2026, Project Aurora WebSocket infrastructure awaiting backend deployment.
2215
+
2216
+ **Workaround:** Use `saac exec` for one-off commands:
352
2217
  ```bash
353
- saac status
2218
+ saac exec "npm run migrate"
2219
+ saac exec "ps aux"
354
2220
  ```
355
2221
 
356
- #### `saac whoami`
357
- Show current user information
2222
+ ### General Debugging
358
2223
 
359
2224
  ```bash
2225
+ # Check CLI version
2226
+ saac --version
2227
+
2228
+ # Show help
2229
+ saac --help
2230
+
2231
+ # Check what command does
2232
+ saac logs --help
2233
+ saac deploy --help
2234
+
2235
+ # View user information
360
2236
  saac whoami
361
- ```
362
2237
 
363
- ### Deletion
2238
+ # List all applications
2239
+ saac list
364
2240
 
365
- #### `saac delete`
366
- Delete current application
2241
+ # Check application status
2242
+ saac status
367
2243
 
368
- ```bash
369
- saac delete
370
- saac delete --yes # Skip confirmation
371
- saac rm # Alias
2244
+ # View session information
2245
+ saac sessions
2246
+
2247
+ # Test API connectivity (manual command from GitHub)
2248
+ saac manual
372
2249
  ```
373
2250
 
374
- ## Configuration
2251
+ ---
2252
+
2253
+ ## Configuration Files
375
2254
 
376
2255
  ### Global Configuration
377
2256
 
378
- Stored in `~/.config/startanaicompany/config.json`:
2257
+ **Location:** `~/.config/startanaicompany/config.json`
379
2258
 
2259
+ **Contains:**
2260
+ - API URL
2261
+ - User credentials (email, userId, sessionToken)
2262
+ - Session expiration timestamp
2263
+ - Verification status
2264
+
2265
+ **Example:**
380
2266
  ```json
381
2267
  {
382
2268
  "apiUrl": "https://apps.startanaicompany.com/api/v1",
383
2269
  "user": {
384
- "email": "user@example.com",
385
- "userId": "...",
386
- "apiKey": "cw_...",
2270
+ "email": "developer@company.com",
2271
+ "userId": "a2c37076-1b0e-4b9a-80f8-31ef39766096",
2272
+ "sessionToken": "st_kgzfNByNNrtrDsAW07h6ORwTtP3POK6O98klH9Rm8jTt9ByHojeH7zDmGwaF",
2273
+ "expiresAt": "2027-01-29T09:00:00.000Z",
387
2274
  "verified": true
388
2275
  }
389
2276
  }
390
2277
  ```
391
2278
 
2279
+ **Note:** Managed by the CLI. Do not edit manually unless troubleshooting.
2280
+
392
2281
  ### Project Configuration
393
2282
 
394
- Stored in `.saac/config.json` in your project:
2283
+ **Location:** `.saac/config.json` (in your project directory)
395
2284
 
2285
+ **Contains:**
2286
+ - Application UUID
2287
+ - Application name
2288
+ - Subdomain
2289
+ - Domain suffix
2290
+ - Git repository
2291
+
2292
+ **Example:**
396
2293
  ```json
397
2294
  {
398
- "applicationUuid": "...",
399
- "applicationName": "my-site",
400
- "subdomain": "mysite",
2295
+ "applicationUuid": "h884go4s4080kwk4808sw0wc",
2296
+ "applicationName": "mysimpleflowershop",
2297
+ "subdomain": "shop",
401
2298
  "domainSuffix": "startanaicompany.com",
402
- "gitRepository": "git@git.startanaicompany.com:user/repo.git"
2299
+ "gitRepository": "git@git.startanaicompany.com:company/myapp.git"
403
2300
  }
404
2301
  ```
405
2302
 
406
- ## Workflow Example
2303
+ **Note:** Created automatically by `saac create` or `saac init`.
407
2304
 
408
- ```bash
409
- # Step 1: Register and verify
410
- saac register -e dev@company.com
411
- # Check MailHog for code
412
- saac verify 123456
2305
+ ### .gitignore
413
2306
 
414
- # Step 2: Login
415
- saac login -e dev@company.com -k cw_your_api_key
2307
+ Add to your `.gitignore`:
2308
+ ```gitignore
2309
+ # SAAC CLI config (can be project-specific, commit if shared)
2310
+ .saac/config.json
416
2311
 
417
- # Step 3: Connect your Git account (OAuth)
418
- saac git connect
2312
+ # Or keep it if your team shares the same SAAC application
2313
+ # .saac/config.json
2314
+ ```
2315
+
2316
+ ---
419
2317
 
420
- # Step 4: Clone or create your project
421
- git clone git@git.startanaicompany.com:user/mysite.git
422
- cd mysite
2318
+ ## For LLMs: How to Use This Tool
423
2319
 
424
- # Step 5: Create application
425
- saac create mysite -s mysite -r git@git.startanaicompany.com:user/mysite.git
2320
+ ### Quick Reference
426
2321
 
427
- # Step 6: Deploy
428
- saac deploy
2322
+ **Authentication Flow:**
2323
+ 1. `saac register -e email@example.com` → Register
2324
+ 2. Check email for code → Get verification code
2325
+ 3. `saac verify 123456` → Verify (save API key!)
2326
+ 4. `saac login -e email@example.com -k cw_...` → Login (gets session token)
429
2327
 
430
- # Step 7: View logs
431
- saac logs --follow
2328
+ **Git OAuth (Required for App Creation):**
2329
+ 1. `saac git connect` → Connect Git account
2330
+ 2. Browser opens → Authorize
2331
+ 3. Now you can create apps
432
2332
 
433
- # Step 8: Update environment variables
434
- saac env set COMPANY_NAME="My Company"
435
- saac deploy # Redeploy to apply changes
436
- ```
2333
+ **Application Management:**
2334
+ 1. `saac create name -s subdomain -r git@git...` → Create
2335
+ 2. `saac deploy` Deploy
2336
+ 3. `saac logs` → View logs
2337
+ 4. `saac shell` → Access container
437
2338
 
438
- ## Environment Variables
2339
+ **Environment Variables:**
2340
+ 1. `saac env set KEY=value KEY2=value2` → Set
2341
+ 2. `saac env list` → List
2342
+ 3. `saac deploy` → Deploy to apply changes
439
2343
 
440
- The CLI sets these automatically:
441
- - `DOMAIN` - Your application domain
442
- - `COOLIFY_*` - Coolify API configuration (managed by wrapper)
2344
+ **Common Commands:**
2345
+ - `saac list` List all applications
2346
+ - `saac status` Show application status
2347
+ - `saac logs` → Runtime logs
2348
+ - `saac logs --deployment` → Build logs
2349
+ - `saac shell` → Interactive shell in container
2350
+ - `saac exec "command"` → Run command in container
2351
+ - `saac run npm start` → Run local command with remote env vars
443
2352
 
444
- You can set custom variables:
445
- ```bash
446
- saac env set COMPANY_NAME="Acme Corp"
447
- saac env set PRIMARY_COLOR="#2563EB"
448
- saac env set CONTACT_EMAIL="contact@acme.com"
449
- ```
2353
+ ### Key Concepts for LLMs
450
2354
 
451
- ## Troubleshooting
2355
+ 1. **Session Tokens:** Login with API key to get session token (valid 1 year). CLI handles this automatically.
452
2356
 
453
- ### "Not logged in"
2357
+ 2. **Git OAuth Required:** You MUST connect Git account (`saac git connect`) before creating applications.
2358
+
2359
+ 3. **Project Context:** Most commands require `.saac/config.json` in current directory (created by `create` or `init`).
2360
+
2361
+ 4. **Environment Variables:** Changes require redeployment (`saac deploy`) to take effect.
2362
+
2363
+ 5. **Two Types of Logs:**
2364
+ - Runtime logs: `saac logs` (container stdout/stderr)
2365
+ - Deployment logs: `saac logs --deployment` (build output)
2366
+
2367
+ 6. **Remote Access:**
2368
+ - `saac shell` - Interactive shell (like SSH)
2369
+ - `saac exec` - One-off command execution
2370
+ - `saac run` - Local command with remote env vars
2371
+
2372
+ 7. **Project Aurora:** WebSocket-based remote shell providing TRUE container access (not local shell with env vars).
2373
+
2374
+ ### Common Patterns
2375
+
2376
+ **Create and Deploy:**
454
2377
  ```bash
455
- saac login -e your@email.com -k cw_your_api_key
2378
+ saac create myapp -s myapp -r git@git.startanaicompany.com:user/repo.git --env NODE_ENV=production
2379
+ saac deploy
2380
+ saac logs --deployment
2381
+ saac logs
456
2382
  ```
457
2383
 
458
- ### "Git account not connected"
459
- You must connect your Git account before creating applications:
2384
+ **Update Configuration:**
460
2385
  ```bash
461
- saac git connect
2386
+ saac update --port 8080 --health-check
2387
+ saac deploy
462
2388
  ```
463
2389
 
464
- ### "No application found"
2390
+ **Debug Issues:**
465
2391
  ```bash
466
- saac init
467
- # or
468
- saac create
2392
+ saac status
2393
+ saac logs
2394
+ saac shell
2395
+ # Inside: check files, processes, etc.
2396
+ saac exec "npm run health-check"
469
2397
  ```
470
2398
 
471
- ### "Email not verified"
472
- Check MailHog at https://mailhog.goryan.io and run:
2399
+ **Manage Environment:**
473
2400
  ```bash
474
- saac verify <code>
2401
+ saac env set KEY=value
2402
+ saac env list
2403
+ saac deploy
475
2404
  ```
476
2405
 
477
- ### Deployment fails
478
- ```bash
479
- # View logs to see what went wrong
480
- saac logs
2406
+ ---
481
2407
 
482
- # Try force deploy
483
- saac deploy --force
484
- ```
2408
+ ## API Endpoints Reference
2409
+
2410
+ For developers integrating with the wrapper API:
2411
+
2412
+ **Base URL:** `https://apps.startanaicompany.com/api/v1`
2413
+
2414
+ **Authentication:**
2415
+ - Header: `X-Session-Token: st_...` (recommended)
2416
+ - Header: `X-API-Key: cw_...` (alternative)
2417
+
2418
+ **Key Endpoints:**
2419
+ - `POST /users/register` - Register user
2420
+ - `POST /users/verify` - Verify email
2421
+ - `POST /auth/login` - Login with API key
2422
+ - `GET /oauth/authorize` - OAuth authorization
2423
+ - `GET /oauth/poll/:session_id` - Poll OAuth status
2424
+ - `GET /users/me/oauth` - List OAuth connections
2425
+ - `DELETE /users/me/oauth/:host` - Revoke OAuth connection
2426
+ - `POST /applications` - Create application
2427
+ - `GET /applications` - List applications
2428
+ - `PATCH /applications/:uuid` - Update application
2429
+ - `POST /applications/:uuid/deploy` - Deploy
2430
+ - `GET /applications/:uuid/logs` - Runtime logs
2431
+ - `GET /applications/:uuid/deployment-logs` - Deployment logs
2432
+ - `GET /applications/:uuid/env` - Get environment variables
2433
+ - `PATCH /applications/:uuid/env` - Set environment variables
2434
+ - `GET /shell/connect` - WebSocket endpoint for remote shell
2435
+ - `POST /applications/:uuid/exec` - Execute remote command
2436
+
2437
+ ---
485
2438
 
486
2439
  ## Development
487
2440
 
@@ -496,23 +2449,71 @@ npm install
496
2449
  # Link for local development
497
2450
  npm link
498
2451
 
499
- # Now you can use `saac` command
2452
+ # Now you can use `saac` command globally
500
2453
  saac --help
2454
+
2455
+ # Run linter
2456
+ npm run lint
2457
+
2458
+ # Test locally
2459
+ npm run dev
501
2460
  ```
502
2461
 
2462
+ ### Contributing
2463
+
2464
+ Pull requests are welcome! Please:
2465
+ 1. Fork the repository
2466
+ 2. Create a feature branch
2467
+ 3. Make your changes
2468
+ 4. Add tests if applicable
2469
+ 5. Submit pull request
2470
+
2471
+ ### Architecture
2472
+
2473
+ - **Entry Point:** `bin/saac.js` (Commander.js definitions)
2474
+ - **Commands:** `src/commands/*.js` (command implementations)
2475
+ - **API Client:** `src/lib/api.js` (axios-based HTTP client)
2476
+ - **Logger:** `src/lib/logger.js` (chalk, ora, boxen)
2477
+ - **Config:** `src/lib/config.js` (conf package for global config)
2478
+ - **OAuth:** `src/lib/oauth.js` (Git OAuth helpers)
2479
+
2480
+ ---
2481
+
503
2482
  ## Support
504
2483
 
505
- - 📧 Email: support@startanaicompany.com
506
- - 🐛 Issues: https://github.com/startanaicompany/cli/issues
507
- - 📚 Docs: https://startanaicompany.com/docs
2484
+ - 📧 **Email:** support@startanaicompany.com
2485
+ - 🐛 **Issues:** https://github.com/startanaicompany/cli/issues
2486
+ - 📚 **Docs:** https://startanaicompany.com/docs
2487
+ - 💬 **MailHog (Dev):** https://mailhog.goryan.io
2488
+
2489
+ ---
508
2490
 
509
2491
  ## License
510
2492
 
511
2493
  MIT © StartAnAiCompany
512
2494
 
513
- ## Contributing
2495
+ ---
2496
+
2497
+ ## Changelog
2498
+
2499
+ ### Version 1.4.20 (Latest)
2500
+ - Fixed logs command - handle logs as string instead of array
2501
+ - Backend returns `result.logs` as string, not array
2502
+
2503
+ ### Version 1.4.19
2504
+ - Version bump
2505
+
2506
+ ### Version 1.4.18
2507
+ - Implemented Project Aurora - TRUE remote shell via WebSocket (Phase 3.5)
2508
+ - Added WebSocket-based remote shell access (`saac shell`)
2509
+ - Fixed env set command - removed spread operator causing array-in-array bug
2510
+ - Environment variable setting now works correctly
514
2511
 
515
- Pull requests are welcome! Please read our contributing guidelines first.
2512
+ ### Version 1.4.14
2513
+ - OAuth-only authentication for Git
2514
+ - Removed manual `--git-token` option
2515
+ - Added `saac git connect`, `saac git list`, `saac git disconnect`
2516
+ - Improved documentation
516
2517
 
517
2518
  ---
518
2519