@startanaicompany/cli 1.3.1 → 1.4.1

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
@@ -313,6 +313,58 @@ saac update --restart on-failure
313
313
  - Warns if tier limits were applied (resource caps)
314
314
  - Reminds user to redeploy for changes to take effect
315
315
 
316
+ ### Git OAuth Commands (NEW in 1.4.0)
317
+
318
+ The `git` command manages Git account OAuth connections, allowing users to deploy applications without providing tokens repeatedly.
319
+
320
+ **Subcommands:**
321
+ 1. `saac git connect [host]` - Connect Git account via OAuth
322
+ 2. `saac git list` - List all connected Git accounts
323
+ 3. `saac git disconnect <host>` - Disconnect a Git account
324
+
325
+ **OAuth Flow:**
326
+ 1. User runs `saac git connect` or creates app without token
327
+ 2. Browser opens to OAuth authorization page
328
+ 3. User authorizes on Git provider (Gitea, GitHub, GitLab)
329
+ 4. CLI polls for completion every 2 seconds (max 5 minutes)
330
+ 5. Connection saved on server (encrypted AES-256-GCM)
331
+ 6. Future app creations use OAuth token automatically
332
+
333
+ **Usage Examples:**
334
+ ```bash
335
+ # Connect to default Gitea instance
336
+ saac git connect git.startanaicompany.com
337
+
338
+ # Connect from repository URL
339
+ saac git connect git@git.startanaicompany.com:user/repo.git
340
+
341
+ # Interactive mode - select provider
342
+ saac git connect
343
+
344
+ # List connections
345
+ saac git list
346
+
347
+ # Disconnect
348
+ saac git disconnect git.startanaicompany.com
349
+ ```
350
+
351
+ **Integration with Create Command:**
352
+ - If Git account connected → Uses OAuth automatically
353
+ - If NOT connected and no `--git-token` → Prompts to connect
354
+ - If `--git-token` provided → Uses manual token (fallback)
355
+
356
+ **Benefits:**
357
+ - ✅ Connect once, deploy unlimited apps
358
+ - ✅ No need to copy/paste tokens repeatedly
359
+ - ✅ Tokens stored encrypted on server
360
+ - ✅ Auto-refresh for expired tokens
361
+ - ✅ Supports multiple Git providers
362
+
363
+ **Implementation Files:**
364
+ - `src/lib/oauth.js` - OAuth helper functions
365
+ - `src/commands/git.js` - Git command implementation
366
+ - Updated `src/commands/create.js` - OAuth integration
367
+
316
368
  ### Init Command Implementation
317
369
 
318
370
  The `init` command links an existing SAAC application to the current directory.
package/README.md CHANGED
@@ -38,6 +38,58 @@ saac deploy
38
38
 
39
39
  ## Commands
40
40
 
41
+ ## Git Authentication
42
+
43
+ SAAC CLI supports two methods for Git authentication:
44
+
45
+ ### Method 1: OAuth (Recommended ✨ NEW in 1.4.0)
46
+
47
+ Connect your Git account once, deploy unlimited applications without providing tokens:
48
+
49
+ ```bash
50
+ # Connect Git account (interactive)
51
+ saac git connect
52
+
53
+ # Or specify host directly
54
+ saac git connect git.startanaicompany.com
55
+
56
+ # List connected accounts
57
+ saac git list
58
+
59
+ # Disconnect account
60
+ saac git disconnect git.startanaicompany.com
61
+ ```
62
+
63
+ **Benefits:**
64
+ - ✅ Connect once, deploy unlimited apps
65
+ - ✅ No need to remember or copy tokens
66
+ - ✅ Tokens stored encrypted on server
67
+ - ✅ Supports Gitea, GitHub, and GitLab
68
+
69
+ **Creating apps with OAuth:**
70
+ ```bash
71
+ # No token needed if OAuth connected!
72
+ saac create my-app -s myapp -r git@git.startanaicompany.com:user/repo.git
73
+
74
+ # CLI automatically uses your connected account
75
+ # ✅ Using connected account: username@git.startanaicompany.com
76
+ ```
77
+
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.
90
+
91
+ ---
92
+
41
93
  ### Authentication
42
94
 
43
95
  #### `saac register`
@@ -102,6 +154,43 @@ saac sessions
102
154
 
103
155
  Shows all devices where you're currently logged in with creation date, last used time, IP address, and expiration date.
104
156
 
157
+ #### `saac git connect [host]`
158
+ Connect a Git account via OAuth
159
+
160
+ ```bash
161
+ # Interactive mode - select from providers
162
+ saac git connect
163
+
164
+ # Connect to specific host
165
+ saac git connect git.startanaicompany.com
166
+
167
+ # Connect from repository URL
168
+ saac git connect git@git.startanaicompany.com:user/repo.git
169
+ ```
170
+
171
+ **What happens:**
172
+ 1. Browser opens to OAuth authorization page
173
+ 2. You authorize on the Git provider
174
+ 3. Connection saved (encrypted on server)
175
+ 4. Future app creations use this connection automatically
176
+
177
+ #### `saac git list`
178
+ List all connected Git accounts
179
+
180
+ ```bash
181
+ saac git list
182
+ saac git ls # Alias
183
+ ```
184
+
185
+ Shows host, username, provider, expiration date, and last used time.
186
+
187
+ #### `saac git disconnect <host>`
188
+ Disconnect a Git account
189
+
190
+ ```bash
191
+ saac git disconnect git.startanaicompany.com
192
+ ```
193
+
105
194
  ### Application Management
106
195
 
107
196
  #### `saac init`
@@ -144,7 +233,7 @@ saac create api -s api -r git@git... -t abc123 \
144
233
  - `<name>` - Application name
145
234
  - `-s, --subdomain <subdomain>` - Subdomain for your app
146
235
  - `-r, --repository <url>` - Git repository URL (SSH format)
147
- - `-t, --git-token <token>` - Git API token
236
+ - `-t, --git-token <token>` - Git API token (optional if OAuth connected)
148
237
 
149
238
  **Optional:**
150
239
  - `-b, --branch <branch>` - Git branch (default: master)
package/bin/saac.js CHANGED
@@ -16,6 +16,7 @@ const verify = require('../src/commands/verify');
16
16
  const logout = require('../src/commands/logout');
17
17
  const logoutAll = require('../src/commands/logoutAll');
18
18
  const sessions = require('../src/commands/sessions');
19
+ const git = require('../src/commands/git');
19
20
  const init = require('../src/commands/init');
20
21
  const create = require('../src/commands/create');
21
22
  const update = require('../src/commands/update');
@@ -40,7 +41,7 @@ program
40
41
  .command('register')
41
42
  .description('Register for a new account')
42
43
  .option('-e, --email <email>', 'Email address')
43
- .option('--gitea-username <username>', 'Gitea username (auto-detected if not provided)')
44
+ .option('--git-username <username>', 'Git username (auto-detected if not provided)')
44
45
  .action(register);
45
46
 
46
47
  program
@@ -71,6 +72,27 @@ program
71
72
  .description('List all active sessions')
72
73
  .action(sessions);
73
74
 
75
+ // Git OAuth commands
76
+ const gitCommand = program
77
+ .command('git')
78
+ .description('Manage Git account connections (OAuth)');
79
+
80
+ gitCommand
81
+ .command('connect [host]')
82
+ .description('Connect a Git account via OAuth')
83
+ .action(git.connect);
84
+
85
+ gitCommand
86
+ .command('list')
87
+ .alias('ls')
88
+ .description('List connected Git accounts')
89
+ .action(git.list);
90
+
91
+ gitCommand
92
+ .command('disconnect <host>')
93
+ .description('Disconnect a Git account')
94
+ .action(git.disconnect);
95
+
74
96
  // Application management
75
97
  program
76
98
  .command('init')