@sembix/cli 1.3.0 → 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 (196) hide show
  1. package/COMMANDS.md +1522 -0
  2. package/QUICKSTART.md +829 -0
  3. package/README.md +1949 -285
  4. package/USAGE-EXAMPLES.md +872 -0
  5. package/dist/commands/configure.d.ts.map +1 -1
  6. package/dist/commands/configure.js +172 -2
  7. package/dist/commands/configure.js.map +1 -1
  8. package/dist/commands/index.d.ts +10 -0
  9. package/dist/commands/index.d.ts.map +1 -0
  10. package/dist/commands/index.js +11 -0
  11. package/dist/commands/index.js.map +1 -0
  12. package/dist/commands/login.d.ts +19 -0
  13. package/dist/commands/login.d.ts.map +1 -0
  14. package/dist/commands/login.js +118 -0
  15. package/dist/commands/login.js.map +1 -0
  16. package/dist/commands/logout.d.ts +21 -0
  17. package/dist/commands/logout.d.ts.map +1 -0
  18. package/dist/commands/logout.js +66 -0
  19. package/dist/commands/logout.js.map +1 -0
  20. package/dist/commands/profile-project.d.ts +14 -0
  21. package/dist/commands/profile-project.d.ts.map +1 -0
  22. package/dist/commands/profile-project.js +123 -0
  23. package/dist/commands/profile-project.js.map +1 -0
  24. package/dist/commands/profile.d.ts +26 -0
  25. package/dist/commands/profile.d.ts.map +1 -0
  26. package/dist/commands/profile.js +177 -0
  27. package/dist/commands/profile.js.map +1 -0
  28. package/dist/commands/project.d.ts +16 -0
  29. package/dist/commands/project.d.ts.map +1 -0
  30. package/dist/commands/project.js +153 -0
  31. package/dist/commands/project.js.map +1 -0
  32. package/dist/commands/workflow.d.ts +91 -0
  33. package/dist/commands/workflow.d.ts.map +1 -0
  34. package/dist/commands/workflow.js +1201 -0
  35. package/dist/commands/workflow.js.map +1 -0
  36. package/dist/config-schema.d.ts +23 -0
  37. package/dist/config-schema.d.ts.map +1 -1
  38. package/dist/config-schema.js +21 -1
  39. package/dist/config-schema.js.map +1 -1
  40. package/dist/config.d.ts +4 -0
  41. package/dist/config.d.ts.map +1 -1
  42. package/dist/config.js +23 -2
  43. package/dist/config.js.map +1 -1
  44. package/dist/index.js +318 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/prompts/project-selection.d.ts +8 -0
  47. package/dist/prompts/project-selection.d.ts.map +1 -0
  48. package/dist/prompts/project-selection.js +132 -0
  49. package/dist/prompts/project-selection.js.map +1 -0
  50. package/dist/prompts/workflow-inputs.d.ts +10 -0
  51. package/dist/prompts/workflow-inputs.d.ts.map +1 -0
  52. package/dist/prompts/workflow-inputs.js +71 -0
  53. package/dist/prompts/workflow-inputs.js.map +1 -0
  54. package/dist/prompts/workflow-selection.d.ts +8 -0
  55. package/dist/prompts/workflow-selection.d.ts.map +1 -0
  56. package/dist/prompts/workflow-selection.js +147 -0
  57. package/dist/prompts/workflow-selection.js.map +1 -0
  58. package/dist/sembix-cli-1.4.0.tgz +0 -0
  59. package/dist/services/cognito-auth.d.ts +92 -0
  60. package/dist/services/cognito-auth.d.ts.map +1 -0
  61. package/dist/services/cognito-auth.js +319 -0
  62. package/dist/services/cognito-auth.js.map +1 -0
  63. package/dist/services/studio-api-client.d.ts +127 -0
  64. package/dist/services/studio-api-client.d.ts.map +1 -0
  65. package/dist/services/studio-api-client.js +291 -0
  66. package/dist/services/studio-api-client.js.map +1 -0
  67. package/dist/types/studio.d.ts +82 -0
  68. package/dist/types/studio.d.ts.map +1 -0
  69. package/dist/types/studio.js +7 -0
  70. package/dist/types/studio.js.map +1 -0
  71. package/dist/types.d.ts +283 -0
  72. package/dist/types.d.ts.map +1 -1
  73. package/dist/types.js +5 -0
  74. package/dist/types.js.map +1 -1
  75. package/dist/utils/browser-auth.d.ts +45 -0
  76. package/dist/utils/browser-auth.d.ts.map +1 -0
  77. package/dist/utils/browser-auth.js +168 -0
  78. package/dist/utils/browser-auth.js.map +1 -0
  79. package/dist/utils/cognito-auth.d.ts +3 -0
  80. package/dist/utils/cognito-auth.d.ts.map +1 -0
  81. package/dist/utils/cognito-auth.js +3 -0
  82. package/dist/utils/cognito-auth.js.map +1 -0
  83. package/dist/utils/config-file.d.ts +40 -0
  84. package/dist/utils/config-file.d.ts.map +1 -1
  85. package/dist/utils/config-file.js +158 -4
  86. package/dist/utils/config-file.js.map +1 -1
  87. package/dist/utils/environment.d.ts +22 -0
  88. package/dist/utils/environment.d.ts.map +1 -0
  89. package/dist/utils/environment.js +39 -0
  90. package/dist/utils/environment.js.map +1 -0
  91. package/dist/utils/error-handler.d.ts +53 -0
  92. package/dist/utils/error-handler.d.ts.map +1 -0
  93. package/dist/utils/error-handler.js +174 -0
  94. package/dist/utils/error-handler.js.map +1 -0
  95. package/dist/utils/fuzzy-match.d.ts +31 -0
  96. package/dist/utils/fuzzy-match.d.ts.map +1 -0
  97. package/dist/utils/fuzzy-match.js +138 -0
  98. package/dist/utils/fuzzy-match.js.map +1 -0
  99. package/dist/utils/input-parser.d.ts +14 -0
  100. package/dist/utils/input-parser.d.ts.map +1 -0
  101. package/dist/utils/input-parser.js +34 -0
  102. package/dist/utils/input-parser.js.map +1 -0
  103. package/dist/utils/output.d.ts +55 -0
  104. package/dist/utils/output.d.ts.map +1 -0
  105. package/dist/utils/output.js +80 -0
  106. package/dist/utils/output.js.map +1 -0
  107. package/dist/utils/recent-workflows.d.ts +37 -0
  108. package/dist/utils/recent-workflows.d.ts.map +1 -0
  109. package/dist/utils/recent-workflows.js +172 -0
  110. package/dist/utils/recent-workflows.js.map +1 -0
  111. package/dist/utils/studio-api-client.d.ts +3 -0
  112. package/dist/utils/studio-api-client.d.ts.map +1 -0
  113. package/dist/utils/studio-api-client.js +3 -0
  114. package/dist/utils/studio-api-client.js.map +1 -0
  115. package/dist/utils/studio-api.d.ts +53 -0
  116. package/dist/utils/studio-api.d.ts.map +1 -0
  117. package/dist/utils/studio-api.js +102 -0
  118. package/dist/utils/studio-api.js.map +1 -0
  119. package/dist/utils/studio-config.d.ts +74 -0
  120. package/dist/utils/studio-config.d.ts.map +1 -0
  121. package/dist/utils/studio-config.js +213 -0
  122. package/dist/utils/studio-config.js.map +1 -0
  123. package/dist/utils/token-manager.d.ts +4 -0
  124. package/dist/utils/token-manager.d.ts.map +1 -0
  125. package/dist/utils/token-manager.js +3 -0
  126. package/dist/utils/token-manager.js.map +1 -0
  127. package/dist/utils/ui.d.ts +55 -1
  128. package/dist/utils/ui.d.ts.map +1 -1
  129. package/dist/utils/ui.js +151 -2
  130. package/dist/utils/ui.js.map +1 -1
  131. package/package.json +4 -1
  132. package/dist/__tests__/config-schema.test.d.ts +0 -2
  133. package/dist/__tests__/config-schema.test.d.ts.map +0 -1
  134. package/dist/__tests__/config-schema.test.js +0 -471
  135. package/dist/__tests__/config-schema.test.js.map +0 -1
  136. package/dist/__tests__/config.test.d.ts +0 -2
  137. package/dist/__tests__/config.test.d.ts.map +0 -1
  138. package/dist/__tests__/config.test.js +0 -75
  139. package/dist/__tests__/config.test.js.map +0 -1
  140. package/dist/__tests__/integration/configure.test.d.ts +0 -2
  141. package/dist/__tests__/integration/configure.test.d.ts.map +0 -1
  142. package/dist/__tests__/integration/configure.test.js +0 -247
  143. package/dist/__tests__/integration/configure.test.js.map +0 -1
  144. package/dist/__tests__/integration/fixtures/configs.d.ts +0 -477
  145. package/dist/__tests__/integration/fixtures/configs.d.ts.map +0 -1
  146. package/dist/__tests__/integration/fixtures/configs.js +0 -175
  147. package/dist/__tests__/integration/fixtures/configs.js.map +0 -1
  148. package/dist/__tests__/integration/helpers/cli-runner.d.ts +0 -63
  149. package/dist/__tests__/integration/helpers/cli-runner.d.ts.map +0 -1
  150. package/dist/__tests__/integration/helpers/cli-runner.js +0 -152
  151. package/dist/__tests__/integration/helpers/cli-runner.js.map +0 -1
  152. package/dist/__tests__/integration/helpers/command-runner.d.ts +0 -53
  153. package/dist/__tests__/integration/helpers/command-runner.d.ts.map +0 -1
  154. package/dist/__tests__/integration/helpers/command-runner.js +0 -117
  155. package/dist/__tests__/integration/helpers/command-runner.js.map +0 -1
  156. package/dist/__tests__/integration/studio-create.test.d.ts +0 -2
  157. package/dist/__tests__/integration/studio-create.test.d.ts.map +0 -1
  158. package/dist/__tests__/integration/studio-create.test.js +0 -209
  159. package/dist/__tests__/integration/studio-create.test.js.map +0 -1
  160. package/dist/__tests__/integration/studio-update.test.d.ts +0 -2
  161. package/dist/__tests__/integration/studio-update.test.d.ts.map +0 -1
  162. package/dist/__tests__/integration/studio-update.test.js +0 -166
  163. package/dist/__tests__/integration/studio-update.test.js.map +0 -1
  164. package/dist/commands/__tests__/configure.test.d.ts +0 -2
  165. package/dist/commands/__tests__/configure.test.d.ts.map +0 -1
  166. package/dist/commands/__tests__/configure.test.js +0 -229
  167. package/dist/commands/__tests__/configure.test.js.map +0 -1
  168. package/dist/prompts/__tests__/environment-setup.test.d.ts +0 -2
  169. package/dist/prompts/__tests__/environment-setup.test.d.ts.map +0 -1
  170. package/dist/prompts/__tests__/environment-setup.test.js +0 -206
  171. package/dist/prompts/__tests__/environment-setup.test.js.map +0 -1
  172. package/dist/prompts/__tests__/hub-integration.test.d.ts +0 -2
  173. package/dist/prompts/__tests__/hub-integration.test.d.ts.map +0 -1
  174. package/dist/prompts/__tests__/hub-integration.test.js +0 -126
  175. package/dist/prompts/__tests__/hub-integration.test.js.map +0 -1
  176. package/dist/prompts/__tests__/prompt-helpers.test.d.ts +0 -2
  177. package/dist/prompts/__tests__/prompt-helpers.test.d.ts.map +0 -1
  178. package/dist/prompts/__tests__/prompt-helpers.test.js +0 -235
  179. package/dist/prompts/__tests__/prompt-helpers.test.js.map +0 -1
  180. package/dist/sembix-cli-1.3.0.tgz +0 -0
  181. package/dist/utils/__tests__/config-file.test.d.ts +0 -2
  182. package/dist/utils/__tests__/config-file.test.d.ts.map +0 -1
  183. package/dist/utils/__tests__/config-file.test.js +0 -218
  184. package/dist/utils/__tests__/config-file.test.js.map +0 -1
  185. package/dist/utils/__tests__/config-loader.test.d.ts +0 -2
  186. package/dist/utils/__tests__/config-loader.test.d.ts.map +0 -1
  187. package/dist/utils/__tests__/config-loader.test.js +0 -325
  188. package/dist/utils/__tests__/config-loader.test.js.map +0 -1
  189. package/dist/utils/__tests__/github.test.d.ts +0 -2
  190. package/dist/utils/__tests__/github.test.d.ts.map +0 -1
  191. package/dist/utils/__tests__/github.test.js +0 -282
  192. package/dist/utils/__tests__/github.test.js.map +0 -1
  193. package/dist/utils/__tests__/ui.test.d.ts +0 -2
  194. package/dist/utils/__tests__/ui.test.d.ts.map +0 -1
  195. package/dist/utils/__tests__/ui.test.js +0 -256
  196. 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,115 +342,50 @@ 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
196
-
197
- ### Quick Start
198
-
199
- **Step 1: Configure credentials (first time only)**
200
-
201
- ```bash
202
- sembix configure
203
- ```
204
-
205
- This interactive command will prompt you for:
206
- - GitHub Personal Access Token
207
- - Default GitHub organization (optional)
208
-
209
- Your credentials are saved securely to `~/.sembix/config`.
210
-
211
- **Step 2: Create your environment**
345
+ ## Commands
212
346
 
213
- For a complete deployment, follow the **two-phased process**:
347
+ Complete reference for all Sembix CLI commands.
214
348
 
215
- ```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
349
+ ### Command Structure
221
350
 
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
226
351
  ```
227
-
228
- See the [Deployment Process](#deployment-process) section above for detailed explanation.
229
-
230
- **Alternative workflows:**
231
-
232
- ```bash
233
- # Fully interactive (prompts for all configuration)
234
- sembix studio create
235
-
236
- # Fast setup with config file
237
- sembix studio create --config production.yaml
238
-
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)
352
+ sembix <product> <action> [options] [arguments]
247
353
  ```
248
354
 
249
- ### Example: Complete First-Time Setup
250
-
251
- ```bash
252
- # 1. Configure credentials
253
- $ sembix configure
254
- GitHub Personal Access Token: ****
255
- Default GitHub Organization (optional): acme-corp
256
- ✓ Configuration saved successfully!
257
-
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!
265
-
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
271
-
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!
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)
277
359
 
278
- # 5. Deploy again via GitHub Actions
279
- # → Run workflow again
280
- # → Studio is now fully operational!
281
- ```
360
+ ---
282
361
 
283
- ## Commands
362
+ ### Global Commands
284
363
 
285
- ### `sembix configure`
364
+ #### `sembix configure`
286
365
 
287
366
  Configure Sembix CLI credentials and settings interactively.
288
367
 
289
- **Syntax:**
368
+ **Usage:**
290
369
 
291
370
  ```bash
292
371
  sembix configure
293
372
  ```
294
373
 
295
374
  **What it does:**
296
- 1. Prompts for your GitHub Personal Access Token (with validation)
375
+
376
+ 1. Prompts for your GitHub Personal Access Token
297
377
  2. Prompts for your default GitHub organization (optional)
298
- 3. Saves configuration securely to `~/.sembix/config` with file permissions 0600
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)
299
382
 
300
383
  **When to use:**
301
- - First time setup (recommended for all users)
302
- - Updating your GitHub token when it expires
384
+
385
+ - First time setup (recommended)
386
+ - Updating your GitHub token
303
387
  - Changing your default organization
388
+ - Adding or updating Studio profiles for API access
304
389
 
305
390
  **Example:**
306
391
 
@@ -314,45 +399,61 @@ This will store your configuration in:
314
399
 
315
400
  ? GitHub Personal Access Token: ****
316
401
  ? Default GitHub Organization (optional): acme-corp
402
+ ? Configure Sembix Studio profile? Yes
317
403
 
318
- Configuration saved successfully!
404
+ ━━━ Studio Profile Configuration ━━━
319
405
 
320
- Your credentials are stored securely in:
321
- ~/.sembix/config
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
322
412
 
323
- You can now run Sembix commands without the --token flag.
413
+ Configuration saved successfully!
414
+ ✓ Studio profile 'production' configured successfully!
324
415
  ```
325
416
 
326
417
  ---
327
418
 
328
- ### `sembix studio create`
419
+ ### Studio Deployment Commands
420
+
421
+ Commands for managing Sembix Studio GitHub Actions deployments.
422
+
423
+ #### `sembix studio create [name]`
329
424
 
330
- Create a new Sembix Studio environment with complete configuration.
425
+ Create a new Sembix Studio environment with full interactive configuration.
331
426
 
332
- **Syntax:**
427
+ **Usage:**
333
428
 
334
429
  ```bash
335
- sembix studio create [environment-name] [options]
430
+ # Interactive mode
431
+ sembix studio create
432
+
433
+ # With environment name
434
+ sembix studio create production
435
+
436
+ # With name and repository
437
+ sembix studio create production --repo acme/deploy
336
438
  ```
337
439
 
338
- **Options:**
440
+ **Key Options:**
339
441
 
340
442
  ```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)
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
346
447
 
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
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
352
453
 
353
454
  # Database
354
- --database-name <name> PostgreSQL database name
355
- --database-user <user> PostgreSQL database user
455
+ --database-name <name> PostgreSQL database name
456
+ --database-user <user> PostgreSQL database user
356
457
 
357
458
  # Networking
358
459
  --enable-vpc-endpoints <boolean> Enable VPC endpoints (true/false)
@@ -387,203 +488,1385 @@ sembix studio create [environment-name] [options]
387
488
  --iam-studio-memory <arn> Studio Memory role ARN
388
489
  --iam-studio-notification <arn> Studio Notification role ARN
389
490
 
390
- # TLS/DNS
391
- --cloudfront-domain <domain> CloudFront custom domain
392
- --cloudfront-cert-arn <arn> CloudFront SSL certificate ARN (must be in us-east-1)
393
- --bff-alb-cert-arn <arn> BFF ALB SSL certificate ARN
394
- --hosted-zone-id <id> Route53 hosted zone ID
395
-
396
- # Feature Flags
397
- --deploy-studio-memory <boolean> Deploy Studio Memory service (true/false)
398
- --deploy-studio-notifications <boolean> Deploy Studio Notifications (true/false)
399
- --enable-bff-waf <boolean> Enable WAF for BFF (true/false)
400
-
401
- # Frontend
402
- --github-app-client-id <id> GitHub App OAuth client ID
403
- --github-app-name <name> GitHub App name
404
- --jira-client-id <id> Jira OAuth client ID
405
-
406
- # Hub Integration (Step 9)
407
- --skip-hub Skip Hub integration configuration
408
- --hub-engine-execution-role <arn> Hub Engine Execution Role ARN
409
- --hub-consumer-role <arn> Hub Consumer Role ARN
410
- --hub-admin-role <arn> Hub Admin Role ARN
411
- --hub-appconfig-role <arn> Hub AppConfig Role ARN
412
- --hub-appconfig-app-id <id> Hub AppConfig Application ID
413
- --hub-appconfig-env-id <id> Hub AppConfig Environment ID
414
- --hub-appconfig-profile-id <id> Hub AppConfig Profile ID
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
+ ```
503
+
504
+ **Examples:**
505
+
506
+ ```bash
507
+ # Fully interactive
508
+ sembix studio create
509
+
510
+ # With config file
511
+ sembix studio create --config production.yaml
512
+
513
+ # Skip Hub (add later)
514
+ sembix studio create production --repo acme/deploy --skip-hub
515
+ ```
516
+
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:**
531
+
532
+ ```bash
533
+ sembix studio update production --repo acme/deploy
534
+ ```
535
+
536
+ **Options:** Same as `create` command
537
+
538
+ **Examples:**
539
+
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
544
+
545
+ # Update feature flags
546
+ sembix studio update production --repo acme/deploy \
547
+ --deploy-studio-memory true
548
+ ```
549
+
550
+ #### `sembix studio add-hub [name]`
551
+
552
+ Add Sembix Hub integration to an existing environment (Phase 2 deployment).
553
+
554
+ **Usage:**
555
+
556
+ ```bash
557
+ sembix studio add-hub production --repo acme/deploy
558
+ ```
559
+
560
+ **Options:**
561
+
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:**
572
+
573
+ ```bash
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
615
+ ```
616
+
617
+ **What it does:**
618
+
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
623
+
624
+ #### `sembix logout [profile]`
625
+
626
+ Log out from Sembix Studio by removing stored tokens.
627
+
628
+ **Usage:**
629
+
630
+ ```bash
631
+ # Logout from default profile
632
+ sembix logout
633
+
634
+ # Logout from specific profile
635
+ sembix logout production
636
+
637
+ # Logout from all profiles
638
+ sembix logout --all
639
+ ```
640
+
641
+ #### Profile Commands
642
+
643
+ **`sembix profile list`**
644
+
645
+ List all configured Studio profiles with authentication status.
646
+
647
+ ```bash
648
+ sembix profile list
649
+ ```
650
+
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.
686
+
687
+ ```bash
688
+ sembix profile get-default-project production
689
+ ```
690
+
691
+ **`sembix profile clear-default-project <profile>`**
692
+
693
+ Clear the default project for a profile.
694
+
695
+ ```bash
696
+ sembix profile clear-default-project production
697
+ ```
698
+
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
415
1566
  ```
416
1567
 
417
- **Examples:**
1568
+ **Clear default project:**
1569
+ ```bash
1570
+ sembix profile clear-default-project <profile>
1571
+
1572
+ # Example
1573
+ sembix profile clear-default-project production
1574
+ ```
418
1575
 
1576
+ **Usage with workflow commands:**
419
1577
  ```bash
420
- # Interactive mode (prompts for everything)
421
- sembix studio create
1578
+ # Set default project
1579
+ sembix profile set-default-project production proj_abc123
422
1580
 
423
- # Specify environment name
424
- sembix studio create production
1581
+ # Now you can omit --project-id
1582
+ sembix workflow start --workflow-id wf_456 --inputs '{...}'
1583
+ # Uses proj_abc123 automatically
1584
+ ```
425
1585
 
426
- # With repository
427
- sembix studio create production --repo acme/deploy
1586
+ ### Project Management
428
1587
 
429
- # Using config file
430
- sembix studio create --config production.yaml
1588
+ List and view projects in your Studio instance.
431
1589
 
432
- # Config file with overrides
433
- sembix studio create --config base.yaml \
434
- --env client-abc-production \
435
- --aws-account-id 123456789012
1590
+ **List all projects:**
1591
+ ```bash
1592
+ # List all projects
1593
+ sembix project list
436
1594
 
437
- # Skip Hub integration (add later)
438
- sembix studio create production --repo acme/deploy --skip-hub
1595
+ # Filter by name
1596
+ sembix project list --name "My Project"
439
1597
 
440
- # Fully automated with all flags
441
- sembix studio create production \
442
- --repo acme/deploy \
443
- --aws-account-id 123456789012 \
444
- --aws-region us-east-1 \
445
- --customer-role-arn arn:aws:iam::123456789012:role/Deploy \
446
- --terraform-state-bucket my-tf-state \
447
- --database-name sembix_studio \
448
- --database-user sembix_studio_user \
449
- --cloudfront-domain studio.acme.com \
450
- --cloudfront-cert-arn arn:aws:acm:us-east-1:123456789012:certificate/abc \
451
- --bff-alb-cert-arn arn:aws:acm:us-east-1:123456789012:certificate/def \
452
- --hosted-zone-id Z1234567890ABC \
453
- --github-app-client-id Iv1.0123456789abcdef \
454
- --github-app-name sembix-studio-app \
455
- --jira-client-id abc123def456
1598
+ # Filter by IDs
1599
+ sembix project list --ids "proj_123,proj_456"
1600
+
1601
+ # With specific profile
1602
+ sembix project list --profile production
456
1603
  ```
457
1604
 
458
- **What it does:**
1605
+ **Show project details:**
1606
+ ```bash
1607
+ sembix project show --project-id proj_abc123
459
1608
 
460
- 1. Validates repository and environment name
461
- 2. Walks through 9 configuration steps (or uses provided config):
462
- - Repository selection
463
- - Basic AWS configuration
464
- - Database configuration
465
- - Networking (VPC, subnets)
466
- - Security (security groups, IAM roles, KMS)
467
- - DNS & TLS (CloudFront, ALB certificates)
468
- - Feature flags (Memory, Notifications, WAF)
469
- - Frontend configuration (GitHub App, Jira)
470
- - **Hub integration (optional)**
471
- 3. Creates GitHub Actions environment
472
- 4. Sets environment variables and encrypted secrets
473
- 5. Provides next steps for deployment
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
+ ```
474
1624
 
475
- ### `sembix studio update`
1625
+ ### Workflow Operations
476
1626
 
477
- Update an existing Sembix Studio environment.
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"}'
478
1643
 
479
- **Syntax:**
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 '{...}'
1652
+
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"}'
1660
+
1661
+ # Use specific profile
1662
+ sembix workflow start \
1663
+ --profile production \
1664
+ --project-id abc123 \
1665
+ --workflow-id def456 \
1666
+ --inputs '{"key": "value"}'
1667
+ ```
1668
+
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
+ ```
1682
+
1683
+ #### Check Workflow Status
480
1684
 
481
1685
  ```bash
482
- sembix studio update [environment-name] [options]
1686
+ # Get current status
1687
+ sembix workflow run status --workflow-id wf_456 --run-id run_789
1688
+
1689
+ # Watch workflow until completion (polls every 5 seconds)
1690
+ sembix workflow run status --workflow-id wf_456 --run-id run_789 --watch
483
1691
  ```
484
1692
 
485
- **Options:** Same as `create` command
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
1703
+ ```
486
1704
 
487
- **Examples:**
1705
+ #### List Workflow Runs
488
1706
 
489
1707
  ```bash
490
- # Interactive update (re-prompts for all config)
491
- sembix studio update production --repo acme/deploy
1708
+ # List workflow instances (definitions)
1709
+ sembix workflow list
492
1710
 
493
- # Add Hub integration to existing environment
494
- sembix studio update production --repo acme/deploy \
495
- --hub-engine-execution-role arn:aws:iam::123456789012:role/HubEngine \
496
- --hub-consumer-role arn:aws:iam::123456789012:role/HubConsumer \
497
- --hub-admin-role arn:aws:iam::123456789012:role/HubAdmin
1711
+ # Filter by project
1712
+ sembix workflow list --project-id proj_123
498
1713
 
499
- # Update specific fields only
500
- sembix studio update production --repo acme/deploy \
501
- --deploy-studio-memory true \
502
- --enable-bff-waf true
1714
+ # Filter by template IDs
1715
+ sembix workflow list --workflow-template-ids "tmpl_1,tmpl_2"
503
1716
 
504
- # Update via config file
505
- sembix studio update --config production-updates.yaml
1717
+ # Show workflow instance details
1718
+ sembix workflow show --project-id proj_123 --workflow-id wf_456
506
1719
 
507
- # Update database credentials
508
- sembix studio update production --repo acme/deploy \
509
- --database-name new_db_name \
510
- --database-user new_db_user
511
- ```
1720
+ # List workflow runs (executions) - excludes subflows by default
1721
+ sembix workflow run list
512
1722
 
513
- **What it does:**
1723
+ # Filter by workflow
1724
+ sembix workflow run list --workflow-id wf_456
514
1725
 
515
- - Validates environment exists
516
- - Updates only the fields you provide (partial updates)
517
- - Interactive mode re-collects all configuration
518
- - Preserves existing settings for fields not specified
1726
+ # Filter by project
1727
+ sembix workflow run list --project-id proj_123
519
1728
 
520
- ### `sembix studio list`
1729
+ # Filter by status
1730
+ sembix workflow run list --status RUNNING
521
1731
 
522
- List GitHub Actions environments in a repository.
1732
+ # Include sub-workflow runs
1733
+ sembix workflow run list --include-subflows
1734
+
1735
+ # Filter to top-level runs only
1736
+ sembix workflow run list --parent-id NULL
1737
+
1738
+ # Pagination
1739
+ sembix workflow run list --limit 20 --offset 10
1740
+
1741
+ # Show specific run details
1742
+ sembix workflow run show --workflow-id wf_456 --run-id run_789
1743
+
1744
+ # Watch run details until completion
1745
+ sembix workflow run show --workflow-id wf_456 --run-id run_789 --watch
1746
+ ```
1747
+
1748
+ **List output:**
1749
+ ```
1750
+ Workflow Runs
523
1751
 
524
- **Syntax:**
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
1757
+
1758
+ Showing 1-3 of 15 results
1759
+ ```
1760
+
1761
+ #### Stop a Workflow Run
525
1762
 
526
1763
  ```bash
527
- sembix studio list [repository] [options]
1764
+ sembix workflow run stop --project-id proj_123 --workflow-id wf_456 --run-id run_789
528
1765
  ```
529
1766
 
530
- **Examples:**
1767
+ ### Common Workflow Patterns
531
1768
 
1769
+ **1. Start and monitor a workflow:**
532
1770
  ```bash
533
- # List all your repositories
534
- sembix studio list
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
1783
+ ```
535
1784
 
536
- # List environments in specific repository
537
- sembix studio list acme-corp/sembix-deployment
1785
+ **2. List recent failures:**
1786
+ ```bash
1787
+ sembix workflow run list \
1788
+ --status FAILED \
1789
+ --limit 10
1790
+ ```
538
1791
 
539
- # With custom token
540
- sembix studio list acme/deploy --token ghp_custom_token
1792
+ **3. Monitor specific workflow:**
1793
+ ```bash
1794
+ sembix workflow run list \
1795
+ --workflow-id def456 \
1796
+ --status RUNNING
541
1797
  ```
542
1798
 
543
- ### `sembix studio add-hub`
1799
+ ### Output Formatting
544
1800
 
545
- 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.
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)
1807
+
1808
+ **Usage:**
546
1809
 
547
- **Syntax:**
548
1810
  ```bash
549
- sembix studio add-hub [environment] [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
550
1821
  ```
551
1822
 
552
- **Options:**
553
- - `-r, --repo <repo>` - Target repository (owner/repo format)
554
- - `-e, --env <environment>` - Environment name (alternative to positional argument)
555
- - `--hub-engine-execution-role <arn>` - Hub Engine Execution Role ARN (from Sembix support)
556
- - `--hub-consumer-role <arn>` - Hub Consumer Role ARN (from Sembix support)
557
- - `--hub-admin-role <arn>` - Hub Admin Role ARN (from Sembix support)
558
- - `--hub-appconfig-role <arn>` - Hub AppConfig Role ARN (from Sembix support)
559
- - `--hub-appconfig-app-id <id>` - Hub AppConfig Application ID (from Sembix support)
560
- - `--hub-appconfig-env-id <id>` - Hub AppConfig Environment ID (from Sembix support)
561
- - `--hub-appconfig-profile-id <id>` - Hub AppConfig Profile ID (from Sembix support)
1823
+ **Examples:**
562
1824
 
563
- **Example:**
564
1825
  ```bash
565
- # Interactive mode (prompts for ARNs)
566
- sembix studio add-hub production --repo acme/deploy
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
+ }
567
1838
 
568
- # With CLI flags (using ARNs from Sembix support)
569
- sembix studio add-hub production \
570
- --repo acme/deploy \
571
- --hub-engine-execution-role arn:aws:iam::999888777666:role/HubEngineRole \
572
- --hub-consumer-role arn:aws:iam::999888777666:role/HubConsumerRole \
573
- --hub-admin-role arn:aws:iam::999888777666:role/HubAdminRole \
574
- --hub-appconfig-role arn:aws:iam::999888777666:role/HubAppConfigRole \
575
- --hub-appconfig-app-id abc123 \
576
- --hub-appconfig-env-id def456 \
577
- --hub-appconfig-profile-id ghi789
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
578
1844
  ```
579
1845
 
580
- **When to use this command:**
1846
+ **Global flags:**
1847
+ - `--output <format>` - Set output format: json, pretty, or text
1848
+ - `--pretty` - Shorthand for `--output pretty`
1849
+
1850
+ ### Error Handling
1851
+
1852
+ **Authentication errors:**
1853
+ ```bash
1854
+ # If you see "Authentication required" or "Token expired"
1855
+ sembix login --profile production
1856
+ ```
581
1857
 
582
- - **Phase 2 deployment** (recommended): After completing Phase 1 bootstrap deployment and receiving Hub ARNs from Sembix support
583
- - **Alternative**: Hub integration can also be added during initial environment creation (Step 9 of `create`) if you already have the Hub ARNs
584
- - **Updates**: Use the `update` command to modify existing Hub configuration
1858
+ **Profile not found:**
1859
+ ```bash
1860
+ # Configure the profile first
1861
+ sembix configure
1862
+ # Choose to configure Studio profile with name: production
1863
+ ```
585
1864
 
586
- **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
+ ```
587
1870
 
588
1871
  ## Workflow
589
1872
 
@@ -851,61 +2134,438 @@ studio
851
2134
 
852
2135
  ## Troubleshooting
853
2136
 
854
- ### "GitHub token is required"
2137
+ Comprehensive troubleshooting guide for common issues.
2138
+
2139
+ ### Authentication Issues
855
2140
 
856
- If you see this error, you need to configure your GitHub token. The easiest method is:
2141
+ #### "GitHub token is required"
857
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:**
858
2152
  ```bash
2153
+ # Easiest method (recommended)
859
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
860
2161
  ```
861
2162
 
862
- Alternatively, create a `.env` file:
2163
+ #### "Failed to create environment: Bad credentials"
863
2164
 
864
- ```env
865
- 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
866
2175
  ```
867
2176
 
868
- Or pass the token directly via CLI:
2177
+ #### "Authentication required" (Studio API)
2178
+
2179
+ **Error:**
2180
+ ```
2181
+ ✗ Authentication required. Please run: sembix login
2182
+ ```
869
2183
 
2184
+ **Solution:**
870
2185
  ```bash
871
- 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
872
2195
  ```
873
2196
 
874
- ### "Failed to create environment: Bad credentials"
2197
+ #### Browser did not open (Studio login)
2198
+
2199
+ **Error:** Browser window doesn't open during `sembix login`
875
2200
 
876
- 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
877
2206
 
878
- ### "Failed to encrypt secret"
2207
+ ### GitHub API Issues
879
2208
 
880
- The `libsodium-wrappers` library is required for encrypting GitHub secrets. Make sure dependencies are installed:
2209
+ #### "No repositories found"
881
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:**
882
2228
  ```bash
883
- 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
884
2297
  ```
885
2298
 
886
- ### "No repositories found"
2299
+ #### "401 Unauthorized"
887
2300
 
888
- 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
889
2302
 
890
- ### "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"
891
2346
 
892
- When using config files, validate your YAML syntax:
2347
+ **Error:** When using config files
893
2348
 
2349
+ **Solution:**
894
2350
  ```bash
895
- # Use a YAML validator
2351
+ # Validate YAML syntax
896
2352
  npm install -g js-yaml
897
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).
898
2368
  ```
899
2369
 
900
- ### "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)
901
2386
 
902
- Use the `update` command instead of `create`:
2387
+ #### "Permission denied writing tokens"
903
2388
 
2389
+ **Error:** Cannot write to ~/.sembix directory
2390
+
2391
+ **Solution:**
904
2392
  ```bash
905
- 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
906
2403
  ```
907
2404
 
908
- 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
909
2569
 
910
2570
  ## Advanced Topics
911
2571
 
@@ -965,7 +2625,11 @@ For issues or questions, contact the Sembix team or open an issue in the reposit
965
2625
 
966
2626
  ## See Also
967
2627
 
968
- - [QUICKSTART.md](./QUICKSTART.md) - 5-minute quick start guide
969
- - [USAGE-EXAMPLES.md](./USAGE-EXAMPLES.md) - Real-world usage examples
970
- - [COMMANDS.md](./COMMANDS.md) - Detailed command reference
971
- - [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.