@outputai/cli 0.8.2-next.2da7213.0 → 0.8.2-next.e1cd79b.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.
- package/dist/assets/docker/docker-compose-dev.yml +1 -1
- package/dist/commands/workflow/cost.d.ts +2 -3
- package/dist/commands/workflow/cost.js +11 -4
- package/dist/commands/workflow/cost.spec.js +3 -1
- package/dist/commands/workflow/dataset/list.d.ts +1 -3
- package/dist/commands/workflow/dataset/list.js +14 -10
- package/dist/commands/workflow/debug.d.ts +6 -2
- package/dist/commands/workflow/debug.js +29 -10
- package/dist/commands/workflow/debug.spec.js +5 -2
- package/dist/commands/workflow/list.d.ts +1 -4
- package/dist/commands/workflow/list.js +19 -15
- package/dist/commands/workflow/list.spec.js +1 -2
- package/dist/commands/workflow/result.d.ts +4 -3
- package/dist/commands/workflow/result.js +15 -6
- package/dist/commands/workflow/result.spec.js +4 -2
- package/dist/commands/workflow/run.d.ts +2 -3
- package/dist/commands/workflow/run.js +11 -4
- package/dist/commands/workflow/run.spec.js +3 -1
- package/dist/commands/workflow/runs/list.d.ts +1 -3
- package/dist/commands/workflow/runs/list.js +15 -11
- package/dist/commands/workflow/status.d.ts +4 -3
- package/dist/commands/workflow/status.js +30 -20
- package/dist/commands/workflow/status.spec.js +4 -2
- package/dist/commands/workflow/test_eval.d.ts +2 -3
- package/dist/commands/workflow/test_eval.js +15 -5
- package/dist/generated/framework_version.json +1 -1
- package/dist/hooks/init.d.ts +0 -1
- package/dist/hooks/init.js +30 -40
- package/dist/hooks/init.spec.js +4 -28
- package/dist/utils/constants.d.ts +5 -0
- package/dist/utils/constants.js +4 -0
- package/dist/utils/format_workflow_result.spec.js +13 -0
- package/dist/utils/output_formatter.d.ts +2 -0
- package/dist/utils/output_formatter.js +11 -0
- package/dist/utils/trace_formatter.js +2 -1
- package/oclif.manifest.json +101 -82
- package/package.json +4 -4
- package/dist/commands/workflow/test_eval.spec.d.ts +0 -1
- package/dist/commands/workflow/test_eval.spec.js +0 -84
package/oclif.manifest.json
CHANGED
|
@@ -535,15 +535,21 @@
|
|
|
535
535
|
"<%= config.bin %> <%= command.id %> my_workflow_id",
|
|
536
536
|
"<%= config.bin %> <%= command.id %> my_workflow_id --verbose",
|
|
537
537
|
"<%= config.bin %> <%= command.id %> my_workflow_id path/to/trace.json",
|
|
538
|
-
"<%= config.bin %> <%= command.id %> my_workflow_id --json"
|
|
538
|
+
"<%= config.bin %> <%= command.id %> my_workflow_id --format json"
|
|
539
539
|
],
|
|
540
540
|
"flags": {
|
|
541
|
-
"
|
|
542
|
-
"
|
|
543
|
-
"
|
|
544
|
-
"name": "
|
|
545
|
-
"
|
|
546
|
-
"
|
|
541
|
+
"format": {
|
|
542
|
+
"char": "f",
|
|
543
|
+
"description": "Output format",
|
|
544
|
+
"name": "format",
|
|
545
|
+
"default": "text",
|
|
546
|
+
"hasDynamicHelp": false,
|
|
547
|
+
"multiple": false,
|
|
548
|
+
"options": [
|
|
549
|
+
"json",
|
|
550
|
+
"text"
|
|
551
|
+
],
|
|
552
|
+
"type": "option"
|
|
547
553
|
},
|
|
548
554
|
"verbose": {
|
|
549
555
|
"description": "Show detailed per-call breakdown",
|
|
@@ -559,7 +565,7 @@
|
|
|
559
565
|
"pluginName": "@outputai/cli",
|
|
560
566
|
"pluginType": "core",
|
|
561
567
|
"strict": true,
|
|
562
|
-
"enableJsonFlag":
|
|
568
|
+
"enableJsonFlag": false,
|
|
563
569
|
"isESM": true,
|
|
564
570
|
"relativePath": [
|
|
565
571
|
"dist",
|
|
@@ -580,15 +586,22 @@
|
|
|
580
586
|
"description": "Get and display workflow execution trace for debugging",
|
|
581
587
|
"examples": [
|
|
582
588
|
"<%= config.bin %> <%= command.id %> wf-12345",
|
|
583
|
-
"<%= config.bin %> <%= command.id %> wf-12345 --json"
|
|
589
|
+
"<%= config.bin %> <%= command.id %> wf-12345 --format json",
|
|
590
|
+
"<%= config.bin %> <%= command.id %> wf-12345 --format text"
|
|
584
591
|
],
|
|
585
592
|
"flags": {
|
|
586
|
-
"
|
|
587
|
-
"
|
|
588
|
-
"
|
|
589
|
-
"name": "
|
|
590
|
-
"
|
|
591
|
-
"
|
|
593
|
+
"format": {
|
|
594
|
+
"char": "f",
|
|
595
|
+
"description": "Output format",
|
|
596
|
+
"name": "format",
|
|
597
|
+
"default": "text",
|
|
598
|
+
"hasDynamicHelp": false,
|
|
599
|
+
"multiple": false,
|
|
600
|
+
"options": [
|
|
601
|
+
"json",
|
|
602
|
+
"text"
|
|
603
|
+
],
|
|
604
|
+
"type": "option"
|
|
592
605
|
}
|
|
593
606
|
},
|
|
594
607
|
"hasDynamicHelp": false,
|
|
@@ -598,7 +611,7 @@
|
|
|
598
611
|
"pluginName": "@outputai/cli",
|
|
599
612
|
"pluginType": "core",
|
|
600
613
|
"strict": true,
|
|
601
|
-
"enableJsonFlag":
|
|
614
|
+
"enableJsonFlag": false,
|
|
602
615
|
"isESM": true,
|
|
603
616
|
"relativePath": [
|
|
604
617
|
"dist",
|
|
@@ -689,19 +702,12 @@
|
|
|
689
702
|
"examples": [
|
|
690
703
|
"<%= config.bin %> <%= command.id %>",
|
|
691
704
|
"<%= config.bin %> <%= command.id %> --format table",
|
|
692
|
-
"<%= config.bin %> <%= command.id %> --json",
|
|
705
|
+
"<%= config.bin %> <%= command.id %> --format json",
|
|
693
706
|
"<%= config.bin %> <%= command.id %> --detailed",
|
|
694
707
|
"<%= config.bin %> <%= command.id %> --filter simple",
|
|
695
708
|
"<%= config.bin %> <%= command.id %> --catalog my-catalog"
|
|
696
709
|
],
|
|
697
710
|
"flags": {
|
|
698
|
-
"json": {
|
|
699
|
-
"description": "Format output as json.",
|
|
700
|
-
"helpGroup": "GLOBAL",
|
|
701
|
-
"name": "json",
|
|
702
|
-
"allowNo": false,
|
|
703
|
-
"type": "boolean"
|
|
704
|
-
},
|
|
705
711
|
"catalog": {
|
|
706
712
|
"aliases": [
|
|
707
713
|
"task-queue"
|
|
@@ -720,14 +726,15 @@
|
|
|
720
726
|
},
|
|
721
727
|
"format": {
|
|
722
728
|
"char": "f",
|
|
723
|
-
"description": "Output format
|
|
729
|
+
"description": "Output format",
|
|
724
730
|
"name": "format",
|
|
725
731
|
"default": "list",
|
|
726
732
|
"hasDynamicHelp": false,
|
|
727
733
|
"multiple": false,
|
|
728
734
|
"options": [
|
|
729
735
|
"list",
|
|
730
|
-
"table"
|
|
736
|
+
"table",
|
|
737
|
+
"json"
|
|
731
738
|
],
|
|
732
739
|
"type": "option"
|
|
733
740
|
},
|
|
@@ -753,7 +760,7 @@
|
|
|
753
760
|
"pluginName": "@outputai/cli",
|
|
754
761
|
"pluginType": "core",
|
|
755
762
|
"strict": true,
|
|
756
|
-
"enableJsonFlag":
|
|
763
|
+
"enableJsonFlag": false,
|
|
757
764
|
"isESM": true,
|
|
758
765
|
"relativePath": [
|
|
759
766
|
"dist",
|
|
@@ -865,15 +872,21 @@
|
|
|
865
872
|
"description": "Get workflow execution result",
|
|
866
873
|
"examples": [
|
|
867
874
|
"<%= config.bin %> <%= command.id %> wf-12345",
|
|
868
|
-
"<%= config.bin %> <%= command.id %> wf-12345 --json"
|
|
875
|
+
"<%= config.bin %> <%= command.id %> wf-12345 --format json"
|
|
869
876
|
],
|
|
870
877
|
"flags": {
|
|
871
|
-
"
|
|
872
|
-
"
|
|
873
|
-
"
|
|
874
|
-
"name": "
|
|
875
|
-
"
|
|
876
|
-
"
|
|
878
|
+
"format": {
|
|
879
|
+
"char": "f",
|
|
880
|
+
"description": "Output format",
|
|
881
|
+
"name": "format",
|
|
882
|
+
"default": "text",
|
|
883
|
+
"hasDynamicHelp": false,
|
|
884
|
+
"multiple": false,
|
|
885
|
+
"options": [
|
|
886
|
+
"json",
|
|
887
|
+
"text"
|
|
888
|
+
],
|
|
889
|
+
"type": "option"
|
|
877
890
|
}
|
|
878
891
|
},
|
|
879
892
|
"hasDynamicHelp": false,
|
|
@@ -883,7 +896,7 @@
|
|
|
883
896
|
"pluginName": "@outputai/cli",
|
|
884
897
|
"pluginType": "core",
|
|
885
898
|
"strict": true,
|
|
886
|
-
"enableJsonFlag":
|
|
899
|
+
"enableJsonFlag": false,
|
|
887
900
|
"isESM": true,
|
|
888
901
|
"relativePath": [
|
|
889
902
|
"dist",
|
|
@@ -909,19 +922,12 @@
|
|
|
909
922
|
"description": "Execute a workflow synchronously and wait for completion",
|
|
910
923
|
"examples": [
|
|
911
924
|
"<%= config.bin %> <%= command.id %> simple basic_input",
|
|
912
|
-
"<%= config.bin %> <%= command.id %> simple my_scenario --json",
|
|
925
|
+
"<%= config.bin %> <%= command.id %> simple my_scenario --format json",
|
|
913
926
|
"<%= config.bin %> <%= command.id %> simple --input '{\"values\":[1,2,3]}'",
|
|
914
927
|
"<%= config.bin %> <%= command.id %> simple --input input.json",
|
|
915
928
|
"<%= config.bin %> <%= command.id %> simple --input '{\"key\":\"value\"}' --catalog my-catalog"
|
|
916
929
|
],
|
|
917
930
|
"flags": {
|
|
918
|
-
"json": {
|
|
919
|
-
"description": "Format output as json.",
|
|
920
|
-
"helpGroup": "GLOBAL",
|
|
921
|
-
"name": "json",
|
|
922
|
-
"allowNo": false,
|
|
923
|
-
"type": "boolean"
|
|
924
|
-
},
|
|
925
931
|
"input": {
|
|
926
932
|
"char": "i",
|
|
927
933
|
"description": "Workflow input as JSON string or file path (overrides scenario)",
|
|
@@ -946,6 +952,19 @@
|
|
|
946
952
|
"hasDynamicHelp": false,
|
|
947
953
|
"multiple": false,
|
|
948
954
|
"type": "option"
|
|
955
|
+
},
|
|
956
|
+
"format": {
|
|
957
|
+
"char": "f",
|
|
958
|
+
"description": "Output format",
|
|
959
|
+
"name": "format",
|
|
960
|
+
"default": "text",
|
|
961
|
+
"hasDynamicHelp": false,
|
|
962
|
+
"multiple": false,
|
|
963
|
+
"options": [
|
|
964
|
+
"json",
|
|
965
|
+
"text"
|
|
966
|
+
],
|
|
967
|
+
"type": "option"
|
|
949
968
|
}
|
|
950
969
|
},
|
|
951
970
|
"hasDynamicHelp": false,
|
|
@@ -955,7 +974,7 @@
|
|
|
955
974
|
"pluginName": "@outputai/cli",
|
|
956
975
|
"pluginType": "core",
|
|
957
976
|
"strict": true,
|
|
958
|
-
"enableJsonFlag":
|
|
977
|
+
"enableJsonFlag": false,
|
|
959
978
|
"isESM": true,
|
|
960
979
|
"relativePath": [
|
|
961
980
|
"dist",
|
|
@@ -1040,15 +1059,21 @@
|
|
|
1040
1059
|
"description": "Get workflow execution status",
|
|
1041
1060
|
"examples": [
|
|
1042
1061
|
"<%= config.bin %> <%= command.id %> wf-12345",
|
|
1043
|
-
"<%= config.bin %> <%= command.id %> wf-12345 --json"
|
|
1062
|
+
"<%= config.bin %> <%= command.id %> wf-12345 --format json"
|
|
1044
1063
|
],
|
|
1045
1064
|
"flags": {
|
|
1046
|
-
"
|
|
1047
|
-
"
|
|
1048
|
-
"
|
|
1049
|
-
"name": "
|
|
1050
|
-
"
|
|
1051
|
-
"
|
|
1065
|
+
"format": {
|
|
1066
|
+
"char": "f",
|
|
1067
|
+
"description": "Output format",
|
|
1068
|
+
"name": "format",
|
|
1069
|
+
"default": "text",
|
|
1070
|
+
"hasDynamicHelp": false,
|
|
1071
|
+
"multiple": false,
|
|
1072
|
+
"options": [
|
|
1073
|
+
"json",
|
|
1074
|
+
"text"
|
|
1075
|
+
],
|
|
1076
|
+
"type": "option"
|
|
1052
1077
|
}
|
|
1053
1078
|
},
|
|
1054
1079
|
"hasDynamicHelp": false,
|
|
@@ -1058,7 +1083,7 @@
|
|
|
1058
1083
|
"pluginName": "@outputai/cli",
|
|
1059
1084
|
"pluginType": "core",
|
|
1060
1085
|
"strict": true,
|
|
1061
|
-
"enableJsonFlag":
|
|
1086
|
+
"enableJsonFlag": false,
|
|
1062
1087
|
"isESM": true,
|
|
1063
1088
|
"relativePath": [
|
|
1064
1089
|
"dist",
|
|
@@ -1154,16 +1179,9 @@
|
|
|
1154
1179
|
"<%= config.bin %> <%= command.id %> simple --cached",
|
|
1155
1180
|
"<%= config.bin %> <%= command.id %> simple --save",
|
|
1156
1181
|
"<%= config.bin %> <%= command.id %> simple --dataset basic_input,edge_case",
|
|
1157
|
-
"<%= config.bin %> <%= command.id %> simple --json"
|
|
1182
|
+
"<%= config.bin %> <%= command.id %> simple --format json"
|
|
1158
1183
|
],
|
|
1159
1184
|
"flags": {
|
|
1160
|
-
"json": {
|
|
1161
|
-
"description": "Format output as json.",
|
|
1162
|
-
"helpGroup": "GLOBAL",
|
|
1163
|
-
"name": "json",
|
|
1164
|
-
"allowNo": false,
|
|
1165
|
-
"type": "boolean"
|
|
1166
|
-
},
|
|
1167
1185
|
"cached": {
|
|
1168
1186
|
"description": "Use cached output from dataset files (skip workflow execution)",
|
|
1169
1187
|
"exclusive": [
|
|
@@ -1189,6 +1207,19 @@
|
|
|
1189
1207
|
"hasDynamicHelp": false,
|
|
1190
1208
|
"multiple": false,
|
|
1191
1209
|
"type": "option"
|
|
1210
|
+
},
|
|
1211
|
+
"format": {
|
|
1212
|
+
"char": "f",
|
|
1213
|
+
"description": "Output format",
|
|
1214
|
+
"name": "format",
|
|
1215
|
+
"default": "text",
|
|
1216
|
+
"hasDynamicHelp": false,
|
|
1217
|
+
"multiple": false,
|
|
1218
|
+
"options": [
|
|
1219
|
+
"json",
|
|
1220
|
+
"text"
|
|
1221
|
+
],
|
|
1222
|
+
"type": "option"
|
|
1192
1223
|
}
|
|
1193
1224
|
},
|
|
1194
1225
|
"hasDynamicHelp": false,
|
|
@@ -1198,7 +1229,7 @@
|
|
|
1198
1229
|
"pluginName": "@outputai/cli",
|
|
1199
1230
|
"pluginType": "core",
|
|
1200
1231
|
"strict": true,
|
|
1201
|
-
"enableJsonFlag":
|
|
1232
|
+
"enableJsonFlag": false,
|
|
1202
1233
|
"isESM": true,
|
|
1203
1234
|
"relativePath": [
|
|
1204
1235
|
"dist",
|
|
@@ -1304,26 +1335,20 @@
|
|
|
1304
1335
|
"description": "List datasets for a workflow",
|
|
1305
1336
|
"examples": [
|
|
1306
1337
|
"<%= config.bin %> <%= command.id %> simple",
|
|
1307
|
-
"<%= config.bin %> <%= command.id %> simple --json",
|
|
1338
|
+
"<%= config.bin %> <%= command.id %> simple --format json",
|
|
1308
1339
|
"<%= config.bin %> <%= command.id %> simple --format table"
|
|
1309
1340
|
],
|
|
1310
1341
|
"flags": {
|
|
1311
|
-
"json": {
|
|
1312
|
-
"description": "Format output as json.",
|
|
1313
|
-
"helpGroup": "GLOBAL",
|
|
1314
|
-
"name": "json",
|
|
1315
|
-
"allowNo": false,
|
|
1316
|
-
"type": "boolean"
|
|
1317
|
-
},
|
|
1318
1342
|
"format": {
|
|
1319
1343
|
"char": "f",
|
|
1320
|
-
"description": "Output format
|
|
1344
|
+
"description": "Output format",
|
|
1321
1345
|
"name": "format",
|
|
1322
1346
|
"default": "table",
|
|
1323
1347
|
"hasDynamicHelp": false,
|
|
1324
1348
|
"multiple": false,
|
|
1325
1349
|
"options": [
|
|
1326
1350
|
"table",
|
|
1351
|
+
"json",
|
|
1327
1352
|
"text"
|
|
1328
1353
|
],
|
|
1329
1354
|
"type": "option"
|
|
@@ -1336,7 +1361,7 @@
|
|
|
1336
1361
|
"pluginName": "@outputai/cli",
|
|
1337
1362
|
"pluginType": "core",
|
|
1338
1363
|
"strict": true,
|
|
1339
|
-
"enableJsonFlag":
|
|
1364
|
+
"enableJsonFlag": false,
|
|
1340
1365
|
"isESM": true,
|
|
1341
1366
|
"relativePath": [
|
|
1342
1367
|
"dist",
|
|
@@ -1361,17 +1386,10 @@
|
|
|
1361
1386
|
"<%= config.bin %> <%= command.id %> simple",
|
|
1362
1387
|
"<%= config.bin %> <%= command.id %> simple --limit 10",
|
|
1363
1388
|
"<%= config.bin %> <%= command.id %> --catalog my-catalog",
|
|
1364
|
-
"<%= config.bin %> <%= command.id %> --json",
|
|
1389
|
+
"<%= config.bin %> <%= command.id %> --format json",
|
|
1365
1390
|
"<%= config.bin %> <%= command.id %> --format table"
|
|
1366
1391
|
],
|
|
1367
1392
|
"flags": {
|
|
1368
|
-
"json": {
|
|
1369
|
-
"description": "Format output as json.",
|
|
1370
|
-
"helpGroup": "GLOBAL",
|
|
1371
|
-
"name": "json",
|
|
1372
|
-
"allowNo": false,
|
|
1373
|
-
"type": "boolean"
|
|
1374
|
-
},
|
|
1375
1393
|
"catalog": {
|
|
1376
1394
|
"char": "c",
|
|
1377
1395
|
"description": "Filter runs by catalog (defaults to OUTPUT_CATALOG_ID)",
|
|
@@ -1392,13 +1410,14 @@
|
|
|
1392
1410
|
},
|
|
1393
1411
|
"format": {
|
|
1394
1412
|
"char": "f",
|
|
1395
|
-
"description": "Output format
|
|
1413
|
+
"description": "Output format",
|
|
1396
1414
|
"name": "format",
|
|
1397
1415
|
"default": "table",
|
|
1398
1416
|
"hasDynamicHelp": false,
|
|
1399
1417
|
"multiple": false,
|
|
1400
1418
|
"options": [
|
|
1401
1419
|
"table",
|
|
1420
|
+
"json",
|
|
1402
1421
|
"text"
|
|
1403
1422
|
],
|
|
1404
1423
|
"type": "option"
|
|
@@ -1411,7 +1430,7 @@
|
|
|
1411
1430
|
"pluginName": "@outputai/cli",
|
|
1412
1431
|
"pluginType": "core",
|
|
1413
1432
|
"strict": true,
|
|
1414
|
-
"enableJsonFlag":
|
|
1433
|
+
"enableJsonFlag": false,
|
|
1415
1434
|
"isESM": true,
|
|
1416
1435
|
"relativePath": [
|
|
1417
1436
|
"dist",
|
|
@@ -1422,5 +1441,5 @@
|
|
|
1422
1441
|
]
|
|
1423
1442
|
}
|
|
1424
1443
|
},
|
|
1425
|
-
"version": "0.8.2-next.
|
|
1444
|
+
"version": "0.8.2-next.e1cd79b.0"
|
|
1426
1445
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outputai/cli",
|
|
3
|
-
"version": "0.8.2-next.
|
|
3
|
+
"version": "0.8.2-next.e1cd79b.0",
|
|
4
4
|
"description": "CLI for Output.ai workflow generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"semver": "7.7.4",
|
|
37
37
|
"undici": "8.1.0",
|
|
38
38
|
"yaml": "^2.8.3",
|
|
39
|
-
"@outputai/credentials": "0.8.2-next.
|
|
40
|
-
"@outputai/evals": "0.8.2-next.
|
|
41
|
-
"@outputai/llm": "0.8.2-next.
|
|
39
|
+
"@outputai/credentials": "0.8.2-next.e1cd79b.0",
|
|
40
|
+
"@outputai/evals": "0.8.2-next.e1cd79b.0",
|
|
41
|
+
"@outputai/llm": "0.8.2-next.e1cd79b.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/cli-progress": "3.11.6",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
3
|
-
import { getEvalWorkflowName, renderEvalOutput } from '@outputai/evals';
|
|
4
|
-
vi.mock('#api/generated/api.js', () => ({
|
|
5
|
-
postWorkflowRun: vi.fn()
|
|
6
|
-
}));
|
|
7
|
-
vi.mock('#services/datasets.js', () => ({
|
|
8
|
-
readAllDatasets: vi.fn(),
|
|
9
|
-
writeDataset: vi.fn()
|
|
10
|
-
}));
|
|
11
|
-
const passingOutput = {
|
|
12
|
-
cases: [{ datasetName: 'd1', verdict: 'pass', evaluators: [] }],
|
|
13
|
-
summary: { total: 1, passed: 1, partial: 0, failed: 0, acceptableRate: 1 }
|
|
14
|
-
};
|
|
15
|
-
const failingOutput = {
|
|
16
|
-
cases: [{ datasetName: 'd1', verdict: 'fail', evaluators: [] }],
|
|
17
|
-
summary: { total: 1, passed: 0, partial: 0, failed: 1, acceptableRate: 0 }
|
|
18
|
-
};
|
|
19
|
-
describe('workflow test command', () => {
|
|
20
|
-
const exitState = { original: undefined };
|
|
21
|
-
beforeEach(async () => {
|
|
22
|
-
vi.clearAllMocks();
|
|
23
|
-
exitState.original = process.exitCode;
|
|
24
|
-
process.exitCode = undefined;
|
|
25
|
-
const { readAllDatasets } = await import('#services/datasets.js');
|
|
26
|
-
vi.mocked(readAllDatasets).mockResolvedValue({
|
|
27
|
-
datasets: [{ name: 'd1', input: {}, last_output: { output: {}, date: '2026-01-01' } }],
|
|
28
|
-
dir: '/tmp/datasets'
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
afterEach(() => {
|
|
32
|
-
process.exitCode = exitState.original;
|
|
33
|
-
});
|
|
34
|
-
describe('command definition', () => {
|
|
35
|
-
it('enables the built-in --json flag', async () => {
|
|
36
|
-
const WorkflowTest = (await import('./test_eval.js')).default;
|
|
37
|
-
expect(WorkflowTest.enableJsonFlag).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
describe('run()', () => {
|
|
41
|
-
const createCommand = async (jsonEnabled) => {
|
|
42
|
-
const WorkflowTest = (await import('./test_eval.js')).default;
|
|
43
|
-
const { postWorkflowRun } = await import('#api/generated/api.js');
|
|
44
|
-
const cmd = new WorkflowTest(['simple'], {});
|
|
45
|
-
cmd.log = vi.fn();
|
|
46
|
-
cmd.jsonEnabled = vi.fn().mockReturnValue(jsonEnabled);
|
|
47
|
-
cmd.parse = vi.fn().mockResolvedValue({
|
|
48
|
-
args: { workflowName: 'simple' },
|
|
49
|
-
flags: { cached: true, save: false, dataset: undefined }
|
|
50
|
-
});
|
|
51
|
-
return { cmd, postWorkflowRun: vi.mocked(postWorkflowRun) };
|
|
52
|
-
};
|
|
53
|
-
it('sets a non-zero exit code and returns the eval output when a case fails', async () => {
|
|
54
|
-
const { cmd, postWorkflowRun } = await createCommand(false);
|
|
55
|
-
postWorkflowRun.mockResolvedValue({ data: { output: failingOutput } });
|
|
56
|
-
const result = await cmd.run();
|
|
57
|
-
expect(result).toEqual(failingOutput);
|
|
58
|
-
expect(process.exitCode).toBe(1);
|
|
59
|
-
});
|
|
60
|
-
it('leaves the exit code at zero and returns the eval output when all cases pass', async () => {
|
|
61
|
-
const { cmd, postWorkflowRun } = await createCommand(false);
|
|
62
|
-
postWorkflowRun.mockResolvedValue({ data: { output: passingOutput } });
|
|
63
|
-
const result = await cmd.run();
|
|
64
|
-
expect(result).toEqual(passingOutput);
|
|
65
|
-
expect(process.exitCode).toBe(0);
|
|
66
|
-
});
|
|
67
|
-
it('renders the human-readable summary in text mode', async () => {
|
|
68
|
-
const { cmd, postWorkflowRun } = await createCommand(false);
|
|
69
|
-
postWorkflowRun.mockResolvedValue({ data: { output: passingOutput } });
|
|
70
|
-
await cmd.run();
|
|
71
|
-
const rendered = renderEvalOutput(passingOutput, getEvalWorkflowName('simple'));
|
|
72
|
-
expect(cmd.log).toHaveBeenCalledWith(rendered);
|
|
73
|
-
});
|
|
74
|
-
it('suppresses the rendered summary in JSON mode but still returns and sets exit code', async () => {
|
|
75
|
-
const { cmd, postWorkflowRun } = await createCommand(true);
|
|
76
|
-
postWorkflowRun.mockResolvedValue({ data: { output: failingOutput } });
|
|
77
|
-
const result = await cmd.run();
|
|
78
|
-
const rendered = renderEvalOutput(failingOutput, getEvalWorkflowName('simple'));
|
|
79
|
-
expect(cmd.log).not.toHaveBeenCalledWith(rendered);
|
|
80
|
-
expect(result).toEqual(failingOutput);
|
|
81
|
-
expect(process.exitCode).toBe(1);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
});
|