@sembix/cli 1.2.1 → 1.4.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.
Files changed (205) hide show
  1. package/COMMANDS.md +1522 -0
  2. package/QUICKSTART.md +829 -0
  3. package/README.md +1976 -309
  4. package/USAGE-EXAMPLES.md +872 -0
  5. package/config.example.yaml +3 -0
  6. package/dist/commands/configure.d.ts.map +1 -1
  7. package/dist/commands/configure.js +172 -2
  8. package/dist/commands/configure.js.map +1 -1
  9. package/dist/commands/index.d.ts +10 -0
  10. package/dist/commands/index.d.ts.map +1 -0
  11. package/dist/commands/index.js +11 -0
  12. package/dist/commands/index.js.map +1 -0
  13. package/dist/commands/login.d.ts +19 -0
  14. package/dist/commands/login.d.ts.map +1 -0
  15. package/dist/commands/login.js +118 -0
  16. package/dist/commands/login.js.map +1 -0
  17. package/dist/commands/logout.d.ts +21 -0
  18. package/dist/commands/logout.d.ts.map +1 -0
  19. package/dist/commands/logout.js +66 -0
  20. package/dist/commands/logout.js.map +1 -0
  21. package/dist/commands/profile-project.d.ts +14 -0
  22. package/dist/commands/profile-project.d.ts.map +1 -0
  23. package/dist/commands/profile-project.js +123 -0
  24. package/dist/commands/profile-project.js.map +1 -0
  25. package/dist/commands/profile.d.ts +26 -0
  26. package/dist/commands/profile.d.ts.map +1 -0
  27. package/dist/commands/profile.js +177 -0
  28. package/dist/commands/profile.js.map +1 -0
  29. package/dist/commands/project.d.ts +16 -0
  30. package/dist/commands/project.d.ts.map +1 -0
  31. package/dist/commands/project.js +153 -0
  32. package/dist/commands/project.js.map +1 -0
  33. package/dist/commands/setup.js +3 -0
  34. package/dist/commands/setup.js.map +1 -1
  35. package/dist/commands/workflow.d.ts +91 -0
  36. package/dist/commands/workflow.d.ts.map +1 -0
  37. package/dist/commands/workflow.js +1201 -0
  38. package/dist/commands/workflow.js.map +1 -0
  39. package/dist/config-schema.d.ts +26 -0
  40. package/dist/config-schema.d.ts.map +1 -1
  41. package/dist/config-schema.js +24 -1
  42. package/dist/config-schema.js.map +1 -1
  43. package/dist/config.d.ts +4 -0
  44. package/dist/config.d.ts.map +1 -1
  45. package/dist/config.js +23 -2
  46. package/dist/config.js.map +1 -1
  47. package/dist/index.js +324 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/prompts/environment-setup.d.ts.map +1 -1
  50. package/dist/prompts/environment-setup.js +12 -0
  51. package/dist/prompts/environment-setup.js.map +1 -1
  52. package/dist/prompts/project-selection.d.ts +8 -0
  53. package/dist/prompts/project-selection.d.ts.map +1 -0
  54. package/dist/prompts/project-selection.js +132 -0
  55. package/dist/prompts/project-selection.js.map +1 -0
  56. package/dist/prompts/workflow-inputs.d.ts +10 -0
  57. package/dist/prompts/workflow-inputs.d.ts.map +1 -0
  58. package/dist/prompts/workflow-inputs.js +71 -0
  59. package/dist/prompts/workflow-inputs.js.map +1 -0
  60. package/dist/prompts/workflow-selection.d.ts +8 -0
  61. package/dist/prompts/workflow-selection.d.ts.map +1 -0
  62. package/dist/prompts/workflow-selection.js +147 -0
  63. package/dist/prompts/workflow-selection.js.map +1 -0
  64. package/dist/sembix-cli-1.4.0.tgz +0 -0
  65. package/dist/services/cognito-auth.d.ts +92 -0
  66. package/dist/services/cognito-auth.d.ts.map +1 -0
  67. package/dist/services/cognito-auth.js +319 -0
  68. package/dist/services/cognito-auth.js.map +1 -0
  69. package/dist/services/studio-api-client.d.ts +127 -0
  70. package/dist/services/studio-api-client.d.ts.map +1 -0
  71. package/dist/services/studio-api-client.js +291 -0
  72. package/dist/services/studio-api-client.js.map +1 -0
  73. package/dist/types/studio.d.ts +82 -0
  74. package/dist/types/studio.d.ts.map +1 -0
  75. package/dist/types/studio.js +7 -0
  76. package/dist/types/studio.js.map +1 -0
  77. package/dist/types.d.ts +286 -0
  78. package/dist/types.d.ts.map +1 -1
  79. package/dist/types.js +5 -0
  80. package/dist/types.js.map +1 -1
  81. package/dist/utils/browser-auth.d.ts +45 -0
  82. package/dist/utils/browser-auth.d.ts.map +1 -0
  83. package/dist/utils/browser-auth.js +168 -0
  84. package/dist/utils/browser-auth.js.map +1 -0
  85. package/dist/utils/cognito-auth.d.ts +3 -0
  86. package/dist/utils/cognito-auth.d.ts.map +1 -0
  87. package/dist/utils/cognito-auth.js +3 -0
  88. package/dist/utils/cognito-auth.js.map +1 -0
  89. package/dist/utils/config-file.d.ts +40 -0
  90. package/dist/utils/config-file.d.ts.map +1 -1
  91. package/dist/utils/config-file.js +158 -4
  92. package/dist/utils/config-file.js.map +1 -1
  93. package/dist/utils/config-loader.d.ts.map +1 -1
  94. package/dist/utils/config-loader.js +15 -2
  95. package/dist/utils/config-loader.js.map +1 -1
  96. package/dist/utils/environment.d.ts +22 -0
  97. package/dist/utils/environment.d.ts.map +1 -0
  98. package/dist/utils/environment.js +39 -0
  99. package/dist/utils/environment.js.map +1 -0
  100. package/dist/utils/error-handler.d.ts +53 -0
  101. package/dist/utils/error-handler.d.ts.map +1 -0
  102. package/dist/utils/error-handler.js +174 -0
  103. package/dist/utils/error-handler.js.map +1 -0
  104. package/dist/utils/fuzzy-match.d.ts +31 -0
  105. package/dist/utils/fuzzy-match.d.ts.map +1 -0
  106. package/dist/utils/fuzzy-match.js +138 -0
  107. package/dist/utils/fuzzy-match.js.map +1 -0
  108. package/dist/utils/input-parser.d.ts +14 -0
  109. package/dist/utils/input-parser.d.ts.map +1 -0
  110. package/dist/utils/input-parser.js +34 -0
  111. package/dist/utils/input-parser.js.map +1 -0
  112. package/dist/utils/output.d.ts +55 -0
  113. package/dist/utils/output.d.ts.map +1 -0
  114. package/dist/utils/output.js +80 -0
  115. package/dist/utils/output.js.map +1 -0
  116. package/dist/utils/recent-workflows.d.ts +37 -0
  117. package/dist/utils/recent-workflows.d.ts.map +1 -0
  118. package/dist/utils/recent-workflows.js +172 -0
  119. package/dist/utils/recent-workflows.js.map +1 -0
  120. package/dist/utils/studio-api-client.d.ts +3 -0
  121. package/dist/utils/studio-api-client.d.ts.map +1 -0
  122. package/dist/utils/studio-api-client.js +3 -0
  123. package/dist/utils/studio-api-client.js.map +1 -0
  124. package/dist/utils/studio-api.d.ts +53 -0
  125. package/dist/utils/studio-api.d.ts.map +1 -0
  126. package/dist/utils/studio-api.js +102 -0
  127. package/dist/utils/studio-api.js.map +1 -0
  128. package/dist/utils/studio-config.d.ts +74 -0
  129. package/dist/utils/studio-config.d.ts.map +1 -0
  130. package/dist/utils/studio-config.js +213 -0
  131. package/dist/utils/studio-config.js.map +1 -0
  132. package/dist/utils/token-manager.d.ts +4 -0
  133. package/dist/utils/token-manager.d.ts.map +1 -0
  134. package/dist/utils/token-manager.js +3 -0
  135. package/dist/utils/token-manager.js.map +1 -0
  136. package/dist/utils/ui.d.ts +55 -1
  137. package/dist/utils/ui.d.ts.map +1 -1
  138. package/dist/utils/ui.js +151 -2
  139. package/dist/utils/ui.js.map +1 -1
  140. package/package.json +4 -1
  141. package/dist/__tests__/config-schema.test.d.ts +0 -2
  142. package/dist/__tests__/config-schema.test.d.ts.map +0 -1
  143. package/dist/__tests__/config-schema.test.js +0 -471
  144. package/dist/__tests__/config-schema.test.js.map +0 -1
  145. package/dist/__tests__/config.test.d.ts +0 -2
  146. package/dist/__tests__/config.test.d.ts.map +0 -1
  147. package/dist/__tests__/config.test.js +0 -75
  148. package/dist/__tests__/config.test.js.map +0 -1
  149. package/dist/__tests__/integration/configure.test.d.ts +0 -2
  150. package/dist/__tests__/integration/configure.test.d.ts.map +0 -1
  151. package/dist/__tests__/integration/configure.test.js +0 -247
  152. package/dist/__tests__/integration/configure.test.js.map +0 -1
  153. package/dist/__tests__/integration/fixtures/configs.d.ts +0 -477
  154. package/dist/__tests__/integration/fixtures/configs.d.ts.map +0 -1
  155. package/dist/__tests__/integration/fixtures/configs.js +0 -175
  156. package/dist/__tests__/integration/fixtures/configs.js.map +0 -1
  157. package/dist/__tests__/integration/helpers/cli-runner.d.ts +0 -63
  158. package/dist/__tests__/integration/helpers/cli-runner.d.ts.map +0 -1
  159. package/dist/__tests__/integration/helpers/cli-runner.js +0 -152
  160. package/dist/__tests__/integration/helpers/cli-runner.js.map +0 -1
  161. package/dist/__tests__/integration/helpers/command-runner.d.ts +0 -53
  162. package/dist/__tests__/integration/helpers/command-runner.d.ts.map +0 -1
  163. package/dist/__tests__/integration/helpers/command-runner.js +0 -117
  164. package/dist/__tests__/integration/helpers/command-runner.js.map +0 -1
  165. package/dist/__tests__/integration/studio-create.test.d.ts +0 -2
  166. package/dist/__tests__/integration/studio-create.test.d.ts.map +0 -1
  167. package/dist/__tests__/integration/studio-create.test.js +0 -209
  168. package/dist/__tests__/integration/studio-create.test.js.map +0 -1
  169. package/dist/__tests__/integration/studio-update.test.d.ts +0 -2
  170. package/dist/__tests__/integration/studio-update.test.d.ts.map +0 -1
  171. package/dist/__tests__/integration/studio-update.test.js +0 -166
  172. package/dist/__tests__/integration/studio-update.test.js.map +0 -1
  173. package/dist/commands/__tests__/configure.test.d.ts +0 -2
  174. package/dist/commands/__tests__/configure.test.d.ts.map +0 -1
  175. package/dist/commands/__tests__/configure.test.js +0 -229
  176. package/dist/commands/__tests__/configure.test.js.map +0 -1
  177. package/dist/prompts/__tests__/environment-setup.test.d.ts +0 -2
  178. package/dist/prompts/__tests__/environment-setup.test.d.ts.map +0 -1
  179. package/dist/prompts/__tests__/environment-setup.test.js +0 -206
  180. package/dist/prompts/__tests__/environment-setup.test.js.map +0 -1
  181. package/dist/prompts/__tests__/hub-integration.test.d.ts +0 -2
  182. package/dist/prompts/__tests__/hub-integration.test.d.ts.map +0 -1
  183. package/dist/prompts/__tests__/hub-integration.test.js +0 -126
  184. package/dist/prompts/__tests__/hub-integration.test.js.map +0 -1
  185. package/dist/prompts/__tests__/prompt-helpers.test.d.ts +0 -2
  186. package/dist/prompts/__tests__/prompt-helpers.test.d.ts.map +0 -1
  187. package/dist/prompts/__tests__/prompt-helpers.test.js +0 -235
  188. package/dist/prompts/__tests__/prompt-helpers.test.js.map +0 -1
  189. package/dist/sembix-cli-1.2.1.tgz +0 -0
  190. package/dist/utils/__tests__/config-file.test.d.ts +0 -2
  191. package/dist/utils/__tests__/config-file.test.d.ts.map +0 -1
  192. package/dist/utils/__tests__/config-file.test.js +0 -218
  193. package/dist/utils/__tests__/config-file.test.js.map +0 -1
  194. package/dist/utils/__tests__/config-loader.test.d.ts +0 -2
  195. package/dist/utils/__tests__/config-loader.test.d.ts.map +0 -1
  196. package/dist/utils/__tests__/config-loader.test.js +0 -325
  197. package/dist/utils/__tests__/config-loader.test.js.map +0 -1
  198. package/dist/utils/__tests__/github.test.d.ts +0 -2
  199. package/dist/utils/__tests__/github.test.d.ts.map +0 -1
  200. package/dist/utils/__tests__/github.test.js +0 -282
  201. package/dist/utils/__tests__/github.test.js.map +0 -1
  202. package/dist/utils/__tests__/ui.test.d.ts +0 -2
  203. package/dist/utils/__tests__/ui.test.d.ts.map +0 -1
  204. package/dist/utils/__tests__/ui.test.js +0 -256
  205. package/dist/utils/__tests__/ui.test.js.map +0 -1
package/README.md CHANGED
@@ -8,27 +8,40 @@ A terminal-based CLI tool for managing Sembix products. An intuitive command-lin
8
8
  - [Prerequisites](#prerequisites)
9
9
  - [Deployment Process](#deployment-process)
10
10
  - [Installation](#installation)
11
+ - [Quick Start](#quick-start)
12
+ - [GitHub Deployment Quick Start](#github-deployment-quick-start)
13
+ - [Studio CLI Quick Start](#studio-cli-quick-start)
11
14
  - [Configuration](#configuration)
12
15
  - [Option 1: Interactive Configuration (Recommended)](#option-1-interactive-configuration-recommended)
13
16
  - [Option 2: Environment Variables (.env file)](#option-2-environment-variables-env-file)
14
17
  - [Option 3: Config File (Recommended for Automation)](#option-3-config-file-recommended-for-automation)
15
18
  - [Creating a GitHub Token](#creating-a-github-token)
16
19
  - [Credential Priority](#credential-priority)
17
- - [Usage](#usage)
18
- - [Quick Start](#quick-start)
19
- - [Example: Complete First-Time Setup](#example-complete-first-time-setup)
20
20
  - [Commands](#commands)
21
- - [`sembix configure`](#sembix-configure)
22
- - [`sembix studio create`](#sembix-studio-create)
23
- - [`sembix studio update`](#sembix-studio-update)
24
- - [`sembix studio add-hub`](#sembix-studio-add-hub)
25
- - [`sembix studio list`](#sembix-studio-list)
21
+ - [Global Commands](#global-commands)
22
+ - [Studio Deployment Commands](#studio-deployment-commands)
23
+ - [Studio API Commands](#studio-api-commands)
24
+ - [Global Options](#global-options)
25
+ - [Usage Examples](#usage-examples)
26
+ - [Basic Usage Patterns](#basic-usage-patterns)
27
+ - [Common Workflows](#common-workflows)
28
+ - [Profile Management](#profile-management-examples)
29
+ - [Error Handling](#error-handling-examples)
30
+ - [Best Practices](#best-practices)
31
+ - [Studio CLI](#studio-cli)
32
+ - [Studio Configuration](#studio-configuration)
33
+ - [Authentication](#authentication)
34
+ - [Workflow Operations](#workflow-operations)
26
35
  - [Workflow](#workflow)
27
36
  - [Configuration Priority](#configuration-priority)
28
37
  - [Config File Reference](#config-file-reference)
29
38
  - [Use Cases](#use-cases)
30
- - [Development](#development)
31
39
  - [Troubleshooting](#troubleshooting)
40
+ - [Authentication Issues](#authentication-issues)
41
+ - [GitHub API Issues](#github-api-issues)
42
+ - [Studio API Issues](#studio-api-issues)
43
+ - [Common Errors](#common-errors)
44
+ - [Development](#development)
32
45
  - [Advanced Topics](#advanced-topics)
33
46
  - [License](#license)
34
47
  - [Support](#support)
@@ -45,6 +58,13 @@ A terminal-based CLI tool for managing Sembix products. An intuitive command-lin
45
58
  - 🔗 **Hub Integration** - Built-in Hub configuration as part of the main workflow
46
59
  - 🎨 **Beautiful UI** - Clean, colorful terminal interface with spinners and status updates
47
60
  - ⚡ **Priority Chain** - CLI flags > Config file > Interactive prompts > Defaults
61
+ - 🌐 **Studio Integration** - Connect to Sembix Studio instances with profile-based configuration
62
+ - 🔐 **Cognito Authentication** - Browser-based OAuth flow with automatic token refresh
63
+ - 🔄 **Workflow Execution** - Start, monitor, and manage workflow runs remotely
64
+ - 👤 **Profile Management** - Manage multiple Studio instances like AWS CLI profiles
65
+ - 📊 **Output Formatting** - JSON, pretty-print, or text output for all commands
66
+ - 🎯 **Project Management** - List, search, and view project details
67
+ - 🔗 **Profile Defaults** - Set default projects per profile for faster workflow execution
48
68
 
49
69
  ## Prerequisites
50
70
 
@@ -54,6 +74,10 @@ A terminal-based CLI tool for managing Sembix products. An intuitive command-lin
54
74
  - `workflow` - Update GitHub Action workflows
55
75
  - **Deployment Repository** - A GitHub repository set up for Sembix Studio deployments
56
76
 
77
+ ### For Studio Integration (Optional)
78
+ - **Sembix Studio Instance** - Access to a Sembix Studio deployment
79
+ - **Cognito Configuration** - User Pool ID, Client ID, and Domain from Studio admin
80
+
57
81
  ## Deployment Process
58
82
 
59
83
  Sembix Studio uses a **two-phased deployment** process to establish secure cross-account access with the Sembix Hub:
@@ -115,6 +139,132 @@ npm install
115
139
  npm run dev -- studio create
116
140
  ```
117
141
 
142
+ ## Quick Start
143
+
144
+ Get started with the Sembix CLI in 5 minutes. Choose the workflow that matches your needs:
145
+
146
+ ### GitHub Deployment Quick Start
147
+
148
+ **Step 1: Configure credentials**
149
+
150
+ ```bash
151
+ sembix configure
152
+ ```
153
+
154
+ Prompts for:
155
+ - GitHub Personal Access Token (required)
156
+ - Default GitHub organization (optional)
157
+
158
+ **Step 2: Create environment**
159
+
160
+ ```bash
161
+ # Interactive mode (recommended for first-time)
162
+ sembix studio create
163
+
164
+ # Or with repository specified
165
+ sembix studio create --repo owner/repo
166
+ ```
167
+
168
+ This interactive wizard walks you through 9 configuration steps and creates your GitHub Actions environment with all required secrets.
169
+
170
+ **Step 3: Deploy via GitHub Actions**
171
+
172
+ 1. Go to your repository's Actions tab
173
+ 2. Select the deployment workflow
174
+ 3. Choose your environment
175
+ 4. Run the workflow
176
+ 5. Copy the Hub role ARNs from deployment output
177
+
178
+ **Step 4: Add Hub integration**
179
+
180
+ ```bash
181
+ sembix studio add-hub production
182
+
183
+ # Or with repository specified
184
+ sembix studio add-hub production --repo owner/repo
185
+ ```
186
+
187
+ Enter the Hub role ARNs from the deployment output.
188
+
189
+ **Step 5: Deploy again**
190
+
191
+ Run the GitHub Actions workflow again with Hub enabled. Your Studio environment is now fully operational!
192
+
193
+ ### Studio CLI Quick Start
194
+
195
+ **Step 1: Configure Studio profile**
196
+
197
+ ```bash
198
+ sembix configure
199
+ ```
200
+
201
+ After GitHub credentials, choose to configure a Studio profile with:
202
+ - Profile name (e.g., "production")
203
+ - Studio API URL
204
+ - Cognito User Pool ID, Client ID, Domain, and Region
205
+
206
+ **Step 2: Authenticate**
207
+
208
+ ```bash
209
+ # Login with default profile
210
+ sembix login
211
+
212
+ # Or specific profile
213
+ sembix login --profile production
214
+ ```
215
+
216
+ Opens your browser for Cognito authentication. Tokens are stored securely and refreshed automatically.
217
+
218
+ **Step 3: Start a workflow**
219
+
220
+ ```bash
221
+ # Interactive mode (recommended)
222
+ sembix workflow start
223
+
224
+ # With explicit IDs
225
+ sembix workflow start --project-id proj_123 --workflow-id wf_456
226
+
227
+ # With workflow name
228
+ sembix workflow start --project-id proj_123 --workflow-name "Deploy"
229
+ ```
230
+
231
+ **Step 4: Monitor workflow**
232
+
233
+ ```bash
234
+ # Check status
235
+ sembix workflow run status --workflow-id wf_456 --run-id run_789
236
+
237
+ # Watch until completion
238
+ sembix workflow run status --workflow-id wf_456 --run-id run_789 --watch
239
+ ```
240
+
241
+ ### Common Tasks Cheat Sheet
242
+
243
+ ```bash
244
+ # List environments
245
+ sembix studio list owner/repo
246
+
247
+ # List profiles
248
+ sembix profile list
249
+
250
+ # Set default project
251
+ sembix profile set-default-project production proj_123
252
+
253
+ # List projects
254
+ sembix project list
255
+
256
+ # List workflows
257
+ sembix workflow list
258
+
259
+ # List workflow runs
260
+ sembix workflow run list --workflow-id wf_456
261
+
262
+ # Stop a workflow
263
+ sembix workflow run stop --workflow-id wf_456 --run-id run_789
264
+ ```
265
+
266
+ For detailed documentation, see the sections below.
267
+
118
268
  ## Configuration
119
269
 
120
270
  ### Option 1: Interactive Configuration (Recommended)
@@ -192,395 +342,1531 @@ The CLI checks for credentials in this order (highest to lowest priority):
192
342
  3. `~/.sembix/config` (created by `sembix configure`)
193
343
  4. Project `.env` file
194
344
 
195
- ## Usage
345
+ ## Commands
346
+
347
+ Complete reference for all Sembix CLI commands.
348
+
349
+ ### Command Structure
350
+
351
+ ```
352
+ sembix <product> <action> [options] [arguments]
353
+ ```
354
+
355
+ - **product**: The Sembix product (e.g., `studio`)
356
+ - **action**: What you want to do (e.g., `create`, `list`, `add-hub`)
357
+ - **options**: Flags like `--token` or `--repo`
358
+ - **arguments**: Required or optional values (e.g., environment name)
196
359
 
197
- ### Quick Start
360
+ ---
361
+
362
+ ### Global Commands
363
+
364
+ #### `sembix configure`
365
+
366
+ Configure Sembix CLI credentials and settings interactively.
198
367
 
199
- **Step 1: Configure credentials (first time only)**
368
+ **Usage:**
200
369
 
201
370
  ```bash
202
371
  sembix configure
203
372
  ```
204
373
 
205
- This interactive command will prompt you for:
206
- - GitHub Personal Access Token
207
- - Default GitHub organization (optional)
374
+ **What it does:**
375
+
376
+ 1. Prompts for your GitHub Personal Access Token
377
+ 2. Prompts for your default GitHub organization (optional)
378
+ 3. Optionally prompts to configure a Sembix Studio profile for API access:
379
+ - Studio API URL
380
+ - Cognito User Pool ID, Client ID, Region, and Domain
381
+ 4. Saves configuration to `~/.sembix/config` with secure permissions (0600)
382
+
383
+ **When to use:**
384
+
385
+ - First time setup (recommended)
386
+ - Updating your GitHub token
387
+ - Changing your default organization
388
+ - Adding or updating Studio profiles for API access
389
+
390
+ **Example:**
391
+
392
+ ```bash
393
+ $ sembix configure
394
+
395
+ Configure Sembix CLI
396
+
397
+ This will store your configuration in:
398
+ ~/.sembix/config
399
+
400
+ ? GitHub Personal Access Token: ****
401
+ ? Default GitHub Organization (optional): acme-corp
402
+ ? Configure Sembix Studio profile? Yes
403
+
404
+ ━━━ Studio Profile Configuration ━━━
405
+
406
+ ? Profile name: production
407
+ ? Studio API URL: https://studio.example.com
408
+ ? Cognito User Pool ID: us-east-1_ABC123
409
+ ? Cognito Client ID: 1a2b3c4d5e6f7g8h9i0j
410
+ ? Cognito Region: us-east-1
411
+ ? Cognito Domain: https://auth.example.com
412
+
413
+ ✓ Configuration saved successfully!
414
+ ✓ Studio profile 'production' configured successfully!
415
+ ```
416
+
417
+ ---
418
+
419
+ ### Studio Deployment Commands
208
420
 
209
- Your credentials are saved securely to `~/.sembix/config`.
421
+ Commands for managing Sembix Studio GitHub Actions deployments.
210
422
 
211
- **Step 2: Create your environment**
423
+ #### `sembix studio create [name]`
212
424
 
213
- For a complete deployment, follow the **two-phased process**:
425
+ Create a new Sembix Studio environment with full interactive configuration.
426
+
427
+ **Usage:**
214
428
 
215
429
  ```bash
216
- # PHASE 1: Bootstrap deployment
217
- sembix studio create --skip-hub
218
- # → Deploy via GitHub Actions
219
- # → Send IAM ARNs to Sembix support
220
- # → Receive Hub role ARNs from support
430
+ # Interactive mode
431
+ sembix studio create
221
432
 
222
- # PHASE 2: Hub integration and full deployment
223
- sembix studio add-hub <environment>
224
- # → Deploy via GitHub Actions again
225
- # Studio environment fully operational
433
+ # With environment name
434
+ sembix studio create production
435
+
436
+ # With name and repository
437
+ sembix studio create production --repo acme/deploy
226
438
  ```
227
439
 
228
- See the [Deployment Process](#deployment-process) section above for detailed explanation.
440
+ **Key Options:**
441
+
442
+ ```bash
443
+ -r, --repo <repo> Target repository (owner/repo)
444
+ -e, --env <environment> Environment name
445
+ -t, --token <token> GitHub personal access token
446
+ -c, --config <path> Path to YAML configuration file
447
+
448
+ # AWS Configuration
449
+ --aws-account-id <id> AWS Account ID (12 digits)
450
+ --aws-region <region> AWS Region
451
+ --customer-role-arn <arn> GitHub Actions IAM role ARN
452
+ --terraform-state-bucket <bucket> Terraform state S3 bucket
453
+
454
+ # Database
455
+ --database-name <name> PostgreSQL database name
456
+ --database-user <user> PostgreSQL database user
457
+
458
+ # Networking
459
+ --enable-vpc-endpoints <boolean> Enable VPC endpoints (true/false)
460
+ --use-custom-networking <boolean> Use existing VPC (true/false)
461
+ --vpc-cidr <cidr> VPC CIDR block (e.g., 10.0.0.0/16)
462
+ --public-subnet-cidrs <json> Public subnet CIDRs (JSON array)
463
+ --private-subnet-cidrs <json> Private subnet CIDRs (JSON array)
464
+ --az-count <count> Number of AZs (2 or 3)
465
+ --custom-vpc-id <id> Existing VPC ID
466
+ --custom-public-subnet-ids <ids> Existing public subnet IDs (comma-separated)
467
+ --custom-private-subnet-ids <ids> Existing private subnet IDs (comma-separated)
468
+
469
+ # Security - Security Groups
470
+ --use-custom-security-groups <boolean> Use custom security groups (true/false)
471
+ --sg-workflow-engine <id> Workflow Engine security group ID
472
+ --sg-aurora <id> Aurora database security group ID
473
+ --sg-rds-proxy <id> RDS Proxy security group ID
474
+ --sg-bff-ecs <id> BFF ECS service security group ID
475
+ --sg-bastion <id> Bastion host security group ID
476
+ --sg-bff-alb <id> BFF ALB security group ID
477
+ --sg-semantic-event-engine <id> Semantic Event Engine security group ID
478
+
479
+ # Security - IAM Roles
480
+ --use-custom-iam-roles <boolean> Use custom IAM roles (true/false)
481
+ --iam-workflow-engine-exec <arn> Workflow Engine execution role ARN
482
+ --iam-workflow-engine-task <arn> Workflow Engine task role ARN
483
+ --iam-bff-ecs-exec <arn> BFF ECS task execution role ARN
484
+ --iam-bff-ecs-task <arn> BFF ECS task role ARN
485
+ --iam-semantic-event-engine-exec <arn> Semantic Event Engine execution role ARN
486
+ --iam-semantic-event-engine-task <arn> Semantic Event Engine task role ARN
487
+ --iam-rds-proxy <arn> RDS Proxy role ARN
488
+ --iam-studio-memory <arn> Studio Memory role ARN
489
+ --iam-studio-notification <arn> Studio Notification role ARN
490
+
491
+ # TLS/DNS
492
+ --cloudfront-domain <domain> CloudFront custom domain
493
+ --cloudfront-cert-arn <arn> CloudFront SSL certificate ARN (us-east-1)
494
+ --bff-alb-cert-arn <arn> BFF ALB SSL certificate ARN
495
+ --hosted-zone-id <id> Route53 hosted zone ID
496
+
497
+ # Hub Integration
498
+ --skip-hub Skip Hub integration
499
+ --hub-engine-execution-role <arn> Hub Engine Execution Role ARN
500
+ --hub-consumer-role <arn> Hub Consumer Role ARN
501
+ --hub-admin-role <arn> Hub Admin Role ARN
502
+ ```
229
503
 
230
- **Alternative workflows:**
504
+ **Examples:**
231
505
 
232
506
  ```bash
233
- # Fully interactive (prompts for all configuration)
507
+ # Fully interactive
234
508
  sembix studio create
235
509
 
236
- # Fast setup with config file
510
+ # With config file
237
511
  sembix studio create --config production.yaml
238
512
 
239
- # Fully automated with CLI flags
240
- sembix studio create production \
241
- --repo acme/deploy \
242
- --aws-account-id 123456789012 \
243
- --aws-region us-east-1 \
244
- --customer-role-arn arn:aws:iam::123456789012:role/Deploy \
245
- --terraform-state-bucket my-tf-state \
246
- # ... (all other flags)
513
+ # Skip Hub (add later)
514
+ sembix studio create production --repo acme/deploy --skip-hub
247
515
  ```
248
516
 
249
- ### Example: Complete First-Time Setup
517
+ **What it does:**
518
+
519
+ 1. Validates repository and environment name
520
+ 2. Walks through 9 configuration steps
521
+ 3. Creates GitHub Actions environment
522
+ 4. Sets environment variables and encrypted secrets
523
+
524
+ See [complete options list](#sembix-studio-create-all-options) below for all 50+ flags.
525
+
526
+ #### `sembix studio update [name]`
527
+
528
+ Update an existing Sembix Studio environment.
529
+
530
+ **Usage:**
250
531
 
251
532
  ```bash
252
- # 1. Configure credentials
253
- $ sembix configure
254
- GitHub Personal Access Token: ****
255
- Default GitHub Organization (optional): acme-corp
256
- ✓ Configuration saved successfully!
533
+ sembix studio update production --repo acme/deploy
534
+ ```
257
535
 
258
- # 2. Create environment interactively
259
- $ sembix studio create
260
- ? Select deployment repository: acme-corp/sembix-deployment
261
- ? Environment name: production
262
- ? AWS Account ID: 123456789012
263
- ... [continues with prompts]
264
- ✓ Environment created successfully!
536
+ **Options:** Same as `create` command
265
537
 
266
- # 3. Deploy via GitHub Actions (in browser)
267
- # → Go to GitHub Actions
268
- # → Run workflow for "production" environment
269
- # → Wait for deployment
270
- # → Copy Hub role ARNs from output
538
+ **Examples:**
271
539
 
272
- # 4. Add Hub integration
273
- $ sembix studio add-hub production
274
- ? Hub Engine Execution Role ARN: arn:aws:iam::999999999999:role/hub-engine
275
- ... [continues with prompts]
276
- ✓ Hub integration configured!
540
+ ```bash
541
+ # Add Hub integration
542
+ sembix studio update production --repo acme/deploy \
543
+ --hub-engine-execution-role arn:aws:iam::123456789012:role/HubEngine
277
544
 
278
- # 5. Deploy again via GitHub Actions
279
- # → Run workflow again
280
- # → Studio is now fully operational!
545
+ # Update feature flags
546
+ sembix studio update production --repo acme/deploy \
547
+ --deploy-studio-memory true
281
548
  ```
282
549
 
283
- ## Commands
550
+ #### `sembix studio add-hub [name]`
284
551
 
285
- ### `sembix configure`
552
+ Add Sembix Hub integration to an existing environment (Phase 2 deployment).
286
553
 
287
- Configure Sembix CLI credentials and settings interactively.
554
+ **Usage:**
555
+
556
+ ```bash
557
+ sembix studio add-hub production --repo acme/deploy
558
+ ```
559
+
560
+ **Options:**
288
561
 
289
- **Syntax:**
562
+ - `-r, --repo <repo>` - Target repository
563
+ - `--hub-engine-execution-role <arn>` - Hub Engine Execution Role ARN
564
+ - `--hub-consumer-role <arn>` - Hub Consumer Role ARN
565
+ - `--hub-admin-role <arn>` - Hub Admin Role ARN
566
+ - `--hub-appconfig-role <arn>` - Hub AppConfig Role ARN (optional)
567
+ - `--hub-appconfig-app-id <id>` - Hub AppConfig Application ID (optional)
568
+ - `--hub-appconfig-env-id <id>` - Hub AppConfig Environment ID (optional)
569
+ - `--hub-appconfig-profile-id <id>` - Hub AppConfig Profile ID (optional)
570
+
571
+ **Example:**
290
572
 
291
573
  ```bash
292
- sembix configure
574
+ sembix studio add-hub production \
575
+ --repo acme/deploy \
576
+ --hub-engine-execution-role arn:aws:iam::999888777666:role/HubEngineRole \
577
+ --hub-consumer-role arn:aws:iam::999888777666:role/HubConsumerRole \
578
+ --hub-admin-role arn:aws:iam::999888777666:role/HubAdminRole
579
+ ```
580
+
581
+ #### `sembix studio list [repository]`
582
+
583
+ List GitHub Actions environments in a repository.
584
+
585
+ **Usage:**
586
+
587
+ ```bash
588
+ # List all your repositories
589
+ sembix studio list
590
+
591
+ # List environments in specific repository
592
+ sembix studio list acme-corp/sembix-deployment
593
+ ```
594
+
595
+ ---
596
+
597
+ ### Studio API Commands
598
+
599
+ Commands for authenticating with and managing Sembix Studio via API.
600
+
601
+ #### `sembix login [profile]`
602
+
603
+ Authenticate with Sembix Studio via Cognito OAuth.
604
+
605
+ **Usage:**
606
+
607
+ ```bash
608
+ # Login with default profile
609
+ sembix login
610
+
611
+ # Login with specific profile
612
+ sembix login production
613
+ # or
614
+ sembix login --profile production
293
615
  ```
294
616
 
295
617
  **What it does:**
296
- 1. Prompts for your GitHub Personal Access Token (with validation)
297
- 2. Prompts for your default GitHub organization (optional)
298
- 3. Saves configuration securely to `~/.sembix/config` with file permissions 0600
299
618
 
300
- **When to use:**
301
- - First time setup (recommended for all users)
302
- - Updating your GitHub token when it expires
303
- - Changing your default organization
619
+ 1. Opens browser for Cognito authentication
620
+ 2. Exchanges OAuth code for access tokens
621
+ 3. Stores tokens securely in `~/.sembix/tokens/<profile>.json`
622
+ 4. Tokens are automatically refreshed when expired
304
623
 
305
- **Example:**
624
+ #### `sembix logout [profile]`
625
+
626
+ Log out from Sembix Studio by removing stored tokens.
627
+
628
+ **Usage:**
306
629
 
307
630
  ```bash
308
- $ sembix configure
631
+ # Logout from default profile
632
+ sembix logout
309
633
 
310
- Configure Sembix CLI
634
+ # Logout from specific profile
635
+ sembix logout production
311
636
 
312
- This will store your configuration in:
313
- ~/.sembix/config
637
+ # Logout from all profiles
638
+ sembix logout --all
639
+ ```
314
640
 
315
- ? GitHub Personal Access Token: ****
316
- ? Default GitHub Organization (optional): acme-corp
641
+ #### Profile Commands
317
642
 
318
- Configuration saved successfully!
643
+ **`sembix profile list`**
319
644
 
320
- Your credentials are stored securely in:
321
- ~/.sembix/config
645
+ List all configured Studio profiles with authentication status.
322
646
 
323
- You can now run Sembix commands without the --token flag.
647
+ ```bash
648
+ sembix profile list
324
649
  ```
325
650
 
326
- ---
651
+ **`sembix profile show <name>`**
652
+
653
+ Show detailed information for a specific profile.
654
+
655
+ ```bash
656
+ sembix profile show production
657
+ ```
658
+
659
+ **`sembix profile set-default <name>`**
660
+
661
+ Set a profile as the default.
662
+
663
+ ```bash
664
+ sembix profile set-default production
665
+ ```
666
+
667
+ **`sembix profile delete <name>`**
668
+
669
+ Delete a profile and its stored tokens.
670
+
671
+ ```bash
672
+ sembix profile delete staging
673
+ ```
674
+
675
+ **`sembix profile set-default-project <profile> <project-id>`**
676
+
677
+ Set a default project for a profile (allows omitting `--project-id` in commands).
678
+
679
+ ```bash
680
+ sembix profile set-default-project production proj_abc123
681
+ ```
682
+
683
+ **`sembix profile get-default-project <profile>`**
684
+
685
+ Get the default project for a profile.
327
686
 
328
- ### `sembix studio create`
687
+ ```bash
688
+ sembix profile get-default-project production
689
+ ```
329
690
 
330
- Create a new Sembix Studio environment with complete configuration.
691
+ **`sembix profile clear-default-project <profile>`**
331
692
 
332
- **Syntax:**
693
+ Clear the default project for a profile.
333
694
 
334
695
  ```bash
335
- sembix studio create [environment-name] [options]
696
+ sembix profile clear-default-project production
336
697
  ```
337
698
 
338
- **Options:**
699
+ #### Project Commands
700
+
701
+ **`sembix project list`**
702
+
703
+ List and search projects in your Studio instance.
704
+
705
+ ```bash
706
+ # List all projects
707
+ sembix project list
708
+
709
+ # Filter by name
710
+ sembix project list --name "Production"
711
+
712
+ # With specific profile
713
+ sembix project list --profile production
714
+
715
+ # Pretty output
716
+ sembix project list --pretty
717
+ ```
718
+
719
+ **`sembix project show`**
720
+
721
+ Show details for a specific project.
722
+
723
+ ```bash
724
+ sembix project show --project-id proj_abc123
725
+ ```
726
+
727
+ #### Workflow Commands
728
+
729
+ **`sembix workflow start`**
730
+
731
+ Start a workflow instance (creates a new run).
732
+
733
+ ```bash
734
+ # Interactive mode (prompts for project, workflow, inputs)
735
+ sembix workflow start
736
+
737
+ # With project ID and workflow ID
738
+ sembix workflow start --project-id proj_123 --workflow-id wf_456
739
+
740
+ # With workflow name
741
+ sembix workflow start --project-id proj_123 --workflow-name "Deploy"
742
+
743
+ # With inline JSON inputs
744
+ sembix workflow start --project-id proj_123 --workflow-id wf_456 \
745
+ --inputs '{"environment":"production","version":"1.2.3"}'
746
+
747
+ # With inputs from file
748
+ sembix workflow start --project-id proj_123 --workflow-id wf_456 \
749
+ --inputs @inputs.json
750
+
751
+ # Using default project (set via profile set-default-project)
752
+ sembix workflow start --workflow-id wf_456 --inputs '{...}'
753
+ ```
754
+
755
+ **Options:**
756
+
757
+ - `-p, --profile <name>` - Profile to use
758
+ - `--project-id <id>` - Project ID (uses default if not specified)
759
+ - `--workflow-id <id>` - Workflow ID (OR use --workflow-name)
760
+ - `--workflow-name <name>` - Workflow name (OR use --workflow-id)
761
+ - `--inputs <json>` - Input variables as JSON string or @file.json
762
+ - `--workspace-id <id>` - Workspace ID (optional)
763
+ - `--issue-id <id>` - Issue ID (optional)
764
+ - `--no-interactive` - Disable interactive prompts
765
+
766
+ **`sembix workflow list`**
767
+
768
+ List workflow instances (definitions).
769
+
770
+ ```bash
771
+ # List all workflows
772
+ sembix workflow list
773
+
774
+ # Filter by project
775
+ sembix workflow list --project-id proj_123
776
+ ```
777
+
778
+ **`sembix workflow run list`**
779
+
780
+ List workflow runs (executions). Excludes sub-workflow runs by default.
781
+
782
+ ```bash
783
+ # List all runs
784
+ sembix workflow run list
785
+
786
+ # Filter by workflow
787
+ sembix workflow run list --workflow-id wf_456
788
+
789
+ # Filter by status
790
+ sembix workflow run list --status RUNNING
791
+
792
+ # Include sub-workflow runs
793
+ sembix workflow run list --include-subflows
794
+
795
+ # Pagination
796
+ sembix workflow run list --limit 20 --offset 10
797
+ ```
798
+
799
+ **`sembix workflow run status`**
800
+
801
+ Get the status of a workflow run.
802
+
803
+ ```bash
804
+ # Get current status
805
+ sembix workflow run status --workflow-id wf_456 --run-id run_789
806
+
807
+ # Watch until completion (polls every 5 seconds)
808
+ sembix workflow run status --workflow-id wf_456 --run-id run_789 --watch
809
+ ```
810
+
811
+ **`sembix workflow run show`**
812
+
813
+ Show full details of a specific workflow run.
814
+
815
+ ```bash
816
+ # Show run details
817
+ sembix workflow run show --workflow-id wf_456 --run-id run_789
818
+
819
+ # Watch until completion
820
+ sembix workflow run show --workflow-id wf_456 --run-id run_789 --watch
821
+ ```
822
+
823
+ **`sembix workflow run stop`**
824
+
825
+ Stop a running workflow.
826
+
827
+ ```bash
828
+ sembix workflow run stop --project-id proj_123 \
829
+ --workflow-id wf_456 --run-id run_789
830
+ ```
831
+
832
+ ---
833
+
834
+ ### Global Options
835
+
836
+ These options work with most commands:
837
+
838
+ #### `--token <token>` or `-t <token>`
839
+
840
+ Override the GitHub token from all other sources.
841
+
842
+ ```bash
843
+ sembix studio create --token ghp_custom_token
844
+ ```
845
+
846
+ **Credential Priority:**
847
+ 1. `--token` flag (highest)
848
+ 2. `GITHUB_TOKEN` environment variable
849
+ 3. `~/.sembix/config` (created by `sembix configure`)
850
+ 4. `.env` file (lowest)
851
+
852
+ #### `--profile <name>` or `-p <name>`
853
+
854
+ Specify which Studio profile to use for API commands.
855
+
856
+ ```bash
857
+ sembix workflow start --profile production
858
+ ```
859
+
860
+ #### `--output <format>` or `--pretty`
861
+
862
+ Set output format for command results.
863
+
864
+ **Values:**
865
+ - `json` (default) - Machine-readable JSON
866
+ - `pretty` - Pretty-printed JSON with colors
867
+ - `text` - Human-readable text (where supported)
868
+
869
+ ```bash
870
+ sembix project list --output pretty
871
+ # or shorthand:
872
+ sembix project list --pretty
873
+ ```
874
+
875
+ #### `--help` or `-h`
876
+
877
+ Display help information for a command.
878
+
879
+ ```bash
880
+ sembix --help
881
+ sembix studio --help
882
+ sembix studio create --help
883
+ ```
884
+
885
+ #### `--version` or `-V`
886
+
887
+ Display the CLI version.
888
+
889
+ ```bash
890
+ sembix --version
891
+ ```
892
+
893
+ ---
894
+
895
+ ### Environment Variables
896
+
897
+ Configure the CLI via `.env` file or system environment variables:
898
+
899
+ ```env
900
+ # GitHub Personal Access Token (required for deployment commands)
901
+ GITHUB_TOKEN=ghp_your_token_here
902
+
903
+ # Default GitHub organization (optional)
904
+ DEFAULT_GITHUB_ORG=your-org
905
+
906
+ # Studio API client credentials (for CI/CD)
907
+ SEMBIX_CLIENT_ID=7a8b9c0d1e2f3g4h
908
+ SEMBIX_CLIENT_SECRET=abcdef123456...
909
+ ```
910
+
911
+ ---
912
+
913
+ ### Exit Codes
914
+
915
+ - `0` - Success
916
+ - `1` - Error (validation failure, API error, user cancellation)
917
+
918
+ ---
919
+
920
+ ### <a name="sembix-studio-create-all-options"></a>`sembix studio create` - All Options
921
+
922
+ For reference, here's the complete list of all 50+ CLI flags for `sembix studio create`:
923
+
924
+ **General:**
925
+ - `-t, --token <token>` - GitHub personal access token
926
+ - `-c, --config <path>` - Path to YAML configuration file
927
+ - `-r, --repo <repo>` - Target repository (owner/repo format)
928
+ - `-e, --env <environment>` - Environment name
929
+
930
+ **AWS Basic Configuration:**
931
+ - `--aws-account-id <id>` - AWS Account ID (12 digits)
932
+ - `--aws-region <region>` - AWS Region (e.g., us-east-1)
933
+ - `--customer-role-arn <arn>` - GitHub Actions IAM role ARN
934
+ - `--terraform-state-bucket <bucket>` - S3 bucket for Terraform state
935
+
936
+ **Database:**
937
+ - `--database-name <name>` - PostgreSQL database name
938
+ - `--database-user <user>` - PostgreSQL database user
939
+
940
+ **Networking:**
941
+ - `--enable-vpc-endpoints <boolean>` - Enable VPC endpoints (true/false)
942
+ - `--use-custom-networking <boolean>` - Use existing VPC (true/false)
943
+ - `--vpc-cidr <cidr>` - VPC CIDR block (e.g., 10.0.0.0/16)
944
+ - `--public-subnet-cidrs <json>` - Public subnet CIDRs (JSON array)
945
+ - `--private-subnet-cidrs <json>` - Private subnet CIDRs (JSON array)
946
+ - `--az-count <count>` - Number of AZs (2 or 3)
947
+ - `--custom-vpc-id <id>` - Existing VPC ID
948
+ - `--custom-public-subnet-ids <ids>` - Existing public subnet IDs (comma-separated)
949
+ - `--custom-private-subnet-ids <ids>` - Existing private subnet IDs (comma-separated)
950
+
951
+ **Security - Security Groups:**
952
+ - `--use-custom-security-groups <boolean>` - Use custom security groups (true/false)
953
+ - `--sg-workflow-engine <id>` - Workflow Engine security group ID
954
+ - `--sg-aurora <id>` - Aurora database security group ID
955
+ - `--sg-rds-proxy <id>` - RDS Proxy security group ID
956
+ - `--sg-bff-ecs <id>` - BFF ECS service security group ID
957
+ - `--sg-bastion <id>` - Bastion host security group ID
958
+ - `--sg-bff-alb <id>` - BFF ALB security group ID
959
+
960
+ **Security - IAM Roles:**
961
+ - `--use-custom-iam-roles <boolean>` - Use custom IAM roles (true/false)
962
+ - `--iam-workflow-engine-exec <arn>` - Workflow Engine execution role ARN
963
+ - `--iam-workflow-engine-task <arn>` - Workflow Engine task role ARN
964
+ - `--iam-bff-ecs-exec <arn>` - BFF ECS task execution role ARN
965
+ - `--iam-bff-ecs-task <arn>` - BFF ECS task role ARN
966
+ - `--iam-rds-proxy <arn>` - RDS Proxy role ARN
967
+ - `--iam-studio-memory <arn>` - Studio Memory role ARN
968
+ - `--iam-studio-notification <arn>` - Studio Notification role ARN
969
+
970
+ **TLS/DNS:**
971
+ - `--cloudfront-domain <domain>` - CloudFront custom domain
972
+ - `--cloudfront-cert-arn <arn>` - CloudFront SSL certificate ARN (must be in us-east-1)
973
+ - `--bff-alb-cert-arn <arn>` - BFF ALB SSL certificate ARN
974
+ - `--hosted-zone-id <id>` - Route53 hosted zone ID
975
+
976
+ **Feature Flags:**
977
+ - `--deploy-studio-memory <boolean>` - Deploy Studio Memory service (true/false)
978
+ - `--deploy-studio-notifications <boolean>` - Deploy Studio Notifications (true/false)
979
+ - `--enable-bff-waf <boolean>` - Enable WAF for BFF (true/false)
980
+
981
+ **Frontend:**
982
+ - `--github-app-client-id <id>` - GitHub App OAuth client ID
983
+ - `--github-app-name <name>` - GitHub App name
984
+ - `--jira-client-id <id>` - Jira OAuth client ID
985
+
986
+ **Hub Integration (Step 9):**
987
+ - `--skip-hub` - Skip Hub integration configuration
988
+ - `--hub-engine-execution-role <arn>` - Hub Engine Execution Role ARN
989
+ - `--hub-consumer-role <arn>` - Hub Consumer Role ARN
990
+ - `--hub-admin-role <arn>` - Hub Admin Role ARN
991
+ - `--hub-appconfig-role <arn>` - Hub AppConfig Role ARN
992
+ - `--hub-appconfig-app-id <id>` - Hub AppConfig Application ID
993
+ - `--hub-appconfig-env-id <id>` - Hub AppConfig Environment ID
994
+ - `--hub-appconfig-profile-id <id>` - Hub AppConfig Profile ID
995
+
996
+ ---
997
+
998
+ ## Usage Examples
999
+
1000
+ Real-world examples showing different ways to use the CLI.
1001
+
1002
+ ### Basic Usage Patterns
1003
+
1004
+ #### 1. Fully Interactive (Beginner-Friendly)
1005
+
1006
+ Perfect for first-time users:
1007
+
1008
+ ```bash
1009
+ sembix studio create
1010
+ ```
1011
+
1012
+ **What happens:**
1013
+ - Prompts for repository selection
1014
+ - Prompts for environment name
1015
+ - Walks through all 9 configuration steps with explanations
1016
+ - Creates environment with all settings
1017
+
1018
+ #### 2. Specify Repository and Environment
1019
+
1020
+ Fast setup when you know both values:
1021
+
1022
+ ```bash
1023
+ sembix studio create production --repo acme-corp/sembix-deployment
1024
+ ```
1025
+
1026
+ **What happens:**
1027
+ - ✅ Validates repository exists
1028
+ - ✅ Validates environment name format
1029
+ - ✅ Checks environment doesn't already exist
1030
+ - Skips repository and name prompts
1031
+ - Walks through configuration steps
1032
+ - Creates environment
1033
+
1034
+ #### 3. Using Config Files
1035
+
1036
+ For repeatable, version-controlled setups:
1037
+
1038
+ ```bash
1039
+ # Create environment from config file
1040
+ sembix studio create --config production.yaml
1041
+
1042
+ # Override specific values
1043
+ sembix studio create --config base.yaml \
1044
+ --env custom-name \
1045
+ --aws-account-id 123456789012
1046
+ ```
1047
+
1048
+ ### Common Workflows
1049
+
1050
+ #### Workflow 1: First-Time Setup (Learning Mode)
1051
+
1052
+ ```bash
1053
+ # Step 1: Configure credentials
1054
+ sembix configure
1055
+
1056
+ # Step 2: Create environment interactively
1057
+ sembix studio create
1058
+
1059
+ # Follow all prompts, read explanations...
1060
+
1061
+ # Step 3: Deploy via GitHub Actions
1062
+ # Go to https://github.com/owner/repo/actions
1063
+ # Run deployment workflow
1064
+ # Copy Hub role ARNs from output
1065
+
1066
+ # Step 4: Add Hub integration
1067
+ sembix studio add-hub
1068
+
1069
+ # Select same repository and environment
1070
+ # Enter Hub role ARNs
1071
+ ```
1072
+
1073
+ #### Workflow 2: Experienced User (Fast Mode)
1074
+
1075
+ ```bash
1076
+ # Create with known values
1077
+ sembix studio create prod --repo acme/deploy
1078
+
1079
+ # Answer remaining prompts
1080
+ # ... deployment happens in GitHub Actions ...
1081
+
1082
+ # Add Hub with known values
1083
+ sembix studio add-hub prod --repo acme/deploy
1084
+
1085
+ # Enter Hub role ARNs
1086
+ ```
1087
+
1088
+ #### Workflow 3: CI/CD / Automation
1089
+
1090
+ For scripts and automation:
1091
+
1092
+ ```bash
1093
+ #!/bin/bash
1094
+
1095
+ REPO="acme-corp/sembix-deployment"
1096
+ ENV="client-${CLIENT_NAME}-production"
1097
+
1098
+ # Create environment (with config file)
1099
+ sembix studio create "${ENV}" \
1100
+ --repo "${REPO}" \
1101
+ --config base-config.yaml \
1102
+ --token "${GITHUB_TOKEN}"
1103
+
1104
+ # Later, after deployment...
1105
+ sembix studio add-hub "${ENV}" \
1106
+ --repo "${REPO}" \
1107
+ --token "${GITHUB_TOKEN}"
1108
+ ```
1109
+
1110
+ #### Workflow 4: Multiple Environments
1111
+
1112
+ Setting up multiple environments for the same repository:
1113
+
1114
+ ```bash
1115
+ # Production
1116
+ sembix studio create production --repo acme/deploy
1117
+
1118
+ # Staging
1119
+ sembix studio create staging --repo acme/deploy
1120
+
1121
+ # Development
1122
+ sembix studio create development --repo acme/deploy
1123
+
1124
+ # List all environments
1125
+ sembix studio list acme/deploy
1126
+ ```
1127
+
1128
+ ### Profile Management Examples
1129
+
1130
+ #### Working with Multiple Studio Instances
1131
+
1132
+ ```bash
1133
+ # Configure multiple profiles
1134
+ sembix configure # Profile name: production
1135
+ sembix configure # Profile name: staging
1136
+
1137
+ # Set default profile
1138
+ sembix profile set-default production
1139
+
1140
+ # Set default projects for each profile
1141
+ sembix profile set-default-project production proj_prod_123
1142
+ sembix profile set-default-project staging proj_stage_456
1143
+
1144
+ # List all profiles
1145
+ sembix profile list
1146
+
1147
+ # Login to each profile
1148
+ sembix login production
1149
+ sembix login staging
1150
+
1151
+ # Use different profiles for different workflows
1152
+ sembix workflow start --profile production --workflow-id wf_456
1153
+ sembix workflow start --profile staging --workflow-id wf_789
1154
+ ```
1155
+
1156
+ ### Error Handling Examples
1157
+
1158
+ #### Missing GitHub Token
1159
+
1160
+ ```bash
1161
+ $ sembix studio create
1162
+ ✗ GitHub token is required. Please provide it using one of these methods:
1163
+ 1. Run: sembix configure
1164
+ 2. Set GITHUB_TOKEN environment variable
1165
+ 3. Pass --token flag to the command
1166
+ ```
1167
+
1168
+ **Solution:**
1169
+
1170
+ ```bash
1171
+ sembix configure
1172
+ ```
1173
+
1174
+ #### Invalid Repository Format
1175
+
1176
+ ```bash
1177
+ $ sembix studio create prod --repo invalid_format
1178
+ ✗ Invalid repository format. Use: owner/repo
1179
+ ```
1180
+
1181
+ #### Repository Not Found
1182
+
1183
+ ```bash
1184
+ $ sembix studio create prod --repo nonexistent/repo
1185
+ ✗ Repository 'nonexistent/repo' not found or not accessible.
1186
+
1187
+ 💡 Make sure:
1188
+ • The repository name is correct (owner/repo)
1189
+ • Your GitHub token has access to this repository
1190
+ ```
1191
+
1192
+ #### Invalid Environment Name
1193
+
1194
+ ```bash
1195
+ $ sembix studio create "My Environment" --repo acme/deploy
1196
+ ✗ Invalid environment name. Must be lowercase letters, numbers, and hyphens (min 3 chars).
1197
+ ```
1198
+
1199
+ #### Environment Already Exists
1200
+
1201
+ ```bash
1202
+ $ sembix studio create production --repo acme/deploy
1203
+ ✗ Environment 'production' already exists in acme/deploy
1204
+
1205
+ 💡 Tip:
1206
+ • Use a different environment name
1207
+ • Or update the existing environment with: sembix studio update
1208
+ ```
1209
+
1210
+ #### Authentication Errors (Studio API)
1211
+
1212
+ ```bash
1213
+ # Error: Token expired
1214
+ $ sembix workflow start
1215
+ ✗ Authentication required. Please run: sembix login
1216
+ ```
1217
+
1218
+ **Solution:**
1219
+
1220
+ ```bash
1221
+ sembix login --profile production
1222
+ ```
1223
+
1224
+ ### Workflow Execution Patterns
1225
+
1226
+ #### Start and Monitor a Workflow
1227
+
1228
+ ```bash
1229
+ # Start workflow and capture run ID
1230
+ RUN_ID=$(sembix workflow start \
1231
+ --project-id proj_123 \
1232
+ --workflow-id wf_456 \
1233
+ --inputs '{"env":"production"}' \
1234
+ | grep "Run ID" | awk '{print $3}')
1235
+
1236
+ # Watch until completion
1237
+ sembix workflow run status \
1238
+ --workflow-id wf_456 \
1239
+ --run-id $RUN_ID \
1240
+ --watch
1241
+ ```
1242
+
1243
+ #### List Recent Failures
1244
+
1245
+ ```bash
1246
+ sembix workflow run list \
1247
+ --status FAILED \
1248
+ --limit 10
1249
+ ```
1250
+
1251
+ #### Monitor Specific Workflow
1252
+
1253
+ ```bash
1254
+ sembix workflow run list \
1255
+ --workflow-id wf_456 \
1256
+ --status RUNNING
1257
+ ```
1258
+
1259
+ #### Using Workflow Inputs from Files
1260
+
1261
+ ```bash
1262
+ # Create inputs.json
1263
+ cat > inputs.json <<EOF
1264
+ {
1265
+ "environment": "production",
1266
+ "version": "1.2.3",
1267
+ "config": {
1268
+ "debug": false,
1269
+ "replicas": 3
1270
+ }
1271
+ }
1272
+ EOF
1273
+
1274
+ # Use file in workflow start
1275
+ sembix workflow start \
1276
+ --project-id proj_123 \
1277
+ --workflow-id wf_456 \
1278
+ --inputs @inputs.json
1279
+ ```
1280
+
1281
+ ### Best Practices
1282
+
1283
+ #### ✅ DO
1284
+
1285
+ - Use `--repo` and `--env` for repeated operations
1286
+ - Validate with `sembix studio list` first
1287
+ - Use descriptive environment names (client-production, staging-v2)
1288
+ - Store GitHub token in `~/.sembix/config` via `sembix configure`
1289
+ - Keep environment names lowercase with hyphens
1290
+ - Use config files for version-controlled setups
1291
+ - Set default projects per profile for faster workflow execution
1292
+ - Use `--pretty` for human-readable output
1293
+ - Use `--watch` to monitor long-running workflows
1294
+
1295
+ #### ❌ DON'T
1296
+
1297
+ - Don't use uppercase in environment names
1298
+ - Don't use spaces or special characters
1299
+ - Don't share your GitHub token or client credentials
1300
+ - Don't create environments without verifying repo access first
1301
+ - Don't forget to run deployment between create and add-hub
1302
+ - Don't commit sensitive credentials to git
1303
+ - Don't use production credentials in development
1304
+
1305
+ ### CI/CD Integration Examples
1306
+
1307
+ #### GitHub Actions
1308
+
1309
+ ```yaml
1310
+ name: Deploy via Sembix
1311
+
1312
+ on:
1313
+ push:
1314
+ branches: [main]
1315
+
1316
+ jobs:
1317
+ deploy:
1318
+ runs-on: ubuntu-latest
1319
+ steps:
1320
+ - name: Install Sembix CLI
1321
+ run: npm install -g @sembix/cli
1322
+
1323
+ - name: Start Deployment Workflow
1324
+ env:
1325
+ SEMBIX_CLIENT_ID: ${{ secrets.SEMBIX_M2M_CLIENT_ID }}
1326
+ SEMBIX_CLIENT_SECRET: ${{ secrets.SEMBIX_M2M_CLIENT_SECRET }}
1327
+ run: |
1328
+ sembix workflow start \
1329
+ --profile production \
1330
+ --project-id ${{ vars.PROJECT_ID }} \
1331
+ --workflow-id ${{ vars.WORKFLOW_ID }} \
1332
+ --inputs '{"version":"${{ github.sha }}"}'
1333
+ ```
1334
+
1335
+ #### GitLab CI
1336
+
1337
+ ```yaml
1338
+ deploy:
1339
+ image: node:20
1340
+ script:
1341
+ - npm install -g @sembix/cli
1342
+ - |
1343
+ sembix workflow start \
1344
+ --profile production \
1345
+ --project-id ${PROJECT_ID} \
1346
+ --workflow-id ${WORKFLOW_ID} \
1347
+ --inputs "{\"version\":\"${CI_COMMIT_SHA}\"}"
1348
+ variables:
1349
+ SEMBIX_CLIENT_ID: ${M2M_CLIENT_ID}
1350
+ SEMBIX_CLIENT_SECRET: ${M2M_CLIENT_SECRET}
1351
+ ```
1352
+
1353
+ ### Output Formatting Examples
1354
+
1355
+ ```bash
1356
+ # JSON output (default) - for scripts/automation
1357
+ sembix project list --output json
1358
+
1359
+ # Pretty JSON - for human reading
1360
+ sembix project list --output pretty
1361
+ # or shorthand:
1362
+ sembix project list --pretty
1363
+
1364
+ # Text output - for terminal display
1365
+ sembix project list --output text
1366
+ ```
1367
+
1368
+ ### Quick Reference Cheat Sheet
1369
+
1370
+ ```bash
1371
+ # GitHub Deployment
1372
+ sembix configure # First-time setup
1373
+ sembix studio create # Interactive create
1374
+ sembix studio create prod --repo owner/repo # Quick create
1375
+ sembix studio add-hub prod --repo owner/repo # Add Hub integration
1376
+ sembix studio list owner/repo # List environments
1377
+
1378
+ # Studio API
1379
+ sembix configure # Configure profile
1380
+ sembix login # Authenticate
1381
+ sembix profile list # List profiles
1382
+ sembix profile set-default-project prod proj_123 # Set default project
1383
+
1384
+ # Projects & Workflows
1385
+ sembix project list # List projects
1386
+ sembix workflow start # Start workflow (interactive)
1387
+ sembix workflow run list # List workflow runs
1388
+ sembix workflow run status --workflow-id wf_456 --run-id run_789 --watch
1389
+
1390
+ # Troubleshooting
1391
+ sembix --version # Check CLI version
1392
+ sembix studio list owner/repo # Verify repo access
1393
+ sembix profile list # Check profile status
1394
+ sembix login --profile production # Re-authenticate
1395
+ ```
1396
+
1397
+ ## Studio CLI
1398
+
1399
+ The Sembix CLI now supports direct integration with Sembix Studio instances for workflow execution and management.
1400
+
1401
+ ### Studio Configuration
1402
+
1403
+ Configure a Studio profile to connect to a Sembix Studio instance using the unified configure command:
1404
+
1405
+ ```bash
1406
+ sembix configure
1407
+ ```
1408
+
1409
+ This interactive command will first prompt for GitHub credentials, then optionally prompt you to configure a Studio profile with:
1410
+ - **Profile name** (default: "default")
1411
+ - **Studio API URL** (e.g., https://studio.example.com)
1412
+ - **Cognito User Pool ID** (e.g., us-east-1_ABC123)
1413
+ - **Cognito Client ID**
1414
+ - **Cognito Region**
1415
+ - **Cognito Domain** (e.g., https://auth.example.com)
1416
+
1417
+ ### Authentication
1418
+
1419
+ The Sembix CLI supports two authentication methods:
1420
+ 1. **Browser-based OAuth** - For developers on local machines
1421
+ 2. **Client Credentials** - For CI/CD pipelines and automated workflows
1422
+
1423
+ #### Local Development (Browser-based OAuth)
1424
+
1425
+ Authenticate with a Studio instance using browser-based OAuth:
1426
+
1427
+ ```bash
1428
+ # Login to default profile
1429
+ sembix login
1430
+
1431
+ # Login to specific profile
1432
+ sembix login --profile production
1433
+
1434
+ # Logout from profile
1435
+ sembix logout --profile production
1436
+
1437
+ # Logout from all profiles
1438
+ sembix logout --all
1439
+ ```
1440
+
1441
+ **What happens during login:**
1442
+ 1. Opens your default browser to Cognito hosted UI
1443
+ 2. You authenticate with your Studio credentials
1444
+ 3. Tokens are securely stored in `~/.sembix/tokens/<profile>.json`
1445
+ 4. Tokens are automatically refreshed when expired
1446
+
1447
+ #### CI/CD Pipelines (Client Credentials)
1448
+
1449
+ For automated workflows, use OAuth 2.0 Client Credentials flow:
1450
+
1451
+ **Prerequisites:**
1452
+ - Obtain M2M (machine-to-machine) client credentials from your administrator:
1453
+ - Client ID (e.g., `7a8b9c0d1e2f3g4h`)
1454
+ - Client Secret (keep secure!)
1455
+ - Required OAuth scopes:
1456
+ - `sembix-api/projects.read` - List projects
1457
+ - `sembix-api/workflows.read` - View workflows and runs
1458
+ - `sembix-api/workflows.execute` - Start/stop workflows
1459
+
1460
+ **Setup:**
1461
+
1462
+ 1. **Add credentials to your CI/CD secrets:**
1463
+
1464
+ GitHub Actions:
1465
+ ```yaml
1466
+ # In repository settings → Secrets and variables → Actions
1467
+ SEMBIX_CLIENT_ID=7a8b9c0d1e2f3g4h5i6j7k8l
1468
+ SEMBIX_CLIENT_SECRET=abcdef123456...
1469
+ ```
1470
+
1471
+ GitLab CI:
1472
+ ```yaml
1473
+ # In repository settings → CI/CD → Variables
1474
+ SEMBIX_CLIENT_ID=7a8b9c0d1e2f3g4h5i6j7k8l
1475
+ SEMBIX_CLIENT_SECRET=abcdef123456...
1476
+ ```
1477
+
1478
+ 2. **Use in your workflow:**
1479
+
1480
+ ```yaml
1481
+ - name: Start workflow
1482
+ env:
1483
+ SEMBIX_CLIENT_ID: ${{ secrets.SEMBIX_M2M_CLIENT_ID }}
1484
+ SEMBIX_CLIENT_SECRET: ${{ secrets.SEMBIX_M2M_CLIENT_SECRET }}
1485
+ run: |
1486
+ sembix workflow start \
1487
+ --project-id abc123 \
1488
+ --workflow-id def456 \
1489
+ --inputs '{"key": "value"}'
1490
+ ```
1491
+
1492
+ **How it works:**
1493
+ - The CLI automatically detects `SEMBIX_CLIENT_ID` and `SEMBIX_CLIENT_SECRET` environment variables
1494
+ - Authenticates using OAuth 2.0 Client Credentials flow
1495
+ - No browser or interactive login needed
1496
+ - Tokens obtained on-demand (not stored)
1497
+
1498
+ **Testing credentials locally:**
1499
+ ```bash
1500
+ export SEMBIX_CLIENT_ID="your-client-id"
1501
+ export SEMBIX_CLIENT_SECRET="your-client-secret"
1502
+
1503
+ # Verify credentials work
1504
+ sembix login
1505
+ # Output: "Client credentials detected... Client credentials are valid!"
1506
+ ```
1507
+
1508
+ **Security best practices:**
1509
+ - Never commit credentials to git
1510
+ - Use CI/CD secret management (GitHub Secrets, AWS Secrets Manager, etc.)
1511
+ - Rotate client secrets regularly (every 90 days recommended)
1512
+ - Use separate credentials for different environments (dev, staging, prod)
1513
+
1514
+ See the [CI/CD Setup Guide](./docs/CI-CD-SETUP.md) for complete examples and troubleshooting.
1515
+
1516
+ ### Profile Management
1517
+
1518
+ Manage Studio profiles:
1519
+
1520
+ ```bash
1521
+ # List all profiles
1522
+ sembix profile list
1523
+
1524
+ # Show profile details
1525
+ sembix profile show production
1526
+
1527
+ # Set default profile
1528
+ sembix profile set-default production
1529
+
1530
+ # Delete profile
1531
+ sembix profile delete staging
1532
+ ```
1533
+
1534
+ **Profile list output:**
1535
+ ```
1536
+ Sembix Studio Profiles
1537
+
1538
+ Name API URL Auth Status
1539
+ ──────────────────────────────────────────────────────
1540
+ * default https://studio.example.com ✓ Authenticated
1541
+ production https://prod.example.com ✗ Not authenticated
1542
+ staging https://staging.example.com ✓ Authenticated
1543
+
1544
+ * = default profile
1545
+ ```
1546
+
1547
+ ### Profile Project Defaults
1548
+
1549
+ Set default projects for profiles to avoid specifying `--project-id` repeatedly.
1550
+
1551
+ **Set default project:**
1552
+ ```bash
1553
+ sembix profile set-default-project <profile> <project-id>
1554
+
1555
+ # Example
1556
+ sembix profile set-default-project production proj_abc123
1557
+ ```
1558
+
1559
+ **Get default project:**
1560
+ ```bash
1561
+ sembix profile get-default-project <profile>
1562
+
1563
+ # Example
1564
+ sembix profile get-default-project production
1565
+ # Output: proj_abc123
1566
+ ```
1567
+
1568
+ **Clear default project:**
1569
+ ```bash
1570
+ sembix profile clear-default-project <profile>
1571
+
1572
+ # Example
1573
+ sembix profile clear-default-project production
1574
+ ```
1575
+
1576
+ **Usage with workflow commands:**
1577
+ ```bash
1578
+ # Set default project
1579
+ sembix profile set-default-project production proj_abc123
1580
+
1581
+ # Now you can omit --project-id
1582
+ sembix workflow start --workflow-id wf_456 --inputs '{...}'
1583
+ # Uses proj_abc123 automatically
1584
+ ```
1585
+
1586
+ ### Project Management
1587
+
1588
+ List and view projects in your Studio instance.
1589
+
1590
+ **List all projects:**
1591
+ ```bash
1592
+ # List all projects
1593
+ sembix project list
1594
+
1595
+ # Filter by name
1596
+ sembix project list --name "My Project"
1597
+
1598
+ # Filter by IDs
1599
+ sembix project list --ids "proj_123,proj_456"
1600
+
1601
+ # With specific profile
1602
+ sembix project list --profile production
1603
+ ```
1604
+
1605
+ **Show project details:**
1606
+ ```bash
1607
+ sembix project show --project-id proj_abc123
1608
+
1609
+ # With specific profile
1610
+ sembix project show --project-id proj_abc123 --profile production
1611
+ ```
1612
+
1613
+ **Output:**
1614
+ ```json
1615
+ {
1616
+ "projectId": "proj_abc123",
1617
+ "name": "My Project",
1618
+ "description": "Project description",
1619
+ "state": "ACTIVE",
1620
+ "createdAt": "2024-01-15T10:00:00Z",
1621
+ "workflowPackConfigured": true
1622
+ }
1623
+ ```
1624
+
1625
+ ### Workflow Operations
1626
+
1627
+ Execute and manage workflows:
1628
+
1629
+ #### Start a Workflow
1630
+
1631
+ ```bash
1632
+ # Interactive mode (prompts for project, workflow, and inputs)
1633
+ sembix workflow start
1634
+
1635
+ # With project ID and workflow ID
1636
+ sembix workflow start --project-id abc123 --workflow-id def456
1637
+
1638
+ # With workflow name instead of ID
1639
+ sembix workflow start --project-id abc123 --workflow-name "Deploy to Production"
1640
+
1641
+ # Start with inline JSON inputs
1642
+ sembix workflow start --project-id abc123 --workflow-id def456 --inputs '{"key": "value"}'
1643
+
1644
+ # Start with inputs from file
1645
+ sembix workflow start --project-id abc123 --workflow-id def456 --inputs @inputs.json
1646
+
1647
+ # Non-interactive mode (skip prompts)
1648
+ sembix workflow start --project-id abc123 --workflow-id def456 --no-interactive
1649
+
1650
+ # Using default project (set via profile set-default-project)
1651
+ sembix workflow start --workflow-id def456 --inputs '{...}'
339
1652
 
340
- ```bash
341
- # General
342
- -t, --token <token> GitHub personal access token
343
- -c, --config <path> Path to YAML configuration file
344
- -r, --repo <repo> Target repository (owner/repo format)
345
- -e, --env <environment> Environment name (alternative to positional arg)
1653
+ # Start with workspace and issue context
1654
+ sembix workflow start \
1655
+ --project-id abc123 \
1656
+ --workflow-id def456 \
1657
+ --workspace-id ws-789 \
1658
+ --issue-id issue-101 \
1659
+ --inputs '{"param": "value"}'
346
1660
 
347
- # AWS Basic Configuration
348
- --aws-account-id <id> AWS Account ID (12 digits)
349
- --aws-region <region> AWS Region (e.g., us-east-1)
350
- --customer-role-arn <arn> GitHub Actions IAM role ARN
351
- --terraform-state-bucket <bucket> S3 bucket for Terraform state
1661
+ # Use specific profile
1662
+ sembix workflow start \
1663
+ --profile production \
1664
+ --project-id abc123 \
1665
+ --workflow-id def456 \
1666
+ --inputs '{"key": "value"}'
1667
+ ```
352
1668
 
353
- # Database
354
- --database-name <name> PostgreSQL database name
355
- --database-user <user> PostgreSQL database user
1669
+ **Example inputs.json:**
1670
+ ```json
1671
+ {
1672
+ "inputVariables": {
1673
+ "repositoryUrl": "https://github.com/acme/repo",
1674
+ "branch": "main"
1675
+ },
1676
+ "workspaceId": "ws-123",
1677
+ "workspaceName": "My Workspace",
1678
+ "issueId": "issue-456",
1679
+ "issueKey": "PROJ-123"
1680
+ }
1681
+ ```
356
1682
 
357
- # Networking
358
- --enable-vpc-endpoints <boolean> Enable VPC endpoints (true/false)
359
- --use-custom-networking <boolean> Use existing VPC (true/false)
360
- --vpc-cidr <cidr> VPC CIDR block (e.g., 10.0.0.0/16)
361
- --public-subnet-cidrs <json> Public subnet CIDRs (JSON array)
362
- --private-subnet-cidrs <json> Private subnet CIDRs (JSON array)
363
- --az-count <count> Number of AZs (2 or 3)
364
- --custom-vpc-id <id> Existing VPC ID
365
- --custom-public-subnet-ids <ids> Existing public subnet IDs (comma-separated)
366
- --custom-private-subnet-ids <ids> Existing private subnet IDs (comma-separated)
1683
+ #### Check Workflow Status
367
1684
 
368
- # Security - Security Groups
369
- --use-custom-security-groups <boolean> Use custom security groups (true/false)
370
- --sg-workflow-engine <id> Workflow Engine security group ID
371
- --sg-aurora <id> Aurora database security group ID
372
- --sg-rds-proxy <id> RDS Proxy security group ID
373
- --sg-bff-ecs <id> BFF ECS service security group ID
374
- --sg-bastion <id> Bastion host security group ID
375
- --sg-bff-alb <id> BFF ALB security group ID
1685
+ ```bash
1686
+ # Get current status
1687
+ sembix workflow run status --workflow-id wf_456 --run-id run_789
376
1688
 
377
- # Security - IAM Roles
378
- --use-custom-iam-roles <boolean> Use custom IAM roles (true/false)
379
- --iam-workflow-engine-exec <arn> Workflow Engine execution role ARN
380
- --iam-workflow-engine-task <arn> Workflow Engine task role ARN
381
- --iam-bff-ecs-exec <arn> BFF ECS task execution role ARN
382
- --iam-bff-ecs-task <arn> BFF ECS task role ARN
383
- --iam-rds-proxy <arn> RDS Proxy role ARN
384
- --iam-studio-memory <arn> Studio Memory role ARN
385
- --iam-studio-notification <arn> Studio Notification role ARN
1689
+ # Watch workflow until completion (polls every 5 seconds)
1690
+ sembix workflow run status --workflow-id wf_456 --run-id run_789 --watch
1691
+ ```
386
1692
 
387
- # TLS/DNS
388
- --cloudfront-domain <domain> CloudFront custom domain
389
- --cloudfront-cert-arn <arn> CloudFront SSL certificate ARN (must be in us-east-1)
390
- --bff-alb-cert-arn <arn> BFF ALB SSL certificate ARN
391
- --hosted-zone-id <id> Route53 hosted zone ID
392
-
393
- # Feature Flags
394
- --deploy-studio-memory <boolean> Deploy Studio Memory service (true/false)
395
- --deploy-studio-notifications <boolean> Deploy Studio Notifications (true/false)
396
- --enable-bff-waf <boolean> Enable WAF for BFF (true/false)
397
-
398
- # Frontend
399
- --github-app-client-id <id> GitHub App OAuth client ID
400
- --github-app-name <name> GitHub App name
401
- --jira-client-id <id> Jira OAuth client ID
402
-
403
- # Hub Integration (Step 9)
404
- --skip-hub Skip Hub integration configuration
405
- --hub-engine-execution-role <arn> Hub Engine Execution Role ARN
406
- --hub-consumer-role <arn> Hub Consumer Role ARN
407
- --hub-admin-role <arn> Hub Admin Role ARN
408
- --hub-appconfig-role <arn> Hub AppConfig Role ARN
409
- --hub-appconfig-app-id <id> Hub AppConfig Application ID
410
- --hub-appconfig-env-id <id> Hub AppConfig Environment ID
411
- --hub-appconfig-profile-id <id> Hub AppConfig Profile ID
1693
+ **Status output:**
1694
+ ```
1695
+ Workflow Run Status
1696
+
1697
+ Run ID: run-789
1698
+ Workflow ID: def456
1699
+ Status: RUNNING
1700
+ Progress: 45%
1701
+ Created: 2024-01-15 10:30:00
1702
+ Creator: user-123
412
1703
  ```
413
1704
 
414
- **Examples:**
1705
+ #### List Workflow Runs
415
1706
 
416
1707
  ```bash
417
- # Interactive mode (prompts for everything)
418
- sembix studio create
1708
+ # List workflow instances (definitions)
1709
+ sembix workflow list
419
1710
 
420
- # Specify environment name
421
- sembix studio create production
1711
+ # Filter by project
1712
+ sembix workflow list --project-id proj_123
422
1713
 
423
- # With repository
424
- sembix studio create production --repo acme/deploy
1714
+ # Filter by template IDs
1715
+ sembix workflow list --workflow-template-ids "tmpl_1,tmpl_2"
425
1716
 
426
- # Using config file
427
- sembix studio create --config production.yaml
1717
+ # Show workflow instance details
1718
+ sembix workflow show --project-id proj_123 --workflow-id wf_456
428
1719
 
429
- # Config file with overrides
430
- sembix studio create --config base.yaml \
431
- --env client-abc-production \
432
- --aws-account-id 123456789012
1720
+ # List workflow runs (executions) - excludes subflows by default
1721
+ sembix workflow run list
433
1722
 
434
- # Skip Hub integration (add later)
435
- sembix studio create production --repo acme/deploy --skip-hub
1723
+ # Filter by workflow
1724
+ sembix workflow run list --workflow-id wf_456
436
1725
 
437
- # Fully automated with all flags
438
- sembix studio create production \
439
- --repo acme/deploy \
440
- --aws-account-id 123456789012 \
441
- --aws-region us-east-1 \
442
- --customer-role-arn arn:aws:iam::123456789012:role/Deploy \
443
- --terraform-state-bucket my-tf-state \
444
- --database-name sembix_studio \
445
- --database-user sembix_studio_user \
446
- --cloudfront-domain studio.acme.com \
447
- --cloudfront-cert-arn arn:aws:acm:us-east-1:123456789012:certificate/abc \
448
- --bff-alb-cert-arn arn:aws:acm:us-east-1:123456789012:certificate/def \
449
- --hosted-zone-id Z1234567890ABC \
450
- --github-app-client-id Iv1.0123456789abcdef \
451
- --github-app-name sembix-studio-app \
452
- --jira-client-id abc123def456
453
- ```
1726
+ # Filter by project
1727
+ sembix workflow run list --project-id proj_123
454
1728
 
455
- **What it does:**
1729
+ # Filter by status
1730
+ sembix workflow run list --status RUNNING
456
1731
 
457
- 1. Validates repository and environment name
458
- 2. Walks through 9 configuration steps (or uses provided config):
459
- - Repository selection
460
- - Basic AWS configuration
461
- - Database configuration
462
- - Networking (VPC, subnets)
463
- - Security (security groups, IAM roles, KMS)
464
- - DNS & TLS (CloudFront, ALB certificates)
465
- - Feature flags (Memory, Notifications, WAF)
466
- - Frontend configuration (GitHub App, Jira)
467
- - **Hub integration (optional)**
468
- 3. Creates GitHub Actions environment
469
- 4. Sets environment variables and encrypted secrets
470
- 5. Provides next steps for deployment
1732
+ # Include sub-workflow runs
1733
+ sembix workflow run list --include-subflows
471
1734
 
472
- ### `sembix studio update`
1735
+ # Filter to top-level runs only
1736
+ sembix workflow run list --parent-id NULL
473
1737
 
474
- Update an existing Sembix Studio environment.
1738
+ # Pagination
1739
+ sembix workflow run list --limit 20 --offset 10
475
1740
 
476
- **Syntax:**
1741
+ # Show specific run details
1742
+ sembix workflow run show --workflow-id wf_456 --run-id run_789
477
1743
 
478
- ```bash
479
- sembix studio update [environment-name] [options]
1744
+ # Watch run details until completion
1745
+ sembix workflow run show --workflow-id wf_456 --run-id run_789 --watch
480
1746
  ```
481
1747
 
482
- **Options:** Same as `create` command
1748
+ **List output:**
1749
+ ```
1750
+ Workflow Runs
483
1751
 
484
- **Examples:**
1752
+ Run ID Workflow ID Status Progress Created
1753
+ ────────────────────────────────────────────────────────
1754
+ run-789 def456 RUNNING 45% 2 hours ago
1755
+ run-788 def456 COMPLETED 100% 1 day ago
1756
+ run-787 abc123 FAILED 30% 2 days ago
485
1757
 
486
- ```bash
487
- # Interactive update (re-prompts for all config)
488
- sembix studio update production --repo acme/deploy
1758
+ Showing 1-3 of 15 results
1759
+ ```
489
1760
 
490
- # Add Hub integration to existing environment
491
- sembix studio update production --repo acme/deploy \
492
- --hub-engine-execution-role arn:aws:iam::123456789012:role/HubEngine \
493
- --hub-consumer-role arn:aws:iam::123456789012:role/HubConsumer \
494
- --hub-admin-role arn:aws:iam::123456789012:role/HubAdmin
1761
+ #### Stop a Workflow Run
495
1762
 
496
- # Update specific fields only
497
- sembix studio update production --repo acme/deploy \
498
- --deploy-studio-memory true \
499
- --enable-bff-waf true
1763
+ ```bash
1764
+ sembix workflow run stop --project-id proj_123 --workflow-id wf_456 --run-id run_789
1765
+ ```
500
1766
 
501
- # Update via config file
502
- sembix studio update --config production-updates.yaml
1767
+ ### Common Workflow Patterns
503
1768
 
504
- # Update database credentials
505
- sembix studio update production --repo acme/deploy \
506
- --database-name new_db_name \
507
- --database-user new_db_user
1769
+ **1. Start and monitor a workflow:**
1770
+ ```bash
1771
+ # Start workflow and capture run ID
1772
+ RUN_ID=$(sembix workflow start \
1773
+ --project-id abc123 \
1774
+ --workflow-id def456 \
1775
+ --inputs '{"key": "value"}' \
1776
+ | grep "Run ID" | awk '{print $3}')
1777
+
1778
+ # Watch until completion
1779
+ sembix workflow run status \
1780
+ --workflow-id def456 \
1781
+ --run-id $RUN_ID \
1782
+ --watch
508
1783
  ```
509
1784
 
510
- **What it does:**
1785
+ **2. List recent failures:**
1786
+ ```bash
1787
+ sembix workflow run list \
1788
+ --status FAILED \
1789
+ --limit 10
1790
+ ```
511
1791
 
512
- - Validates environment exists
513
- - Updates only the fields you provide (partial updates)
514
- - Interactive mode re-collects all configuration
515
- - Preserves existing settings for fields not specified
1792
+ **3. Monitor specific workflow:**
1793
+ ```bash
1794
+ sembix workflow run list \
1795
+ --workflow-id def456 \
1796
+ --status RUNNING
1797
+ ```
516
1798
 
517
- ### `sembix studio list`
1799
+ ### Output Formatting
518
1800
 
519
- List GitHub Actions environments in a repository.
1801
+ Control output format for all commands using global flags.
1802
+
1803
+ **Available formats:**
1804
+ - `json` (default) - Machine-readable JSON output
1805
+ - `pretty` - Pretty-printed JSON with colors and indentation
1806
+ - `text` - Human-readable text output (where applicable)
520
1807
 
521
- **Syntax:**
1808
+ **Usage:**
522
1809
 
523
1810
  ```bash
524
- sembix studio list [repository] [options]
1811
+ # JSON output (default)
1812
+ sembix workflow run list --workflow-id wf_456
1813
+
1814
+ # Pretty-printed JSON
1815
+ sembix workflow run list --workflow-id wf_456 --output pretty
1816
+ # or shorthand:
1817
+ sembix workflow run list --workflow-id wf_456 --pretty
1818
+
1819
+ # Text output
1820
+ sembix project list --output text
525
1821
  ```
526
1822
 
527
1823
  **Examples:**
528
1824
 
529
1825
  ```bash
530
- # List all your repositories
531
- sembix studio list
532
-
533
- # List environments in specific repository
534
- sembix studio list acme-corp/sembix-deployment
1826
+ # JSON (default) - for scripts/automation
1827
+ $ sembix project show --project-id proj_123
1828
+ {"projectId":"proj_123","name":"My Project","state":"ACTIVE",...}
1829
+
1830
+ # Pretty JSON - for human reading
1831
+ $ sembix project show --project-id proj_123 --pretty
1832
+ {
1833
+ "projectId": "proj_123",
1834
+ "name": "My Project",
1835
+ "state": "ACTIVE",
1836
+ ...
1837
+ }
535
1838
 
536
- # With custom token
537
- sembix studio list acme/deploy --token ghp_custom_token
1839
+ # Text - for terminal display
1840
+ $ sembix project list --output text
1841
+ Projects:
1842
+ 1. My Project (proj_123) - ACTIVE
1843
+ 2. Another Project (proj_456) - ACTIVE
538
1844
  ```
539
1845
 
540
- ### `sembix studio add-hub`
1846
+ **Global flags:**
1847
+ - `--output <format>` - Set output format: json, pretty, or text
1848
+ - `--pretty` - Shorthand for `--output pretty`
541
1849
 
542
- Add Sembix Hub integration to an existing Studio environment. **This is typically used in Phase 2 of the deployment process** after receiving Hub role ARNs from Sembix support.
1850
+ ### Error Handling
543
1851
 
544
- **Syntax:**
1852
+ **Authentication errors:**
545
1853
  ```bash
546
- sembix studio add-hub [environment] [options]
1854
+ # If you see "Authentication required" or "Token expired"
1855
+ sembix login --profile production
547
1856
  ```
548
1857
 
549
- **Options:**
550
- - `-r, --repo <repo>` - Target repository (owner/repo format)
551
- - `-e, --env <environment>` - Environment name (alternative to positional argument)
552
- - `--hub-engine-execution-role <arn>` - Hub Engine Execution Role ARN (from Sembix support)
553
- - `--hub-consumer-role <arn>` - Hub Consumer Role ARN (from Sembix support)
554
- - `--hub-admin-role <arn>` - Hub Admin Role ARN (from Sembix support)
555
- - `--hub-appconfig-role <arn>` - Hub AppConfig Role ARN (from Sembix support)
556
- - `--hub-appconfig-app-id <id>` - Hub AppConfig Application ID (from Sembix support)
557
- - `--hub-appconfig-env-id <id>` - Hub AppConfig Environment ID (from Sembix support)
558
- - `--hub-appconfig-profile-id <id>` - Hub AppConfig Profile ID (from Sembix support)
559
-
560
- **Example:**
1858
+ **Profile not found:**
561
1859
  ```bash
562
- # Interactive mode (prompts for ARNs)
563
- sembix studio add-hub production --repo acme/deploy
564
-
565
- # With CLI flags (using ARNs from Sembix support)
566
- sembix studio add-hub production \
567
- --repo acme/deploy \
568
- --hub-engine-execution-role arn:aws:iam::999888777666:role/HubEngineRole \
569
- --hub-consumer-role arn:aws:iam::999888777666:role/HubConsumerRole \
570
- --hub-admin-role arn:aws:iam::999888777666:role/HubAdminRole \
571
- --hub-appconfig-role arn:aws:iam::999888777666:role/HubAppConfigRole \
572
- --hub-appconfig-app-id abc123 \
573
- --hub-appconfig-env-id def456 \
574
- --hub-appconfig-profile-id ghi789
1860
+ # Configure the profile first
1861
+ sembix configure
1862
+ # Choose to configure Studio profile with name: production
575
1863
  ```
576
1864
 
577
- **When to use this command:**
578
-
579
- - **Phase 2 deployment** (recommended): After completing Phase 1 bootstrap deployment and receiving Hub ARNs from Sembix support
580
- - **Alternative**: Hub integration can also be added during initial environment creation (Step 9 of `create`) if you already have the Hub ARNs
581
- - **Updates**: Use the `update` command to modify existing Hub configuration
582
-
583
- **Important:** The Hub role ARNs are provided by Sembix support after they configure the Hub to trust your AWS account. Do not use this command until you have received these ARNs.
1865
+ **Invalid inputs:**
1866
+ ```bash
1867
+ # Validate your JSON syntax
1868
+ cat inputs.json | jq .
1869
+ ```
584
1870
 
585
1871
  ## Workflow
586
1872
 
@@ -848,61 +2134,438 @@ studio
848
2134
 
849
2135
  ## Troubleshooting
850
2136
 
851
- ### "GitHub token is required"
2137
+ Comprehensive troubleshooting guide for common issues.
2138
+
2139
+ ### Authentication Issues
852
2140
 
853
- If you see this error, you need to configure your GitHub token. The easiest method is:
2141
+ #### "GitHub token is required"
854
2142
 
2143
+ **Error:**
2144
+ ```
2145
+ ✗ GitHub token is required. Please provide it using one of these methods:
2146
+ 1. Run: sembix configure
2147
+ 2. Set GITHUB_TOKEN environment variable
2148
+ 3. Pass --token flag to the command
2149
+ ```
2150
+
2151
+ **Solution:**
855
2152
  ```bash
2153
+ # Easiest method (recommended)
856
2154
  sembix configure
2155
+
2156
+ # Alternative: Create .env file
2157
+ echo "GITHUB_TOKEN=ghp_your_token_here" > .env
2158
+
2159
+ # Or pass token directly
2160
+ sembix studio create --token ghp_your_token_here
857
2161
  ```
858
2162
 
859
- Alternatively, create a `.env` file:
2163
+ #### "Failed to create environment: Bad credentials"
860
2164
 
861
- ```env
862
- GITHUB_TOKEN=ghp_your_token_here
2165
+ **Cause:** GitHub token is invalid or missing required scopes.
2166
+
2167
+ **Solution:**
2168
+ 1. Create a new Personal Access Token at: https://github.com/settings/tokens
2169
+ 2. Required scopes:
2170
+ - ✅ `repo` (all sub-scopes)
2171
+ - ✅ `workflow`
2172
+ 3. Update your configuration:
2173
+ ```bash
2174
+ sembix configure
863
2175
  ```
864
2176
 
865
- Or pass the token directly via CLI:
2177
+ #### "Authentication required" (Studio API)
2178
+
2179
+ **Error:**
2180
+ ```
2181
+ ✗ Authentication required. Please run: sembix login
2182
+ ```
866
2183
 
2184
+ **Solution:**
867
2185
  ```bash
868
- sembix studio create --token ghp_your_token_here
2186
+ # Login with default profile
2187
+ sembix login
2188
+
2189
+ # Or specific profile
2190
+ sembix login --profile production
2191
+
2192
+ # If tokens expired, re-authenticate
2193
+ sembix logout --profile production
2194
+ sembix login --profile production
869
2195
  ```
870
2196
 
871
- ### "Failed to create environment: Bad credentials"
2197
+ #### Browser did not open (Studio login)
2198
+
2199
+ **Error:** Browser window doesn't open during `sembix login`
872
2200
 
873
- Your GitHub token may be invalid or missing required scopes. Create a new token with `repo` and `workflow` scopes.
2201
+ **Solution:**
2202
+ 1. Manually copy the URL displayed in terminal
2203
+ 2. Open it in your browser
2204
+ 3. Complete authentication within 5 minutes
2205
+ 4. If timeout occurs, run `sembix login` again
874
2206
 
875
- ### "Failed to encrypt secret"
2207
+ ### GitHub API Issues
876
2208
 
877
- The `libsodium-wrappers` library is required for encrypting GitHub secrets. Make sure dependencies are installed:
2209
+ #### "No repositories found"
878
2210
 
2211
+ **Cause:** GitHub token doesn't have access to repositories.
2212
+
2213
+ **Solution:**
2214
+ 1. Verify token has `repo` scope
2215
+ 2. Check organization access:
2216
+ - GitHub Settings → Personal Access Tokens → Your token → Configure SSO (if applicable)
2217
+ - Click "Authorize" for your organization
2218
+ 3. Verify repository name is correct (use `owner/repo` format)
2219
+
2220
+ #### "Repository not found or not accessible"
2221
+
2222
+ **Error:**
2223
+ ```
2224
+ ✗ Repository 'owner/repo' not found or not accessible.
2225
+ ```
2226
+
2227
+ **Solution:**
879
2228
  ```bash
880
- npm install
2229
+ # Verify repository name format
2230
+ sembix studio list # Lists accessible repositories
2231
+
2232
+ # Check token permissions
2233
+ # Go to: https://github.com/settings/tokens
2234
+ # Ensure 'repo' scope is enabled
2235
+
2236
+ # If using organization repos, configure SSO
2237
+ ```
2238
+
2239
+ #### "Environment already exists"
2240
+
2241
+ **Error:**
2242
+ ```
2243
+ ✗ Environment 'production' already exists in owner/repo
2244
+ ```
2245
+
2246
+ **Solution:**
2247
+ ```bash
2248
+ # Option 1: Update existing environment
2249
+ sembix studio update production --repo owner/repo
2250
+
2251
+ # Option 2: Use different environment name
2252
+ sembix studio create production-v2 --repo owner/repo
2253
+
2254
+ # Option 3: Delete and recreate (not recommended)
2255
+ # Delete manually in GitHub UI, then:
2256
+ sembix studio create production --repo owner/repo
2257
+ ```
2258
+
2259
+ ### Studio API Issues
2260
+
2261
+ #### "Profile not found"
2262
+
2263
+ **Error:**
2264
+ ```
2265
+ ✗ Profile 'production' not found
2266
+ ```
2267
+
2268
+ **Solution:**
2269
+ ```bash
2270
+ # List configured profiles
2271
+ sembix profile list
2272
+
2273
+ # Configure the profile
2274
+ sembix configure
2275
+ # Choose to configure Studio profile with name: production
2276
+ ```
2277
+
2278
+ #### "Cannot connect to Studio API"
2279
+
2280
+ **Error:** Connection refused or timeout errors
2281
+
2282
+ **Solution:**
2283
+ 1. Verify API URL in profile configuration:
2284
+ ```bash
2285
+ sembix profile show production
2286
+ ```
2287
+
2288
+ 2. Check network connectivity:
2289
+ ```bash
2290
+ curl https://studio.example.com/health
2291
+ ```
2292
+
2293
+ 3. Reconfigure profile if URL is incorrect:
2294
+ ```bash
2295
+ sembix configure
2296
+ # Use same profile name to update
881
2297
  ```
882
2298
 
883
- ### "No repositories found"
2299
+ #### "401 Unauthorized"
884
2300
 
885
- Make sure your GitHub token has access to the repositories you want to manage. Check the token's permissions and organization access.
2301
+ **Error:** API returns 401 error
886
2302
 
887
- ### "Invalid YAML syntax"
2303
+ **Solution:**
2304
+ ```bash
2305
+ # Token expired - re-authenticate
2306
+ sembix login --profile production
2307
+
2308
+ # If still failing, logout and login again
2309
+ sembix logout --profile production
2310
+ sembix login --profile production
2311
+ ```
2312
+
2313
+ #### "Workflow not found"
2314
+
2315
+ **Error:**
2316
+ ```
2317
+ ✗ Workflow 'wf_456' not found
2318
+ ```
2319
+
2320
+ **Solution:**
2321
+ ```bash
2322
+ # List available workflows
2323
+ sembix workflow list --project-id proj_123
2324
+
2325
+ # Or use interactive mode to search
2326
+ sembix workflow start
2327
+ ```
2328
+
2329
+ ### Common Errors
2330
+
2331
+ #### "Failed to encrypt secret"
2332
+
2333
+ **Error:** libsodium encryption error
2334
+
2335
+ **Solution:**
2336
+ ```bash
2337
+ # Reinstall dependencies
2338
+ rm -rf node_modules
2339
+ npm install
2340
+
2341
+ # If still failing, try:
2342
+ npm install libsodium-wrappers --save
2343
+ ```
2344
+
2345
+ #### "Invalid YAML syntax"
888
2346
 
889
- When using config files, validate your YAML syntax:
2347
+ **Error:** When using config files
890
2348
 
2349
+ **Solution:**
891
2350
  ```bash
892
- # Use a YAML validator
2351
+ # Validate YAML syntax
893
2352
  npm install -g js-yaml
894
2353
  js-yaml config.yaml
2354
+
2355
+ # Or use online validator: yamllint.com
2356
+
2357
+ # Common issues:
2358
+ # - Incorrect indentation (use spaces, not tabs)
2359
+ # - Missing quotes around special characters
2360
+ # - Malformed arrays/objects
2361
+ ```
2362
+
2363
+ #### "Invalid environment name"
2364
+
2365
+ **Error:**
2366
+ ```
2367
+ ✗ Invalid environment name. Must be lowercase letters, numbers, and hyphens (min 3 chars).
895
2368
  ```
896
2369
 
897
- ### "Environment already exists"
2370
+ **Rules:**
2371
+ - Lowercase letters only
2372
+ - Numbers allowed
2373
+ - Hyphens allowed (not at start/end)
2374
+ - No spaces or special characters
2375
+ - Minimum 3 characters
2376
+
2377
+ **Valid examples:**
2378
+ - `production`
2379
+ - `client-abc-staging`
2380
+ - `dev-environment-2`
2381
+
2382
+ **Invalid examples:**
2383
+ - `Production` (uppercase)
2384
+ - `My Environment` (spaces)
2385
+ - `prod_env` (underscores)
898
2386
 
899
- Use the `update` command instead of `create`:
2387
+ #### "Permission denied writing tokens"
900
2388
 
2389
+ **Error:** Cannot write to ~/.sembix directory
2390
+
2391
+ **Solution:**
901
2392
  ```bash
902
- sembix studio update production --repo acme/deploy
2393
+ # Check directory permissions
2394
+ ls -la ~/.sembix
2395
+
2396
+ # Fix permissions
2397
+ chmod 700 ~/.sembix
2398
+ chmod 600 ~/.sembix/tokens/*
2399
+
2400
+ # If directory doesn't exist
2401
+ mkdir -p ~/.sembix/tokens
2402
+ chmod 700 ~/.sembix
903
2403
  ```
904
2404
 
905
- Or delete the environment in GitHub and recreate it.
2405
+ #### "Invalid input format" (Workflows)
2406
+
2407
+ **Error:** Workflow input validation failed
2408
+
2409
+ **Solution:**
2410
+ ```bash
2411
+ # Validate JSON syntax
2412
+ echo '{"key":"value"}' | jq .
2413
+
2414
+ # Use file for complex inputs
2415
+ cat inputs.json | jq . # Validate
2416
+ sembix workflow start --project-id proj_123 --workflow-id wf_456 --inputs @inputs.json
2417
+
2418
+ # Check required vs optional inputs
2419
+ sembix workflow template show --project-id proj_123 --workflow-id wf_456
2420
+ ```
2421
+
2422
+ ### Configuration Issues
2423
+
2424
+ #### Config file not found
2425
+
2426
+ **Error:**
2427
+ ```
2428
+ ✗ Config file not found: production.yaml
2429
+ ```
2430
+
2431
+ **Solution:**
2432
+ ```bash
2433
+ # Use absolute path
2434
+ sembix studio create --config /full/path/to/production.yaml
2435
+
2436
+ # Or relative to current directory
2437
+ sembix studio create --config ./configs/production.yaml
2438
+
2439
+ # Verify file exists
2440
+ ls -la production.yaml
2441
+ ```
2442
+
2443
+ #### Config validation failed
2444
+
2445
+ **Error:** Config file validation errors
2446
+
2447
+ **Solution:**
2448
+ 1. Check config.example.yaml for correct format
2449
+ 2. Ensure all required fields are present
2450
+ 3. Validate data types (strings, booleans, numbers)
2451
+ 4. Check ARN formats match AWS patterns
2452
+ 5. Verify CIDR blocks are valid
2453
+
2454
+ ### Build/Installation Issues
2455
+
2456
+ #### "Cannot find module"
2457
+
2458
+ **Error:** Module resolution errors
2459
+
2460
+ **Solution:**
2461
+ ```bash
2462
+ # Reinstall dependencies
2463
+ rm -rf node_modules package-lock.json
2464
+ npm install
2465
+
2466
+ # Rebuild TypeScript
2467
+ npm run build
2468
+
2469
+ # If still failing, check Node version
2470
+ node --version # Should be 20 or higher
2471
+ ```
2472
+
2473
+ #### "Command not found: sembix"
2474
+
2475
+ **Error:** CLI not in PATH after installation
2476
+
2477
+ **Solution:**
2478
+ ```bash
2479
+ # Global install
2480
+ npm install -g @sembix/cli
2481
+
2482
+ # Verify installation
2483
+ which sembix
2484
+ sembix --version
2485
+
2486
+ # If using npm link (development)
2487
+ npm link
2488
+
2489
+ # Add npm global bin to PATH if needed
2490
+ export PATH="$PATH:$(npm config get prefix)/bin"
2491
+ ```
2492
+
2493
+ ### CI/CD Issues
2494
+
2495
+ #### Client credentials not working
2496
+
2497
+ **Error:** SEMBIX_CLIENT_ID and SEMBIX_CLIENT_SECRET set but authentication fails
2498
+
2499
+ **Solution:**
2500
+ 1. Verify credentials are correct (no extra spaces)
2501
+ 2. Check client has required scopes:
2502
+ - `sembix-api/projects.read`
2503
+ - `sembix-api/workflows.read`
2504
+ - `sembix-api/workflows.execute`
2505
+ 3. Test credentials locally:
2506
+ ```bash
2507
+ export SEMBIX_CLIENT_ID="your-client-id"
2508
+ export SEMBIX_CLIENT_SECRET="your-client-secret"
2509
+ sembix login # Should show "Client credentials detected..."
2510
+ ```
2511
+
2512
+ #### Environment variables not recognized
2513
+
2514
+ **Error:** CI/CD pipeline can't find credentials
2515
+
2516
+ **Solution:**
2517
+ ```bash
2518
+ # GitHub Actions: Use secrets
2519
+ env:
2520
+ SEMBIX_CLIENT_ID: ${{ secrets.SEMBIX_M2M_CLIENT_ID }}
2521
+ SEMBIX_CLIENT_SECRET: ${{ secrets.SEMBIX_M2M_CLIENT_SECRET }}
2522
+
2523
+ # GitLab CI: Use variables
2524
+ variables:
2525
+ SEMBIX_CLIENT_ID: ${M2M_CLIENT_ID}
2526
+ SEMBIX_CLIENT_SECRET: ${M2M_CLIENT_SECRET}
2527
+
2528
+ # Verify secrets are set in CI/CD settings
2529
+ ```
2530
+
2531
+ ### Getting Help
2532
+
2533
+ If you encounter an issue not covered here:
2534
+
2535
+ 1. **Check version:**
2536
+ ```bash
2537
+ sembix --version
2538
+ ```
2539
+
2540
+ 2. **Enable verbose output:**
2541
+ ```bash
2542
+ sembix studio create --verbose # If supported
2543
+ ```
2544
+
2545
+ 3. **Check logs:**
2546
+ - GitHub token permissions
2547
+ - API endpoint reachability
2548
+ - Config file syntax
2549
+
2550
+ 4. **Common debugging steps:**
2551
+ ```bash
2552
+ # Verify GitHub access
2553
+ sembix studio list
2554
+
2555
+ # Check profile status
2556
+ sembix profile list
2557
+
2558
+ # Test authentication
2559
+ sembix login --profile production
2560
+
2561
+ # Validate config file
2562
+ js-yaml config.yaml
2563
+ ```
2564
+
2565
+ 5. **Contact support:**
2566
+ - Provide error message
2567
+ - Include CLI version
2568
+ - Share (sanitized) config file if applicable
906
2569
 
907
2570
  ## Advanced Topics
908
2571
 
@@ -962,7 +2625,11 @@ For issues or questions, contact the Sembix team or open an issue in the reposit
962
2625
 
963
2626
  ## See Also
964
2627
 
965
- - [QUICKSTART.md](./QUICKSTART.md) - 5-minute quick start guide
966
- - [USAGE-EXAMPLES.md](./USAGE-EXAMPLES.md) - Real-world usage examples
967
- - [COMMANDS.md](./COMMANDS.md) - Detailed command reference
968
- - [config.example.yaml](./config.example.yaml) - Complete config file example
2628
+ For additional detailed documentation, see these files included in the package:
2629
+
2630
+ - [QUICKSTART.md](./QUICKSTART.md) - Step-by-step quick start guide with detailed walkthroughs
2631
+ - [USAGE-EXAMPLES.md](./USAGE-EXAMPLES.md) - Comprehensive real-world usage examples and patterns
2632
+ - [COMMANDS.md](./COMMANDS.md) - Complete command reference with all options and examples
2633
+ - [config.example.yaml](./config.example.yaml) - Fully annotated configuration file example
2634
+
2635
+ **Note:** After installing the package (`npm install -g @sembix/cli`), these files are available in your global node_modules directory. The README provides comprehensive documentation, but these supplementary files offer additional depth and examples.