@sembix/cli 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/USAGE-EXAMPLES.md CHANGED
@@ -869,4 +869,469 @@ sembix workflow run show --workflow-id wf_456 --run-id run_xyz789 --watch
869
869
 
870
870
  ---
871
871
 
872
- **Last Updated**: November 2024
872
+ ## Workflow Input Formats & Validation
873
+
874
+ ### Understanding Workflow Inputs
875
+
876
+ When starting a workflow, you can provide inputs in three formats. The CLI validates all inputs before starting the workflow.
877
+
878
+ ### Format 1: Name-Based (Recommended)
879
+
880
+ Use input variable names from the workflow template:
881
+
882
+ ```bash
883
+ sembix workflow start \
884
+ --project-id proj_abc123 \
885
+ --workflow-id wf_deploy \
886
+ --inputs '{"environment": "production", "version": "1.2.3", "dryRun": false}'
887
+ ```
888
+
889
+ **Advantages:**
890
+ - Human-readable and self-documenting
891
+ - CLI auto-resolves names to IDs
892
+ - Validates required fields and data types
893
+ - Fills optional fields with empty strings automatically
894
+
895
+ **Example with required and optional fields:**
896
+ ```bash
897
+ # Workflow has 4 inputs:
898
+ # - environment (string, required)
899
+ # - version (string, required)
900
+ # - dryRun (boolean, optional)
901
+ # - notes (string, optional)
902
+
903
+ # Only provide required fields:
904
+ sembix workflow start --project-id proj_123 --workflow-id wf_456 \
905
+ --inputs '{"environment": "production", "version": "1.2.3"}'
906
+
907
+ # CLI automatically adds optional fields as empty strings:
908
+ # Final payload sent to API:
909
+ # {
910
+ # "environment": "production",
911
+ # "version": "1.2.3",
912
+ # "dryRun": "",
913
+ # "notes": ""
914
+ # }
915
+ ```
916
+
917
+ ---
918
+
919
+ ### Format 2: ID-Based
920
+
921
+ Use input variable IDs directly:
922
+
923
+ ```bash
924
+ sembix workflow start \
925
+ --project-id proj_abc123 \
926
+ --workflow-id wf_deploy \
927
+ --inputs '[
928
+ {"id": "var_env_123", "instruction": "production"},
929
+ {"id": "var_ver_456", "instruction": "1.2.3"}
930
+ ]'
931
+ ```
932
+
933
+ **When to use:**
934
+ - You know the exact input variable IDs
935
+ - Building dynamic inputs programmatically
936
+ - Working with complex workflows
937
+
938
+ ---
939
+
940
+ ### Format 3: File-Based
941
+
942
+ Store inputs in a JSON file:
943
+
944
+ ```bash
945
+ # inputs.json (name-based)
946
+ {
947
+ "environment": "production",
948
+ "version": "1.2.3",
949
+ "dryRun": false,
950
+ "notes": "Deploying hotfix"
951
+ }
952
+
953
+ # Or inputs.json (ID-based)
954
+ [
955
+ {"id": "var_env_123", "instruction": "production"},
956
+ {"id": "var_ver_456", "instruction": "1.2.3"}
957
+ ]
958
+
959
+ # Use with @ prefix:
960
+ sembix workflow start \
961
+ --project-id proj_abc123 \
962
+ --workflow-id wf_deploy \
963
+ --inputs @inputs.json
964
+ ```
965
+
966
+ **Advantages:**
967
+ - Reusable input configurations
968
+ - Version control your inputs
969
+ - Easier to manage complex inputs
970
+ - Good for CI/CD pipelines
971
+
972
+ ---
973
+
974
+ ### Input Validation Rules
975
+
976
+ The CLI validates all inputs before starting workflows:
977
+
978
+ #### 1. Required Fields Validation
979
+
980
+ ```bash
981
+ # ✗ Missing required field
982
+ $ sembix workflow start --project-id proj_123 --workflow-id wf_456 \
983
+ --inputs '{"version": "1.2.3"}'
984
+
985
+ Error: Input validation failed:
986
+ - Required input "environment" is missing or empty
987
+
988
+ # ✗ Empty required field
989
+ $ sembix workflow start --project-id proj_123 --workflow-id wf_456 \
990
+ --inputs '{"environment": "", "version": "1.2.3"}'
991
+
992
+ Error: Input validation failed:
993
+ - Required input "environment" is missing or empty
994
+
995
+ # ✓ All required fields provided
996
+ $ sembix workflow start --project-id proj_123 --workflow-id wf_456 \
997
+ --inputs '{"environment": "prod", "version": "1.2.3"}'
998
+ ```
999
+
1000
+ ---
1001
+
1002
+ #### 2. Boolean Field Validation
1003
+
1004
+ Boolean fields must be `true`, `false`, or their string equivalents:
1005
+
1006
+ ```bash
1007
+ # ✓ Valid boolean values
1008
+ --inputs '{"dryRun": true}'
1009
+ --inputs '{"dryRun": false}'
1010
+ --inputs '{"dryRun": "true"}'
1011
+ --inputs '{"dryRun": "false"}'
1012
+
1013
+ # ✗ Invalid boolean values
1014
+ --inputs '{"dryRun": "yes"}'
1015
+ # Error: Input "dryRun" must be true or false (got: yes)
1016
+
1017
+ --inputs '{"dryRun": 1}'
1018
+ # Error: Input "dryRun" must be true or false (got: 1)
1019
+
1020
+ --inputs '{"dryRun": "True"}' # Case sensitive!
1021
+ # Error: Input "dryRun" must be true or false (got: True)
1022
+ ```
1023
+
1024
+ **Note:** The CLI converts boolean values to strings before sending to the API:
1025
+ - `true` → `"true"`
1026
+ - `false` → `"false"`
1027
+
1028
+ ---
1029
+
1030
+ #### 3. Optional Field Handling
1031
+
1032
+ Optional fields are **always included** in the final payload, even if not provided:
1033
+
1034
+ ```bash
1035
+ # Example: Workflow with 2 required + 2 optional fields
1036
+
1037
+ # Input provided:
1038
+ --inputs '{"environment": "prod", "version": "1.2.3"}'
1039
+
1040
+ # CLI validates and adds optional fields:
1041
+ {
1042
+ "environment": "prod",
1043
+ "version": "1.2.3",
1044
+ "dryRun": "", // Optional field added as empty string
1045
+ "notes": "" // Optional field added as empty string
1046
+ }
1047
+ ```
1048
+
1049
+ This ensures the API always receives a complete set of inputs.
1050
+
1051
+ ---
1052
+
1053
+ ### Real-World Examples
1054
+
1055
+ #### Example 1: Simple Deployment
1056
+
1057
+ ```bash
1058
+ # Workflow: Deploy Application
1059
+ # Inputs:
1060
+ # - environment (string, required)
1061
+ # - version (string, required)
1062
+ # - rollbackOnFailure (boolean, optional)
1063
+
1064
+ sembix workflow start \
1065
+ --project-id proj_abc123 \
1066
+ --workflow-id wf_deploy \
1067
+ --inputs '{
1068
+ "environment": "production",
1069
+ "version": "v2.3.1",
1070
+ "rollbackOnFailure": true
1071
+ }'
1072
+ ```
1073
+
1074
+ ---
1075
+
1076
+ #### Example 2: Database Migration
1077
+
1078
+ ```bash
1079
+ # Workflow: Run Database Migration
1080
+ # Inputs:
1081
+ # - database (string, required)
1082
+ # - migrationVersion (string, required)
1083
+ # - dryRun (boolean, required)
1084
+ # - backupFirst (boolean, optional)
1085
+ # - notificationEmail (string, optional)
1086
+
1087
+ # Interactive mode (recommended for one-off operations):
1088
+ sembix workflow start --project-id proj_123 --workflow-id wf_migrate
1089
+
1090
+ # Non-interactive with file:
1091
+ cat > migration-inputs.json <<EOF
1092
+ {
1093
+ "database": "production",
1094
+ "migrationVersion": "20240115_001",
1095
+ "dryRun": false,
1096
+ "backupFirst": true,
1097
+ "notificationEmail": "ops@company.com"
1098
+ }
1099
+ EOF
1100
+
1101
+ sembix workflow start \
1102
+ --project-id proj_123 \
1103
+ --workflow-id wf_migrate \
1104
+ --inputs @migration-inputs.json
1105
+ ```
1106
+
1107
+ ---
1108
+
1109
+ #### Example 3: CI/CD Pipeline
1110
+
1111
+ ```bash
1112
+ #!/bin/bash
1113
+ # deploy.sh - Automated deployment script
1114
+
1115
+ PROJECT_ID="proj_abc123"
1116
+ WORKFLOW_ID="wf_deploy"
1117
+ VERSION="${GITHUB_SHA:0:7}"
1118
+ ENVIRONMENT="${DEPLOY_ENV:-staging}"
1119
+
1120
+ # Build inputs JSON
1121
+ INPUTS=$(cat <<EOF
1122
+ {
1123
+ "environment": "${ENVIRONMENT}",
1124
+ "version": "${VERSION}",
1125
+ "dryRun": false,
1126
+ "gitCommit": "${GITHUB_SHA}",
1127
+ "triggeredBy": "${GITHUB_ACTOR}"
1128
+ }
1129
+ EOF
1130
+ )
1131
+
1132
+ # Start workflow
1133
+ sembix workflow start \
1134
+ --project-id "${PROJECT_ID}" \
1135
+ --workflow-id "${WORKFLOW_ID}" \
1136
+ --inputs "${INPUTS}" \
1137
+ --no-interactive
1138
+ ```
1139
+
1140
+ ---
1141
+
1142
+ #### Example 4: Handling Validation Errors
1143
+
1144
+ ```bash
1145
+ # Script with error handling
1146
+ #!/bin/bash
1147
+
1148
+ PROJECT_ID="proj_abc123"
1149
+ WORKFLOW_ID="wf_456"
1150
+
1151
+ # Attempt to start workflow
1152
+ if ! sembix workflow start \
1153
+ --project-id "${PROJECT_ID}" \
1154
+ --workflow-id "${WORKFLOW_ID}" \
1155
+ --inputs '{"environment": "prod"}' 2>&1; then
1156
+
1157
+ echo "❌ Workflow start failed - checking for validation errors..."
1158
+
1159
+ # Try again with all required fields
1160
+ echo "Retrying with complete inputs..."
1161
+ sembix workflow start \
1162
+ --project-id "${PROJECT_ID}" \
1163
+ --workflow-id "${WORKFLOW_ID}" \
1164
+ --inputs '{
1165
+ "environment": "prod",
1166
+ "version": "1.2.3",
1167
+ "dryRun": false
1168
+ }'
1169
+ fi
1170
+ ```
1171
+
1172
+ ---
1173
+
1174
+ ### Interactive vs Non-Interactive Mode
1175
+
1176
+ #### Interactive Mode (Default)
1177
+
1178
+ When `--inputs` is not provided, CLI prompts for each input:
1179
+
1180
+ ```bash
1181
+ $ sembix workflow start --project-id proj_123 --workflow-id wf_456
1182
+
1183
+ This workflow requires 4 input(s):
1184
+
1185
+ environment
1186
+ The deployment environment
1187
+
1188
+ ✔ environment (required): production
1189
+
1190
+ version
1191
+ The version to deploy
1192
+
1193
+ ✔ version (required): 1.2.3
1194
+
1195
+ dryRun
1196
+ Run in dry-run mode?
1197
+
1198
+ ✔ dryRun (optional): [y/n] n
1199
+
1200
+ notes
1201
+ Deployment notes
1202
+
1203
+ ✔ notes (optional):
1204
+
1205
+ ✓ Workflow started successfully!
1206
+ ```
1207
+
1208
+ **Interactive mode benefits:**
1209
+ - See all input descriptions
1210
+ - Validation happens as you type
1211
+ - Guided experience for complex workflows
1212
+ - Required vs optional clearly marked
1213
+
1214
+ ---
1215
+
1216
+ #### Non-Interactive Mode
1217
+
1218
+ Use `--no-interactive` to skip prompts (requires `--inputs`):
1219
+
1220
+ ```bash
1221
+ sembix workflow start \
1222
+ --project-id proj_123 \
1223
+ --workflow-id wf_456 \
1224
+ --inputs '{"environment": "prod", "version": "1.2.3"}' \
1225
+ --no-interactive
1226
+ ```
1227
+
1228
+ **Non-interactive benefits:**
1229
+ - Suitable for automation/CI/CD
1230
+ - Fast execution
1231
+ - Predictable behavior
1232
+
1233
+ ---
1234
+
1235
+ ### Best Practices
1236
+
1237
+ #### ✅ DO
1238
+
1239
+ - **Use name-based format** for readability
1240
+ ```bash
1241
+ --inputs '{"environment": "prod", "version": "1.2.3"}'
1242
+ ```
1243
+
1244
+ - **Store complex inputs in files**
1245
+ ```bash
1246
+ --inputs @production-config.json
1247
+ ```
1248
+
1249
+ - **Validate locally first** using interactive mode
1250
+ ```bash
1251
+ sembix workflow start # Test interactively first
1252
+ ```
1253
+
1254
+ - **Handle validation errors** in scripts
1255
+ ```bash
1256
+ if ! sembix workflow start --inputs '{...}'; then
1257
+ echo "Validation failed"
1258
+ exit 1
1259
+ fi
1260
+ ```
1261
+
1262
+ - **Use boolean true/false** (not strings)
1263
+ ```bash
1264
+ --inputs '{"dryRun": true}' # ✓ Good
1265
+ --inputs '{"dryRun": false}' # ✓ Good
1266
+ ```
1267
+
1268
+ ---
1269
+
1270
+ #### ❌ DON'T
1271
+
1272
+ - **Don't use invalid boolean strings**
1273
+ ```bash
1274
+ --inputs '{"enabled": "yes"}' # ✗ Error
1275
+ --inputs '{"enabled": "True"}' # ✗ Case sensitive
1276
+ ```
1277
+
1278
+ - **Don't leave required fields empty**
1279
+ ```bash
1280
+ --inputs '{"environment": ""}' # ✗ Validation error
1281
+ ```
1282
+
1283
+ - **Don't assume optional fields can be omitted from payload**
1284
+ - CLI handles this automatically - optional fields are added as `""`
1285
+
1286
+ - **Don't hard-code sensitive values**
1287
+ ```bash
1288
+ # ✗ Bad
1289
+ --inputs '{"apiKey": "secret123"}'
1290
+
1291
+ # ✓ Good - use environment variables
1292
+ --inputs "{\"apiKey\": \"${API_KEY}\"}"
1293
+ ```
1294
+
1295
+ ---
1296
+
1297
+ ### Troubleshooting
1298
+
1299
+ #### "Input validation failed" errors
1300
+
1301
+ ```bash
1302
+ Error: Input validation failed:
1303
+ - Required input "environment" is missing or empty
1304
+ - Required input "version" is missing or empty
1305
+ ```
1306
+
1307
+ **Solution:** Provide all required fields with non-empty values.
1308
+
1309
+ ---
1310
+
1311
+ #### "must be true or false" errors
1312
+
1313
+ ```bash
1314
+ Error: Input validation failed:
1315
+ - Input "dryRun" must be true or false (got: yes)
1316
+ ```
1317
+
1318
+ **Solution:** Use boolean `true`/`false` or strings `"true"`/`"false"`.
1319
+
1320
+ ---
1321
+
1322
+ #### "Input variable name not found" errors
1323
+
1324
+ ```bash
1325
+ Error: Input variable name "environemnt" not found in workflow template.
1326
+
1327
+ Available input variables:
1328
+ - environment
1329
+ - version
1330
+ - dryRun
1331
+ ```
1332
+
1333
+ **Solution:** Fix the typo in the input name (check spelling and capitalization).
1334
+
1335
+ ---
1336
+
1337
+ **Last Updated**: December 2024
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAmV9F;AAMD,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM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10 +216,50 @@ export async function workflowStartCommand(options) {
216
216
  else {
217
217
  inputsJson = options.inputs;
218
218
  }
219
- // Auto-detect format and parse
219
+ // Detect if name-based format (needs template)
220
+ let template;
221
+ try {
222
+ const parsed = JSON.parse(inputsJson);
223
+ // Check if simple object (name-based)
224
+ const isNameBased = !Array.isArray(parsed) &&
225
+ typeof parsed === 'object' &&
226
+ parsed !== null &&
227
+ !('initialInstructions' in parsed) &&
228
+ !('workspaceMetadata' in parsed);
229
+ if (isNameBased) {
230
+ // Fetch template for name resolution
231
+ const spinner = ui.spinner('Fetching workflow template for input name resolution...');
232
+ spinner.start();
233
+ const workflowTemplate = await apiClient.getWorkflowTemplateForWorkflow(projectId, workflowId);
234
+ spinner.stop();
235
+ if (!workflowTemplate) {
236
+ throw new Error('Cannot use name-based inputs: workflow has no template.\n\n' +
237
+ 'Use ID-based format instead:\n' +
238
+ ' --inputs \'[{"id": "var_123", "instruction": "value"}]\'\n\n' +
239
+ 'To find available input IDs, run:\n' +
240
+ ' sembix workflow template show --project-id ' + projectId + ' --workflow-id ' + workflowId);
241
+ }
242
+ // Extract template instructions (try Start step first, then root level)
243
+ const startStep = workflowTemplate.steps?.find(step => step.name === 'Start');
244
+ template = startStep?.initialInstructions ||
245
+ workflowTemplate.inputVariables ||
246
+ workflowTemplate.initialInstructions;
247
+ }
248
+ }
249
+ catch (parseError) {
250
+ // Re-throw non-JSON parsing errors (like template fetch failures)
251
+ if (parseError instanceof SyntaxError) {
252
+ // JSON parsing error - let parseWorkflowInputs handle it
253
+ }
254
+ else {
255
+ // Other errors (e.g., template fetch failures) should be re-thrown
256
+ throw parseError;
257
+ }
258
+ }
259
+ // Parse inputs with template if needed
220
260
  try {
221
261
  const { parseWorkflowInputs } = await import('../utils/input-parser.js');
222
- const parsedConfig = parseWorkflowInputs(inputsJson);
262
+ const parsedConfig = parseWorkflowInputs({ inputsJson, template, validate: true });
223
263
  Object.assign(startConfiguration, parsedConfig);
224
264
  }
225
265
  catch (error) {