@sembix/cli 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) 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/setup.js +1 -1
  33. package/dist/commands/setup.js.map +1 -1
  34. package/dist/commands/update.js +2 -2
  35. package/dist/commands/update.js.map +1 -1
  36. package/dist/commands/workflow.d.ts +91 -0
  37. package/dist/commands/workflow.d.ts.map +1 -0
  38. package/dist/commands/workflow.js +1201 -0
  39. package/dist/commands/workflow.js.map +1 -0
  40. package/dist/config-schema.d.ts +23 -0
  41. package/dist/config-schema.d.ts.map +1 -1
  42. package/dist/config-schema.js +21 -1
  43. package/dist/config-schema.js.map +1 -1
  44. package/dist/config.d.ts +4 -0
  45. package/dist/config.d.ts.map +1 -1
  46. package/dist/config.js +23 -2
  47. package/dist/config.js.map +1 -1
  48. package/dist/index.js +318 -1
  49. package/dist/index.js.map +1 -1
  50. package/dist/prompts/project-selection.d.ts +8 -0
  51. package/dist/prompts/project-selection.d.ts.map +1 -0
  52. package/dist/prompts/project-selection.js +132 -0
  53. package/dist/prompts/project-selection.js.map +1 -0
  54. package/dist/prompts/workflow-inputs.d.ts +10 -0
  55. package/dist/prompts/workflow-inputs.d.ts.map +1 -0
  56. package/dist/prompts/workflow-inputs.js +71 -0
  57. package/dist/prompts/workflow-inputs.js.map +1 -0
  58. package/dist/prompts/workflow-selection.d.ts +8 -0
  59. package/dist/prompts/workflow-selection.d.ts.map +1 -0
  60. package/dist/prompts/workflow-selection.js +147 -0
  61. package/dist/prompts/workflow-selection.js.map +1 -0
  62. package/dist/sembix-cli-1.4.1.tgz +0 -0
  63. package/dist/services/cognito-auth.d.ts +92 -0
  64. package/dist/services/cognito-auth.d.ts.map +1 -0
  65. package/dist/services/cognito-auth.js +319 -0
  66. package/dist/services/cognito-auth.js.map +1 -0
  67. package/dist/services/studio-api-client.d.ts +127 -0
  68. package/dist/services/studio-api-client.d.ts.map +1 -0
  69. package/dist/services/studio-api-client.js +291 -0
  70. package/dist/services/studio-api-client.js.map +1 -0
  71. package/dist/types/studio.d.ts +82 -0
  72. package/dist/types/studio.d.ts.map +1 -0
  73. package/dist/types/studio.js +7 -0
  74. package/dist/types/studio.js.map +1 -0
  75. package/dist/types.d.ts +283 -0
  76. package/dist/types.d.ts.map +1 -1
  77. package/dist/types.js +5 -0
  78. package/dist/types.js.map +1 -1
  79. package/dist/utils/browser-auth.d.ts +45 -0
  80. package/dist/utils/browser-auth.d.ts.map +1 -0
  81. package/dist/utils/browser-auth.js +168 -0
  82. package/dist/utils/browser-auth.js.map +1 -0
  83. package/dist/utils/cognito-auth.d.ts +3 -0
  84. package/dist/utils/cognito-auth.d.ts.map +1 -0
  85. package/dist/utils/cognito-auth.js +3 -0
  86. package/dist/utils/cognito-auth.js.map +1 -0
  87. package/dist/utils/config-file.d.ts +40 -0
  88. package/dist/utils/config-file.d.ts.map +1 -1
  89. package/dist/utils/config-file.js +158 -4
  90. package/dist/utils/config-file.js.map +1 -1
  91. package/dist/utils/environment.d.ts +22 -0
  92. package/dist/utils/environment.d.ts.map +1 -0
  93. package/dist/utils/environment.js +39 -0
  94. package/dist/utils/environment.js.map +1 -0
  95. package/dist/utils/error-handler.d.ts +53 -0
  96. package/dist/utils/error-handler.d.ts.map +1 -0
  97. package/dist/utils/error-handler.js +174 -0
  98. package/dist/utils/error-handler.js.map +1 -0
  99. package/dist/utils/fuzzy-match.d.ts +31 -0
  100. package/dist/utils/fuzzy-match.d.ts.map +1 -0
  101. package/dist/utils/fuzzy-match.js +138 -0
  102. package/dist/utils/fuzzy-match.js.map +1 -0
  103. package/dist/utils/github.d.ts +2 -2
  104. package/dist/utils/github.d.ts.map +1 -1
  105. package/dist/utils/github.js +30 -10
  106. package/dist/utils/github.js.map +1 -1
  107. package/dist/utils/input-parser.d.ts +14 -0
  108. package/dist/utils/input-parser.d.ts.map +1 -0
  109. package/dist/utils/input-parser.js +34 -0
  110. package/dist/utils/input-parser.js.map +1 -0
  111. package/dist/utils/output.d.ts +55 -0
  112. package/dist/utils/output.d.ts.map +1 -0
  113. package/dist/utils/output.js +80 -0
  114. package/dist/utils/output.js.map +1 -0
  115. package/dist/utils/recent-workflows.d.ts +37 -0
  116. package/dist/utils/recent-workflows.d.ts.map +1 -0
  117. package/dist/utils/recent-workflows.js +172 -0
  118. package/dist/utils/recent-workflows.js.map +1 -0
  119. package/dist/utils/studio-api-client.d.ts +3 -0
  120. package/dist/utils/studio-api-client.d.ts.map +1 -0
  121. package/dist/utils/studio-api-client.js +3 -0
  122. package/dist/utils/studio-api-client.js.map +1 -0
  123. package/dist/utils/studio-api.d.ts +53 -0
  124. package/dist/utils/studio-api.d.ts.map +1 -0
  125. package/dist/utils/studio-api.js +102 -0
  126. package/dist/utils/studio-api.js.map +1 -0
  127. package/dist/utils/studio-config.d.ts +74 -0
  128. package/dist/utils/studio-config.d.ts.map +1 -0
  129. package/dist/utils/studio-config.js +213 -0
  130. package/dist/utils/studio-config.js.map +1 -0
  131. package/dist/utils/token-manager.d.ts +4 -0
  132. package/dist/utils/token-manager.d.ts.map +1 -0
  133. package/dist/utils/token-manager.js +3 -0
  134. package/dist/utils/token-manager.js.map +1 -0
  135. package/dist/utils/ui.d.ts +55 -1
  136. package/dist/utils/ui.d.ts.map +1 -1
  137. package/dist/utils/ui.js +151 -2
  138. package/dist/utils/ui.js.map +1 -1
  139. package/package.json +4 -1
  140. package/dist/__tests__/config-schema.test.d.ts +0 -2
  141. package/dist/__tests__/config-schema.test.d.ts.map +0 -1
  142. package/dist/__tests__/config-schema.test.js +0 -471
  143. package/dist/__tests__/config-schema.test.js.map +0 -1
  144. package/dist/__tests__/config.test.d.ts +0 -2
  145. package/dist/__tests__/config.test.d.ts.map +0 -1
  146. package/dist/__tests__/config.test.js +0 -75
  147. package/dist/__tests__/config.test.js.map +0 -1
  148. package/dist/__tests__/integration/configure.test.d.ts +0 -2
  149. package/dist/__tests__/integration/configure.test.d.ts.map +0 -1
  150. package/dist/__tests__/integration/configure.test.js +0 -247
  151. package/dist/__tests__/integration/configure.test.js.map +0 -1
  152. package/dist/__tests__/integration/fixtures/configs.d.ts +0 -477
  153. package/dist/__tests__/integration/fixtures/configs.d.ts.map +0 -1
  154. package/dist/__tests__/integration/fixtures/configs.js +0 -175
  155. package/dist/__tests__/integration/fixtures/configs.js.map +0 -1
  156. package/dist/__tests__/integration/helpers/cli-runner.d.ts +0 -63
  157. package/dist/__tests__/integration/helpers/cli-runner.d.ts.map +0 -1
  158. package/dist/__tests__/integration/helpers/cli-runner.js +0 -152
  159. package/dist/__tests__/integration/helpers/cli-runner.js.map +0 -1
  160. package/dist/__tests__/integration/helpers/command-runner.d.ts +0 -53
  161. package/dist/__tests__/integration/helpers/command-runner.d.ts.map +0 -1
  162. package/dist/__tests__/integration/helpers/command-runner.js +0 -117
  163. package/dist/__tests__/integration/helpers/command-runner.js.map +0 -1
  164. package/dist/__tests__/integration/studio-create.test.d.ts +0 -2
  165. package/dist/__tests__/integration/studio-create.test.d.ts.map +0 -1
  166. package/dist/__tests__/integration/studio-create.test.js +0 -209
  167. package/dist/__tests__/integration/studio-create.test.js.map +0 -1
  168. package/dist/__tests__/integration/studio-update.test.d.ts +0 -2
  169. package/dist/__tests__/integration/studio-update.test.d.ts.map +0 -1
  170. package/dist/__tests__/integration/studio-update.test.js +0 -166
  171. package/dist/__tests__/integration/studio-update.test.js.map +0 -1
  172. package/dist/commands/__tests__/configure.test.d.ts +0 -2
  173. package/dist/commands/__tests__/configure.test.d.ts.map +0 -1
  174. package/dist/commands/__tests__/configure.test.js +0 -229
  175. package/dist/commands/__tests__/configure.test.js.map +0 -1
  176. package/dist/prompts/__tests__/environment-setup.test.d.ts +0 -2
  177. package/dist/prompts/__tests__/environment-setup.test.d.ts.map +0 -1
  178. package/dist/prompts/__tests__/environment-setup.test.js +0 -206
  179. package/dist/prompts/__tests__/environment-setup.test.js.map +0 -1
  180. package/dist/prompts/__tests__/hub-integration.test.d.ts +0 -2
  181. package/dist/prompts/__tests__/hub-integration.test.d.ts.map +0 -1
  182. package/dist/prompts/__tests__/hub-integration.test.js +0 -126
  183. package/dist/prompts/__tests__/hub-integration.test.js.map +0 -1
  184. package/dist/prompts/__tests__/prompt-helpers.test.d.ts +0 -2
  185. package/dist/prompts/__tests__/prompt-helpers.test.d.ts.map +0 -1
  186. package/dist/prompts/__tests__/prompt-helpers.test.js +0 -235
  187. package/dist/prompts/__tests__/prompt-helpers.test.js.map +0 -1
  188. package/dist/sembix-cli-1.3.0.tgz +0 -0
  189. package/dist/utils/__tests__/config-file.test.d.ts +0 -2
  190. package/dist/utils/__tests__/config-file.test.d.ts.map +0 -1
  191. package/dist/utils/__tests__/config-file.test.js +0 -218
  192. package/dist/utils/__tests__/config-file.test.js.map +0 -1
  193. package/dist/utils/__tests__/config-loader.test.d.ts +0 -2
  194. package/dist/utils/__tests__/config-loader.test.d.ts.map +0 -1
  195. package/dist/utils/__tests__/config-loader.test.js +0 -325
  196. package/dist/utils/__tests__/config-loader.test.js.map +0 -1
  197. package/dist/utils/__tests__/github.test.d.ts +0 -2
  198. package/dist/utils/__tests__/github.test.d.ts.map +0 -1
  199. package/dist/utils/__tests__/github.test.js +0 -282
  200. package/dist/utils/__tests__/github.test.js.map +0 -1
  201. package/dist/utils/__tests__/ui.test.d.ts +0 -2
  202. package/dist/utils/__tests__/ui.test.d.ts.map +0 -1
  203. package/dist/utils/__tests__/ui.test.js +0 -256
  204. package/dist/utils/__tests__/ui.test.js.map +0 -1
@@ -45,6 +45,8 @@ export async function writeConfig(config) {
45
45
  */
46
46
  function parseConfig(content) {
47
47
  const config = {};
48
+ const profiles = [];
49
+ let currentProfile = null;
48
50
  const lines = content.split('\n');
49
51
  for (const line of lines) {
50
52
  const trimmed = line.trim();
@@ -52,19 +54,71 @@ function parseConfig(content) {
52
54
  if (!trimmed || trimmed.startsWith('#') || trimmed.startsWith(';')) {
53
55
  continue;
54
56
  }
57
+ // Check for profile section header: [profile name]
58
+ const profileMatch = trimmed.match(/^\[profile\s+(.+)\]$/);
59
+ if (profileMatch) {
60
+ // Save previous profile if exists
61
+ if (currentProfile && currentProfile.name) {
62
+ profiles.push(currentProfile);
63
+ }
64
+ // Start new profile
65
+ currentProfile = { name: profileMatch[1].trim() };
66
+ continue;
67
+ }
55
68
  // Parse key=value pairs
56
69
  const match = trimmed.match(/^([^=]+)=(.*)$/);
57
70
  if (match) {
58
71
  const key = match[1].trim();
59
72
  const value = match[2].trim();
60
- if (key === 'github_token') {
61
- config.github_token = value;
73
+ // If we're in a profile section, add to current profile
74
+ if (currentProfile) {
75
+ if (key === 'studio_api_url') {
76
+ currentProfile.studioApiUrl = value;
77
+ }
78
+ else if (key === 'cognito_user_pool_id') {
79
+ currentProfile.cognitoUserPoolId = value;
80
+ }
81
+ else if (key === 'cognito_client_id') {
82
+ currentProfile.cognitoClientId = value;
83
+ }
84
+ else if (key === 'cognito_region') {
85
+ currentProfile.cognitoRegion = value;
86
+ }
87
+ else if (key === 'cognito_domain') {
88
+ currentProfile.cognitoDomain = value;
89
+ }
90
+ else if (key === 'default_project_id') {
91
+ currentProfile.defaultProjectId = value;
92
+ }
62
93
  }
63
- else if (key === 'default_github_org') {
64
- config.default_github_org = value;
94
+ else {
95
+ // Global config keys
96
+ if (key === 'github_token') {
97
+ config.github_token = value;
98
+ }
99
+ else if (key === 'default_github_org') {
100
+ config.default_github_org = value;
101
+ }
102
+ else if (key === 'default_profile') {
103
+ if (!config.studio) {
104
+ config.studio = { profiles: [] };
105
+ }
106
+ config.studio.defaultProfile = value;
107
+ }
65
108
  }
66
109
  }
67
110
  }
111
+ // Save last profile if exists
112
+ if (currentProfile && currentProfile.name) {
113
+ profiles.push(currentProfile);
114
+ }
115
+ // Add profiles to config if any were found
116
+ if (profiles.length > 0) {
117
+ if (!config.studio) {
118
+ config.studio = { profiles: [] };
119
+ }
120
+ config.studio.profiles = profiles;
121
+ }
68
122
  return config;
69
123
  }
70
124
  /**
@@ -82,6 +136,26 @@ function formatConfig(config) {
82
136
  if (config.default_github_org) {
83
137
  lines.push(`default_github_org=${config.default_github_org}`);
84
138
  }
139
+ // Add default profile if set
140
+ if (config.studio?.defaultProfile) {
141
+ lines.push(`default_profile=${config.studio.defaultProfile}`);
142
+ }
143
+ // Add profile sections
144
+ if (config.studio?.profiles && config.studio.profiles.length > 0) {
145
+ lines.push(''); // blank line before profiles
146
+ for (const profile of config.studio.profiles) {
147
+ lines.push(`[profile ${profile.name}]`);
148
+ lines.push(`studio_api_url=${profile.studioApiUrl}`);
149
+ lines.push(`cognito_user_pool_id=${profile.cognitoUserPoolId}`);
150
+ lines.push(`cognito_client_id=${profile.cognitoClientId}`);
151
+ lines.push(`cognito_region=${profile.cognitoRegion}`);
152
+ lines.push(`cognito_domain=${profile.cognitoDomain}`);
153
+ if (profile.defaultProjectId) {
154
+ lines.push(`default_project_id=${profile.defaultProjectId}`);
155
+ }
156
+ lines.push(''); // blank line after each profile
157
+ }
158
+ }
85
159
  lines.push(''); // trailing newline
86
160
  return lines.join('\n');
87
161
  }
@@ -97,4 +171,84 @@ export function getConfigPath() {
97
171
  export function configExists() {
98
172
  return existsSync(CONFIG_FILE);
99
173
  }
174
+ /**
175
+ * Reads a specific Studio profile by name
176
+ * Returns undefined if profile doesn't exist
177
+ */
178
+ export async function readProfile(profileName) {
179
+ const config = await readConfig();
180
+ if (!config.studio?.profiles || config.studio.profiles.length === 0) {
181
+ return undefined;
182
+ }
183
+ // Use provided name, or fall back to default profile, or first profile
184
+ const targetName = profileName || config.studio.defaultProfile || config.studio.profiles[0].name;
185
+ return config.studio.profiles.find(p => p.name === targetName);
186
+ }
187
+ /**
188
+ * Writes or updates a Studio profile
189
+ * Creates the profile if it doesn't exist, updates if it does
190
+ */
191
+ export async function writeProfile(profile) {
192
+ const config = await readConfig();
193
+ if (!config.studio) {
194
+ config.studio = { profiles: [] };
195
+ }
196
+ // Find existing profile index
197
+ const existingIndex = config.studio.profiles.findIndex(p => p.name === profile.name);
198
+ if (existingIndex >= 0) {
199
+ // Update existing profile
200
+ config.studio.profiles[existingIndex] = profile;
201
+ }
202
+ else {
203
+ // Add new profile
204
+ config.studio.profiles.push(profile);
205
+ }
206
+ await writeConfig(config);
207
+ }
208
+ /**
209
+ * Lists all configured Studio profile names
210
+ */
211
+ export async function listProfiles() {
212
+ const config = await readConfig();
213
+ return config.studio?.profiles.map(p => p.name) || [];
214
+ }
215
+ /**
216
+ * Gets the default Studio profile name
217
+ */
218
+ export async function getDefaultProfile() {
219
+ const config = await readConfig();
220
+ return config.studio?.defaultProfile;
221
+ }
222
+ /**
223
+ * Sets the default Studio profile
224
+ */
225
+ export async function setDefaultProfile(profileName) {
226
+ const config = await readConfig();
227
+ if (!config.studio) {
228
+ config.studio = { profiles: [] };
229
+ }
230
+ // Verify profile exists
231
+ const profileExists = config.studio.profiles.some(p => p.name === profileName);
232
+ if (!profileExists) {
233
+ throw new Error(`Profile '${profileName}' does not exist`);
234
+ }
235
+ config.studio.defaultProfile = profileName;
236
+ await writeConfig(config);
237
+ }
238
+ /**
239
+ * Deletes a Studio profile by name
240
+ */
241
+ export async function deleteProfile(profileName) {
242
+ const config = await readConfig();
243
+ if (!config.studio?.profiles) {
244
+ return; // No profiles to delete
245
+ }
246
+ // Filter out the profile to delete
247
+ config.studio.profiles = config.studio.profiles.filter(p => p.name !== profileName);
248
+ // Clear default profile if it was the deleted one
249
+ if (config.studio.defaultProfile === profileName) {
250
+ config.studio.defaultProfile = undefined;
251
+ }
252
+ await writeConfig(config);
253
+ }
100
254
  //# sourceMappingURL=config-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-file.js","sourceRoot":"","sources":["../../src/utils/config-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AAC9C,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAO/C;;GAEG;AACH,KAAK,UAAU,qBAAqB;IAClC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;I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/CD environment
6
+ *
7
+ * @returns true if running in a known CI/CD environment
8
+ */
9
+ export declare function isCIEnvironment(): boolean;
10
+ /**
11
+ * Detects if running in an interactive terminal (TTY)
12
+ *
13
+ * @returns true if running in an interactive terminal with TTY
14
+ */
15
+ export declare function isInteractive(): boolean;
16
+ /**
17
+ * Checks if client credentials are configured via environment variables
18
+ *
19
+ * @returns true if both SEMBIX_CLIENT_ID and SEMBIX_CLIENT_SECRET are set
20
+ */
21
+ export declare function hasClientCredentials(): boolean;
22
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/utils/environment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAWzC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAMvC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAK9C"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Environment detection utilities for authentication flow selection
3
+ */
4
+ /**
5
+ * Detects if running in a CI/CD environment
6
+ *
7
+ * @returns true if running in a known CI/CD environment
8
+ */
9
+ export function isCIEnvironment() {
10
+ return !!(process.env.CI || // Generic CI
11
+ process.env.GITHUB_ACTIONS || // GitHub Actions
12
+ process.env.GITLAB_CI || // GitLab CI
13
+ process.env.JENKINS_URL || // Jenkins
14
+ process.env.CIRCLECI || // CircleCI
15
+ process.env.TRAVIS || // Travis CI
16
+ process.env.BUILDKITE || // Buildkite
17
+ process.env.DRONE // Drone CI
18
+ );
19
+ }
20
+ /**
21
+ * Detects if running in an interactive terminal (TTY)
22
+ *
23
+ * @returns true if running in an interactive terminal with TTY
24
+ */
25
+ export function isInteractive() {
26
+ return !!(process.stdin.isTTY &&
27
+ process.stdout.isTTY &&
28
+ !isCIEnvironment());
29
+ }
30
+ /**
31
+ * Checks if client credentials are configured via environment variables
32
+ *
33
+ * @returns true if both SEMBIX_CLIENT_ID and SEMBIX_CLIENT_SECRET are set
34
+ */
35
+ export function hasClientCredentials() {
36
+ return !!(process.env.SEMBIX_CLIENT_ID &&
37
+ process.env.SEMBIX_CLIENT_SECRET);
38
+ }
39
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/utils/environment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,CAAC,CACP,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,aAAa;QAC/B,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,iBAAiB;QAC/C,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,YAAY;QACrC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,UAAU;QACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,WAAW;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,YAAY;QAClC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,YAAY;QACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW;KAC9B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,CAAC,CAAC,CACP,OAAO,CAAC,KAAK,CAAC,KAAK;QACnB,OAAO,CAAC,MAAM,CAAC,KAAK;QACpB,CAAC,eAAe,EAAE,CACnB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,CAAC,CAAC,CACP,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAC5B,OAAO,CAAC,GAAG,CAAC,oBAAoB,CACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Custom error class for Studio API errors
3
+ * Includes HTTP status code and response body for detailed error handling
4
+ */
5
+ export declare class StudioApiError extends Error {
6
+ statusCode: number;
7
+ responseBody?: string | undefined;
8
+ constructor(message: string, statusCode: number, responseBody?: string | undefined);
9
+ }
10
+ /**
11
+ * Custom error class for Cognito authentication failures
12
+ * Used to distinguish auth errors from other error types
13
+ */
14
+ export declare class AuthenticationError extends Error {
15
+ constructor(message: string);
16
+ }
17
+ /**
18
+ * Custom error class for configuration errors
19
+ * Used when profile configuration is missing or invalid
20
+ */
21
+ export declare class ConfigurationError extends Error {
22
+ constructor(message: string);
23
+ }
24
+ /**
25
+ * Type guard to check if error is a StudioApiError
26
+ */
27
+ export declare function isStudioApiError(error: unknown): error is StudioApiError;
28
+ /**
29
+ * Type guard to check if error is an AuthenticationError
30
+ */
31
+ export declare function isAuthenticationError(error: unknown): error is AuthenticationError;
32
+ /**
33
+ * Type guard to check if error is a ConfigurationError
34
+ */
35
+ export declare function isConfigurationError(error: unknown): error is ConfigurationError;
36
+ /**
37
+ * Centralized error handler for Studio API and authentication errors
38
+ * Formats errors with user-friendly messages and actionable suggestions
39
+ *
40
+ * @param error - The error to handle (can be any type)
41
+ * @param profileName - Optional profile name for authentication suggestions
42
+ */
43
+ export declare function handleApiError(error: unknown, profileName?: string): void;
44
+ /**
45
+ * Wraps an async function with error handling
46
+ * Useful for command handlers to avoid repetitive try-catch blocks
47
+ *
48
+ * @param fn - The async function to wrap
49
+ * @param profileName - Optional profile name for error suggestions
50
+ * @returns A wrapped function that handles errors automatically
51
+ */
52
+ export declare function withErrorHandling<T extends unknown[], R>(fn: (...args: T) => Promise<R>, profileName?: string): (...args: T) => Promise<R | void>;
53
+ //# sourceMappingURL=error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;IAG9B,UAAU,EAAE,MAAM;IAClB,YAAY,CAAC,EAAE,MAAM;gBAF5B,OAAO,EAAE,MAAM,EACR,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,YAAA;CAS/B;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAO5B;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAO5B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAElF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAEhF;AAoBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CA2DzE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EACtD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAC9B,WAAW,CAAC,EAAE,MAAM,GACnB,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CASnC"}
@@ -0,0 +1,174 @@
1
+ import * as ui from './ui.js';
2
+ /**
3
+ * Custom error class for Studio API errors
4
+ * Includes HTTP status code and response body for detailed error handling
5
+ */
6
+ export class StudioApiError extends Error {
7
+ statusCode;
8
+ responseBody;
9
+ constructor(message, statusCode, responseBody) {
10
+ super(message);
11
+ this.statusCode = statusCode;
12
+ this.responseBody = responseBody;
13
+ this.name = 'StudioApiError';
14
+ // Maintains proper stack trace for where error was thrown (V8 only)
15
+ if (Error.captureStackTrace) {
16
+ Error.captureStackTrace(this, StudioApiError);
17
+ }
18
+ }
19
+ }
20
+ /**
21
+ * Custom error class for Cognito authentication failures
22
+ * Used to distinguish auth errors from other error types
23
+ */
24
+ export class AuthenticationError extends Error {
25
+ constructor(message) {
26
+ super(message);
27
+ this.name = 'AuthenticationError';
28
+ if (Error.captureStackTrace) {
29
+ Error.captureStackTrace(this, AuthenticationError);
30
+ }
31
+ }
32
+ }
33
+ /**
34
+ * Custom error class for configuration errors
35
+ * Used when profile configuration is missing or invalid
36
+ */
37
+ export class ConfigurationError extends Error {
38
+ constructor(message) {
39
+ super(message);
40
+ this.name = 'ConfigurationError';
41
+ if (Error.captureStackTrace) {
42
+ Error.captureStackTrace(this, ConfigurationError);
43
+ }
44
+ }
45
+ }
46
+ /**
47
+ * Type guard to check if error is a StudioApiError
48
+ */
49
+ export function isStudioApiError(error) {
50
+ return error instanceof StudioApiError;
51
+ }
52
+ /**
53
+ * Type guard to check if error is an AuthenticationError
54
+ */
55
+ export function isAuthenticationError(error) {
56
+ return error instanceof AuthenticationError;
57
+ }
58
+ /**
59
+ * Type guard to check if error is a ConfigurationError
60
+ */
61
+ export function isConfigurationError(error) {
62
+ return error instanceof ConfigurationError;
63
+ }
64
+ /**
65
+ * Maps HTTP status codes to user-friendly error messages
66
+ */
67
+ function getStatusCodeMessage(statusCode) {
68
+ if (statusCode === 400) {
69
+ return 'Bad request - please check your input parameters';
70
+ }
71
+ else if (statusCode === 401) {
72
+ return 'Authentication failed - please login again';
73
+ }
74
+ else if (statusCode === 403) {
75
+ return 'Access forbidden - please check your permissions';
76
+ }
77
+ else if (statusCode === 404) {
78
+ return 'Resource not found - please verify the workflow ID, run ID, or project ID';
79
+ }
80
+ else if (statusCode >= 500) {
81
+ return 'Server error - please try again later';
82
+ }
83
+ return 'An unexpected error occurred';
84
+ }
85
+ /**
86
+ * Centralized error handler for Studio API and authentication errors
87
+ * Formats errors with user-friendly messages and actionable suggestions
88
+ *
89
+ * @param error - The error to handle (can be any type)
90
+ * @param profileName - Optional profile name for authentication suggestions
91
+ */
92
+ export function handleApiError(error, profileName) {
93
+ if (isStudioApiError(error)) {
94
+ // Handle Studio API errors with status code context
95
+ const statusMessage = getStatusCodeMessage(error.statusCode);
96
+ ui.error(`${statusMessage} (${error.statusCode})`);
97
+ if (error.responseBody) {
98
+ console.log();
99
+ console.log(`Details: ${error.responseBody}`);
100
+ }
101
+ // Provide actionable suggestions for specific status codes
102
+ if (error.statusCode === 401) {
103
+ console.log();
104
+ const loginCmd = profileName
105
+ ? `sembix login --profile ${profileName}`
106
+ : 'sembix login';
107
+ console.log(`Run: ${ui.highlight(loginCmd)}`);
108
+ }
109
+ else if (error.statusCode === 404) {
110
+ console.log();
111
+ console.log('Tip: Use ' + ui.highlight('sembix workflow list') + ' to see available workflows');
112
+ }
113
+ }
114
+ else if (isAuthenticationError(error)) {
115
+ // Handle Cognito authentication errors
116
+ ui.error(error.message);
117
+ console.log();
118
+ const loginCmd = profileName
119
+ ? `sembix login --profile ${profileName}`
120
+ : 'sembix login';
121
+ console.log(`Run: ${ui.highlight(loginCmd)}`);
122
+ }
123
+ else if (isConfigurationError(error)) {
124
+ // Handle configuration errors
125
+ ui.error(error.message);
126
+ console.log();
127
+ console.log('Run: ' + ui.highlight('sembix configure') + ' to set up your profile');
128
+ }
129
+ else if (error instanceof Error) {
130
+ // Handle generic errors
131
+ ui.error(error.message);
132
+ // Check for common error patterns and provide suggestions
133
+ if (error.message.includes('No authentication tokens') ||
134
+ error.message.includes('expired') ||
135
+ error.message.includes('Authentication failed')) {
136
+ console.log();
137
+ const loginCmd = profileName
138
+ ? `sembix login --profile ${profileName}`
139
+ : 'sembix login';
140
+ console.log(`Run: ${ui.highlight(loginCmd)}`);
141
+ }
142
+ else if (error.message.includes('Profile') && error.message.includes('not found')) {
143
+ console.log();
144
+ console.log('Run: ' + ui.highlight('sembix profile list') + ' to see available profiles');
145
+ console.log('Or: ' + ui.highlight('sembix configure') + ' to create a new profile');
146
+ }
147
+ }
148
+ else {
149
+ // Handle unknown error types
150
+ ui.error('An unexpected error occurred');
151
+ console.log();
152
+ console.log(String(error));
153
+ }
154
+ }
155
+ /**
156
+ * Wraps an async function with error handling
157
+ * Useful for command handlers to avoid repetitive try-catch blocks
158
+ *
159
+ * @param fn - The async function to wrap
160
+ * @param profileName - Optional profile name for error suggestions
161
+ * @returns A wrapped function that handles errors automatically
162
+ */
163
+ export function withErrorHandling(fn, profileName) {
164
+ return async (...args) => {
165
+ try {
166
+ return await fn(...args);
167
+ }
168
+ catch (error) {
169
+ handleApiError(error, profileName);
170
+ process.exit(1);
171
+ }
172
+ };
173
+ }
174
+ //# sourceMappingURL=error-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAG9B;IACA;IAHT,YACE,OAAe,EACR,UAAkB,EAClB,YAAqB;QAE5B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAS;QAG5B,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,oEAAoE;QACpE,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;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AC;QACzC,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,EAA8B,EAC9B,WAAoB;IAEpB,OAAO,KAAK,EAAE,GAAG,IAAO,EAAqB,EAAE;QAC7C,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Fuzzy matching utility for searching workflows and projects
3
+ */
4
+ export interface FuzzyMatch<T> {
5
+ item: T;
6
+ score: number;
7
+ matches: number[];
8
+ }
9
+ /**
10
+ * Performs fuzzy matching on a list of items
11
+ * @param query Search query
12
+ * @param items List of items to search
13
+ * @param getText Function to extract searchable text from an item
14
+ * @param minScore Minimum score threshold (default: 100)
15
+ * @returns Sorted array of matches (highest score first)
16
+ */
17
+ export declare function fuzzyMatch<T>(query: string, items: T[], getText: (item: T) => string, minScore?: number): FuzzyMatch<T>[];
18
+ /**
19
+ * Highlights matched characters in terminal output
20
+ * @param text Original text
21
+ * @param matches Array of character indices to highlight
22
+ * @returns Text with ANSI color codes for highlighting
23
+ */
24
+ export declare function highlightMatches(text: string, matches: number[]): string;
25
+ /**
26
+ * Converts a score to a percentage (0-100)
27
+ * @param score Fuzzy match score
28
+ * @returns Percentage (0-100)
29
+ */
30
+ export declare function scoreToPercentage(score: number): number;
31
+ //# sourceMappingURL=fuzzy-match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fuzzy-match.d.ts","sourceRoot":"","sources":["../../src/utils/fuzzy-match.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,EAAE,EACV,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC5B,QAAQ,GAAE,MAAY,GACrB,UAAU,CAAC,CAAC,CAAC,EAAE,CAwBjB;AAsFD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAgBxE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD"}