@drip-apex/apex-cli 0.15.4 → 0.16.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/cli.js CHANGED
@@ -7423,7 +7423,7 @@ async function checkForUpdate(current) {
7423
7423
  // package.json
7424
7424
  var package_default = {
7425
7425
  name: "@drip-apex/apex-cli",
7426
- version: "0.15.4",
7426
+ version: "0.16.0",
7427
7427
  license: "MIT",
7428
7428
  description: "Apex CLI for managing experiments, approved roadmap ideas, and draft workspaces.",
7429
7429
  private: false,
@@ -8904,6 +8904,23 @@ function getExperimentQaEvents(creds, id, options = {}) {
8904
8904
  `/api/v1/experiments/${id}/qa/events${params.size ? `?${params}` : ""}`
8905
8905
  );
8906
8906
  }
8907
+ async function runExperimentCommerceProbes(creds, id, kinds) {
8908
+ const response = await request(
8909
+ creds,
8910
+ "POST",
8911
+ `/api/v1/experiments/${id}/qa/commerce-probes`,
8912
+ kinds?.length ? { kinds } : {}
8913
+ );
8914
+ return { ...response, data: response.data?.data };
8915
+ }
8916
+ async function getExperimentCommerceProbes(creds, id) {
8917
+ const response = await request(
8918
+ creds,
8919
+ "GET",
8920
+ `/api/v1/experiments/${id}/qa/commerce-probes`
8921
+ );
8922
+ return { ...response, data: response.data?.data };
8923
+ }
8907
8924
  function updateExperimentQaRun(creds, id, body5) {
8908
8925
  return request(creds, "PATCH", `/api/v1/experiments/${id}/qa/run`, body5);
8909
8926
  }
@@ -10380,14 +10397,17 @@ function summarizeResults(payload) {
10380
10397
  const decision = record(data.decision);
10381
10398
  const outcome = record(data.effective_outcome);
10382
10399
  const commerce = record(data.commerce);
10400
+ const commerceResults = data.commerce_results == null ? null : record(data.commerce_results);
10383
10401
  const rawArms = Array.isArray(data.arms) ? data.arms.map(record) : [];
10384
10402
  const degradedFlags = {
10385
10403
  explicit: data.degraded === true,
10386
10404
  commerceUnavailable: commerce.unavailable === true,
10405
+ commerceResultsDegraded: commerceResults?.degraded === true,
10387
10406
  armMetricsMissing: rawArms.some((arm) => arm.primaryConversions == null || arm.primaryRate == null)
10388
10407
  };
10389
10408
  const missing = /* @__PURE__ */ new Set();
10390
10409
  if (degradedFlags.commerceUnavailable) missing.add("commerce orders");
10410
+ if (degradedFlags.commerceResultsDegraded) missing.add("commerce profit");
10391
10411
  const controlRate = rawArms.find((arm) => arm.isControl === true)?.primaryRate;
10392
10412
  const treatmentCount = rawArms.filter((arm) => arm.isControl !== true).length;
10393
10413
  const plannedDays = typeof data.planned_days === "number" && Number.isFinite(data.planned_days) && data.planned_days > 0 ? Math.max(1, Math.round(data.planned_days)) : null;
@@ -10434,7 +10454,8 @@ function summarizeResults(payload) {
10434
10454
  })) : [],
10435
10455
  metrics: Array.isArray(data.metrics) ? data.metrics.map(record) : [],
10436
10456
  resultsWeekdays: data.results_weekdays,
10437
- confidenceIndication
10457
+ confidenceIndication,
10458
+ commerceResults
10438
10459
  };
10439
10460
  }
10440
10461
 
@@ -10644,6 +10665,1425 @@ var experiment_filesystem_schema_default = {
10644
10665
  $id: "https://api.drip-apex.com/schemas/experiment-filesystem-v1.json",
10645
10666
  $schema: "https://json-schema.org/draft/2020-12/schema",
10646
10667
  files: {
10668
+ "commerce/offer.json": {
10669
+ $schema: "https://json-schema.org/draft/2020-12/schema",
10670
+ oneOf: [
10671
+ {
10672
+ additionalProperties: false,
10673
+ properties: {
10674
+ arms: {
10675
+ items: {
10676
+ anyOf: [
10677
+ {
10678
+ additionalProperties: false,
10679
+ properties: {
10680
+ sameAsControl: {
10681
+ const: true,
10682
+ type: "boolean"
10683
+ },
10684
+ variation: {
10685
+ minLength: 1,
10686
+ type: "string"
10687
+ }
10688
+ },
10689
+ required: ["variation", "sameAsControl"],
10690
+ type: "object"
10691
+ },
10692
+ {
10693
+ additionalProperties: false,
10694
+ properties: {
10695
+ control: {
10696
+ const: true,
10697
+ type: "boolean"
10698
+ },
10699
+ key: {
10700
+ maxLength: 24,
10701
+ minLength: 1,
10702
+ pattern: "^[a-z0-9-]+$",
10703
+ type: "string"
10704
+ },
10705
+ label: {
10706
+ maxLength: 60,
10707
+ minLength: 1,
10708
+ type: "string"
10709
+ },
10710
+ percentOff: {
10711
+ anyOf: [
10712
+ {
10713
+ maximum: 90,
10714
+ minimum: 1,
10715
+ type: "integer"
10716
+ },
10717
+ {
10718
+ type: "null"
10719
+ }
10720
+ ]
10721
+ },
10722
+ variation: {
10723
+ minLength: 1,
10724
+ type: "string"
10725
+ }
10726
+ },
10727
+ required: ["key", "label", "percentOff", "variation"],
10728
+ type: "object"
10729
+ }
10730
+ ]
10731
+ },
10732
+ minItems: 1,
10733
+ type: "array"
10734
+ },
10735
+ kind: {
10736
+ const: "offer",
10737
+ type: "string"
10738
+ },
10739
+ lever: {
10740
+ additionalProperties: false,
10741
+ properties: {
10742
+ catalogSource: {
10743
+ const: "live",
10744
+ type: "string"
10745
+ },
10746
+ currencyCode: {
10747
+ maxLength: 3,
10748
+ minLength: 3,
10749
+ pattern: "^[A-Z]{3}$",
10750
+ type: "string"
10751
+ },
10752
+ offerType: {
10753
+ const: "discount_depth",
10754
+ type: "string"
10755
+ },
10756
+ target: {
10757
+ additionalProperties: false,
10758
+ properties: {
10759
+ productGids: {
10760
+ default: [],
10761
+ items: {
10762
+ pattern: "^gid:\\/\\/shopify\\/Product\\/\\d+$",
10763
+ type: "string"
10764
+ },
10765
+ maxItems: 100,
10766
+ type: "array"
10767
+ },
10768
+ variantGids: {
10769
+ default: [],
10770
+ items: {
10771
+ pattern: "^gid:\\/\\/shopify\\/ProductVariant\\/\\d+$",
10772
+ type: "string"
10773
+ },
10774
+ maxItems: 100,
10775
+ type: "array"
10776
+ }
10777
+ },
10778
+ type: "object"
10779
+ }
10780
+ },
10781
+ required: ["offerType", "catalogSource", "currencyCode", "target"],
10782
+ type: "object"
10783
+ },
10784
+ schemaVersion: {
10785
+ const: 1,
10786
+ type: "number"
10787
+ },
10788
+ serverOwned: {
10789
+ additionalProperties: false,
10790
+ properties: {
10791
+ carriers: {
10792
+ additionalProperties: {},
10793
+ propertyNames: {
10794
+ type: "string"
10795
+ },
10796
+ type: "object"
10797
+ },
10798
+ readonly: {
10799
+ const: true,
10800
+ type: "boolean"
10801
+ }
10802
+ },
10803
+ readOnly: true,
10804
+ required: ["readonly", "carriers"],
10805
+ type: "object"
10806
+ }
10807
+ },
10808
+ required: ["schemaVersion", "kind", "lever", "arms"],
10809
+ type: "object"
10810
+ },
10811
+ {
10812
+ additionalProperties: false,
10813
+ properties: {
10814
+ arms: {
10815
+ items: {
10816
+ anyOf: [
10817
+ {
10818
+ additionalProperties: false,
10819
+ properties: {
10820
+ sameAsControl: {
10821
+ const: true,
10822
+ type: "boolean"
10823
+ },
10824
+ variation: {
10825
+ minLength: 1,
10826
+ type: "string"
10827
+ }
10828
+ },
10829
+ required: ["variation", "sameAsControl"],
10830
+ type: "object"
10831
+ },
10832
+ {
10833
+ additionalProperties: false,
10834
+ properties: {
10835
+ control: {
10836
+ const: true,
10837
+ type: "boolean"
10838
+ },
10839
+ key: {
10840
+ maxLength: 24,
10841
+ minLength: 1,
10842
+ pattern: "^[a-z0-9-]+$",
10843
+ type: "string"
10844
+ },
10845
+ label: {
10846
+ maxLength: 60,
10847
+ minLength: 1,
10848
+ type: "string"
10849
+ },
10850
+ threshold: {
10851
+ anyOf: [
10852
+ {
10853
+ exclusiveMinimum: 0,
10854
+ type: "number"
10855
+ },
10856
+ {
10857
+ type: "null"
10858
+ }
10859
+ ]
10860
+ },
10861
+ tiers: {
10862
+ items: {
10863
+ additionalProperties: false,
10864
+ properties: {
10865
+ giftChoiceVariantGids: {
10866
+ items: {
10867
+ pattern: "^gid:\\/\\/shopify\\/ProductVariant\\/\\d+$",
10868
+ type: "string"
10869
+ },
10870
+ maxItems: 4,
10871
+ minItems: 2,
10872
+ type: "array"
10873
+ },
10874
+ giftVariantGid: {
10875
+ pattern: "^gid:\\/\\/shopify\\/ProductVariant\\/\\d+$",
10876
+ type: "string"
10877
+ },
10878
+ threshold: {
10879
+ exclusiveMinimum: 0,
10880
+ type: "number"
10881
+ }
10882
+ },
10883
+ required: ["threshold", "giftVariantGid"],
10884
+ type: "object"
10885
+ },
10886
+ maxItems: 3,
10887
+ minItems: 1,
10888
+ type: "array"
10889
+ },
10890
+ variation: {
10891
+ minLength: 1,
10892
+ type: "string"
10893
+ }
10894
+ },
10895
+ required: ["key", "label", "variation"],
10896
+ type: "object"
10897
+ }
10898
+ ]
10899
+ },
10900
+ minItems: 1,
10901
+ type: "array"
10902
+ },
10903
+ kind: {
10904
+ const: "offer",
10905
+ type: "string"
10906
+ },
10907
+ lever: {
10908
+ additionalProperties: false,
10909
+ properties: {
10910
+ catalogSource: {
10911
+ const: "live",
10912
+ type: "string"
10913
+ },
10914
+ currencyCode: {
10915
+ maxLength: 3,
10916
+ minLength: 3,
10917
+ pattern: "^[A-Z]{3}$",
10918
+ type: "string"
10919
+ },
10920
+ giftVariantGid: {
10921
+ pattern: "^gid:\\/\\/shopify\\/ProductVariant\\/\\d+$",
10922
+ type: "string"
10923
+ },
10924
+ offerType: {
10925
+ const: "gwp_threshold",
10926
+ type: "string"
10927
+ }
10928
+ },
10929
+ required: ["offerType", "catalogSource", "currencyCode"],
10930
+ type: "object"
10931
+ },
10932
+ schemaVersion: {
10933
+ const: 1,
10934
+ type: "number"
10935
+ },
10936
+ serverOwned: {
10937
+ additionalProperties: false,
10938
+ properties: {
10939
+ carriers: {
10940
+ additionalProperties: {},
10941
+ propertyNames: {
10942
+ type: "string"
10943
+ },
10944
+ type: "object"
10945
+ },
10946
+ readonly: {
10947
+ const: true,
10948
+ type: "boolean"
10949
+ }
10950
+ },
10951
+ readOnly: true,
10952
+ required: ["readonly", "carriers"],
10953
+ type: "object"
10954
+ }
10955
+ },
10956
+ required: ["schemaVersion", "kind", "lever", "arms"],
10957
+ type: "object"
10958
+ },
10959
+ {
10960
+ additionalProperties: false,
10961
+ properties: {
10962
+ arms: {
10963
+ items: {
10964
+ anyOf: [
10965
+ {
10966
+ additionalProperties: false,
10967
+ properties: {
10968
+ sameAsControl: {
10969
+ const: true,
10970
+ type: "boolean"
10971
+ },
10972
+ variation: {
10973
+ minLength: 1,
10974
+ type: "string"
10975
+ }
10976
+ },
10977
+ required: ["variation", "sameAsControl"],
10978
+ type: "object"
10979
+ },
10980
+ {
10981
+ additionalProperties: false,
10982
+ properties: {
10983
+ control: {
10984
+ const: true,
10985
+ type: "boolean"
10986
+ },
10987
+ key: {
10988
+ maxLength: 24,
10989
+ minLength: 1,
10990
+ pattern: "^[a-z0-9-]+$",
10991
+ type: "string"
10992
+ },
10993
+ label: {
10994
+ maxLength: 60,
10995
+ minLength: 1,
10996
+ type: "string"
10997
+ },
10998
+ minimumQuantity: {
10999
+ anyOf: [
11000
+ {
11001
+ maximum: 9007199254740991,
11002
+ minimum: 2,
11003
+ type: "integer"
11004
+ },
11005
+ {
11006
+ type: "null"
11007
+ }
11008
+ ]
11009
+ },
11010
+ percentOff: {
11011
+ anyOf: [
11012
+ {
11013
+ maximum: 90,
11014
+ minimum: 1,
11015
+ type: "integer"
11016
+ },
11017
+ {
11018
+ type: "null"
11019
+ }
11020
+ ]
11021
+ },
11022
+ variation: {
11023
+ minLength: 1,
11024
+ type: "string"
11025
+ }
11026
+ },
11027
+ required: ["key", "label", "minimumQuantity", "percentOff", "variation"],
11028
+ type: "object"
11029
+ }
11030
+ ]
11031
+ },
11032
+ minItems: 1,
11033
+ type: "array"
11034
+ },
11035
+ kind: {
11036
+ const: "offer",
11037
+ type: "string"
11038
+ },
11039
+ lever: {
11040
+ additionalProperties: false,
11041
+ properties: {
11042
+ catalogSource: {
11043
+ const: "live",
11044
+ type: "string"
11045
+ },
11046
+ currencyCode: {
11047
+ maxLength: 3,
11048
+ minLength: 3,
11049
+ pattern: "^[A-Z]{3}$",
11050
+ type: "string"
11051
+ },
11052
+ offerType: {
11053
+ const: "quantity_breaks",
11054
+ type: "string"
11055
+ },
11056
+ target: {
11057
+ additionalProperties: false,
11058
+ properties: {
11059
+ productGids: {
11060
+ default: [],
11061
+ items: {
11062
+ pattern: "^gid:\\/\\/shopify\\/Product\\/\\d+$",
11063
+ type: "string"
11064
+ },
11065
+ maxItems: 100,
11066
+ type: "array"
11067
+ },
11068
+ variantGids: {
11069
+ default: [],
11070
+ items: {
11071
+ pattern: "^gid:\\/\\/shopify\\/ProductVariant\\/\\d+$",
11072
+ type: "string"
11073
+ },
11074
+ maxItems: 100,
11075
+ type: "array"
11076
+ }
11077
+ },
11078
+ type: "object"
11079
+ }
11080
+ },
11081
+ required: ["offerType", "catalogSource", "currencyCode", "target"],
11082
+ type: "object"
11083
+ },
11084
+ schemaVersion: {
11085
+ const: 1,
11086
+ type: "number"
11087
+ },
11088
+ serverOwned: {
11089
+ additionalProperties: false,
11090
+ properties: {
11091
+ carriers: {
11092
+ additionalProperties: {},
11093
+ propertyNames: {
11094
+ type: "string"
11095
+ },
11096
+ type: "object"
11097
+ },
11098
+ readonly: {
11099
+ const: true,
11100
+ type: "boolean"
11101
+ }
11102
+ },
11103
+ readOnly: true,
11104
+ required: ["readonly", "carriers"],
11105
+ type: "object"
11106
+ }
11107
+ },
11108
+ required: ["schemaVersion", "kind", "lever", "arms"],
11109
+ type: "object"
11110
+ },
11111
+ {
11112
+ additionalProperties: false,
11113
+ properties: {
11114
+ carriers: {
11115
+ additionalProperties: {
11116
+ items: {},
11117
+ type: "array"
11118
+ },
11119
+ propertyNames: {
11120
+ type: "string"
11121
+ },
11122
+ type: "object"
11123
+ },
11124
+ kind: {
11125
+ const: "offer",
11126
+ type: "string"
11127
+ },
11128
+ readonly: {
11129
+ const: true,
11130
+ type: "boolean"
11131
+ },
11132
+ reason: {
11133
+ type: "string"
11134
+ },
11135
+ schemaVersion: {
11136
+ const: 1,
11137
+ type: "number"
11138
+ }
11139
+ },
11140
+ required: ["schemaVersion", "kind", "readonly", "reason", "carriers"],
11141
+ type: "object"
11142
+ }
11143
+ ]
11144
+ },
11145
+ "commerce/post-purchase.json": {
11146
+ $schema: "https://json-schema.org/draft/2020-12/schema",
11147
+ oneOf: [
11148
+ {
11149
+ additionalProperties: false,
11150
+ properties: {
11151
+ arms: {
11152
+ items: {
11153
+ anyOf: [
11154
+ {
11155
+ additionalProperties: false,
11156
+ properties: {
11157
+ sameAsControl: {
11158
+ const: true,
11159
+ type: "boolean"
11160
+ },
11161
+ variation: {
11162
+ minLength: 1,
11163
+ type: "string"
11164
+ }
11165
+ },
11166
+ required: ["variation", "sameAsControl"],
11167
+ type: "object"
11168
+ },
11169
+ {
11170
+ additionalProperties: false,
11171
+ properties: {
11172
+ control: {
11173
+ const: true,
11174
+ type: "boolean"
11175
+ },
11176
+ key: {
11177
+ maxLength: 80,
11178
+ minLength: 1,
11179
+ type: "string"
11180
+ },
11181
+ kind: {
11182
+ const: "control",
11183
+ type: "string"
11184
+ },
11185
+ variation: {
11186
+ minLength: 1,
11187
+ type: "string"
11188
+ }
11189
+ },
11190
+ required: ["kind", "key", "variation"],
11191
+ type: "object"
11192
+ },
11193
+ {
11194
+ additionalProperties: false,
11195
+ properties: {
11196
+ acceptLabel: {
11197
+ maxLength: 60,
11198
+ minLength: 1,
11199
+ type: "string"
11200
+ },
11201
+ control: {
11202
+ const: true,
11203
+ type: "boolean"
11204
+ },
11205
+ declineLabel: {
11206
+ maxLength: 60,
11207
+ minLength: 1,
11208
+ type: "string"
11209
+ },
11210
+ description: {
11211
+ maxLength: 500,
11212
+ type: "string"
11213
+ },
11214
+ discount: {
11215
+ oneOf: [
11216
+ {
11217
+ additionalProperties: false,
11218
+ properties: {
11219
+ kind: {
11220
+ const: "percent",
11221
+ type: "string"
11222
+ },
11223
+ percentOff: {
11224
+ maximum: 90,
11225
+ minimum: 1,
11226
+ type: "integer"
11227
+ }
11228
+ },
11229
+ required: ["kind", "percentOff"],
11230
+ type: "object"
11231
+ },
11232
+ {
11233
+ additionalProperties: false,
11234
+ properties: {
11235
+ amount: {
11236
+ exclusiveMinimum: 0,
11237
+ type: "number"
11238
+ },
11239
+ kind: {
11240
+ const: "fixed_price",
11241
+ type: "string"
11242
+ }
11243
+ },
11244
+ required: ["kind", "amount"],
11245
+ type: "object"
11246
+ }
11247
+ ]
11248
+ },
11249
+ headline: {
11250
+ maxLength: 160,
11251
+ minLength: 1,
11252
+ type: "string"
11253
+ },
11254
+ key: {
11255
+ maxLength: 80,
11256
+ minLength: 1,
11257
+ type: "string"
11258
+ },
11259
+ kind: {
11260
+ const: "offer",
11261
+ type: "string"
11262
+ },
11263
+ productVariantGid: {
11264
+ pattern: "^gid:\\/\\/shopify\\/ProductVariant\\/\\d+$",
11265
+ type: "string"
11266
+ },
11267
+ productVariantTitle: {
11268
+ maxLength: 255,
11269
+ minLength: 1,
11270
+ type: "string"
11271
+ },
11272
+ quantity: {
11273
+ const: 1,
11274
+ type: "number"
11275
+ },
11276
+ variation: {
11277
+ minLength: 1,
11278
+ type: "string"
11279
+ }
11280
+ },
11281
+ required: [
11282
+ "kind",
11283
+ "key",
11284
+ "productVariantGid",
11285
+ "quantity",
11286
+ "discount",
11287
+ "variation"
11288
+ ],
11289
+ type: "object"
11290
+ }
11291
+ ]
11292
+ },
11293
+ minItems: 1,
11294
+ type: "array"
11295
+ },
11296
+ kind: {
11297
+ const: "post-purchase",
11298
+ type: "string"
11299
+ },
11300
+ lever: {
11301
+ $schema: "https://json-schema.org/draft/2020-12/schema",
11302
+ additionalProperties: false,
11303
+ properties: {
11304
+ currencyCode: {
11305
+ maxLength: 3,
11306
+ minLength: 3,
11307
+ pattern: "^[A-Z]{3}$",
11308
+ type: "string"
11309
+ }
11310
+ },
11311
+ required: ["currencyCode"],
11312
+ type: "object"
11313
+ },
11314
+ schemaVersion: {
11315
+ const: 1,
11316
+ type: "number"
11317
+ },
11318
+ serverOwned: {
11319
+ additionalProperties: false,
11320
+ properties: {
11321
+ carriers: {
11322
+ additionalProperties: {},
11323
+ propertyNames: {
11324
+ type: "string"
11325
+ },
11326
+ type: "object"
11327
+ },
11328
+ readonly: {
11329
+ const: true,
11330
+ type: "boolean"
11331
+ }
11332
+ },
11333
+ readOnly: true,
11334
+ required: ["readonly", "carriers"],
11335
+ type: "object"
11336
+ }
11337
+ },
11338
+ required: ["schemaVersion", "kind", "lever", "arms"],
11339
+ type: "object"
11340
+ },
11341
+ {
11342
+ additionalProperties: false,
11343
+ properties: {
11344
+ carriers: {
11345
+ additionalProperties: {
11346
+ items: {},
11347
+ type: "array"
11348
+ },
11349
+ propertyNames: {
11350
+ type: "string"
11351
+ },
11352
+ type: "object"
11353
+ },
11354
+ kind: {
11355
+ const: "post-purchase",
11356
+ type: "string"
11357
+ },
11358
+ readonly: {
11359
+ const: true,
11360
+ type: "boolean"
11361
+ },
11362
+ reason: {
11363
+ type: "string"
11364
+ },
11365
+ schemaVersion: {
11366
+ const: 1,
11367
+ type: "number"
11368
+ }
11369
+ },
11370
+ required: ["schemaVersion", "kind", "readonly", "reason", "carriers"],
11371
+ type: "object"
11372
+ }
11373
+ ]
11374
+ },
11375
+ "commerce/price.json": {
11376
+ $schema: "https://json-schema.org/draft/2020-12/schema",
11377
+ oneOf: [
11378
+ {
11379
+ additionalProperties: false,
11380
+ properties: {
11381
+ arms: {
11382
+ items: {
11383
+ anyOf: [
11384
+ {
11385
+ additionalProperties: false,
11386
+ properties: {
11387
+ control: {
11388
+ const: true,
11389
+ type: "boolean"
11390
+ },
11391
+ variation: {
11392
+ minLength: 1,
11393
+ type: "string"
11394
+ }
11395
+ },
11396
+ required: ["variation", "control"],
11397
+ type: "object"
11398
+ },
11399
+ {
11400
+ additionalProperties: false,
11401
+ properties: {
11402
+ sameAsControl: {
11403
+ const: true,
11404
+ type: "boolean"
11405
+ },
11406
+ variation: {
11407
+ minLength: 1,
11408
+ type: "string"
11409
+ }
11410
+ },
11411
+ required: ["variation", "sameAsControl"],
11412
+ type: "object"
11413
+ },
11414
+ {
11415
+ additionalProperties: false,
11416
+ properties: {
11417
+ key: {
11418
+ maxLength: 24,
11419
+ minLength: 1,
11420
+ pattern: "^[a-z0-9-]+$",
11421
+ type: "string"
11422
+ },
11423
+ label: {
11424
+ maxLength: 60,
11425
+ minLength: 1,
11426
+ type: "string"
11427
+ },
11428
+ prices: {
11429
+ additionalProperties: {
11430
+ additionalProperties: false,
11431
+ properties: {
11432
+ compareAt: {
11433
+ oneOf: [
11434
+ {
11435
+ additionalProperties: false,
11436
+ properties: {
11437
+ amount: {
11438
+ exclusiveMinimum: 0,
11439
+ type: "number"
11440
+ },
11441
+ mode: {
11442
+ const: "set",
11443
+ type: "string"
11444
+ }
11445
+ },
11446
+ required: ["mode", "amount"],
11447
+ type: "object"
11448
+ },
11449
+ {
11450
+ additionalProperties: false,
11451
+ properties: {
11452
+ mode: {
11453
+ const: "clear",
11454
+ type: "string"
11455
+ }
11456
+ },
11457
+ required: ["mode"],
11458
+ type: "object"
11459
+ }
11460
+ ]
11461
+ },
11462
+ price: {
11463
+ anyOf: [
11464
+ {
11465
+ exclusiveMinimum: 0,
11466
+ type: "number"
11467
+ },
11468
+ {
11469
+ type: "null"
11470
+ }
11471
+ ]
11472
+ }
11473
+ },
11474
+ required: ["price"],
11475
+ type: "object"
11476
+ },
11477
+ type: "object"
11478
+ },
11479
+ type: {
11480
+ const: "fixed",
11481
+ default: "fixed",
11482
+ type: "string"
11483
+ },
11484
+ variation: {
11485
+ minLength: 1,
11486
+ type: "string"
11487
+ }
11488
+ },
11489
+ required: ["key", "label", "variation", "prices"],
11490
+ type: "object"
11491
+ },
11492
+ {
11493
+ additionalProperties: false,
11494
+ properties: {
11495
+ key: {
11496
+ maxLength: 24,
11497
+ minLength: 1,
11498
+ pattern: "^[a-z0-9-]+$",
11499
+ type: "string"
11500
+ },
11501
+ label: {
11502
+ maxLength: 60,
11503
+ minLength: 1,
11504
+ type: "string"
11505
+ },
11506
+ percentDelta: {
11507
+ maximum: -1,
11508
+ minimum: -90,
11509
+ type: "integer"
11510
+ },
11511
+ prices: {
11512
+ additionalProperties: {
11513
+ additionalProperties: false,
11514
+ properties: {
11515
+ compareAt: {
11516
+ oneOf: [
11517
+ {
11518
+ additionalProperties: false,
11519
+ properties: {
11520
+ amount: {
11521
+ exclusiveMinimum: 0,
11522
+ type: "number"
11523
+ },
11524
+ mode: {
11525
+ const: "set",
11526
+ type: "string"
11527
+ }
11528
+ },
11529
+ required: ["mode", "amount"],
11530
+ type: "object"
11531
+ },
11532
+ {
11533
+ additionalProperties: false,
11534
+ properties: {
11535
+ mode: {
11536
+ const: "clear",
11537
+ type: "string"
11538
+ }
11539
+ },
11540
+ required: ["mode"],
11541
+ type: "object"
11542
+ }
11543
+ ]
11544
+ },
11545
+ price: {
11546
+ anyOf: [
11547
+ {
11548
+ exclusiveMinimum: 0,
11549
+ type: "number"
11550
+ },
11551
+ {
11552
+ type: "null"
11553
+ }
11554
+ ]
11555
+ }
11556
+ },
11557
+ required: ["price"],
11558
+ type: "object"
11559
+ },
11560
+ type: "object"
11561
+ },
11562
+ type: {
11563
+ const: "percent",
11564
+ type: "string"
11565
+ },
11566
+ variation: {
11567
+ minLength: 1,
11568
+ type: "string"
11569
+ }
11570
+ },
11571
+ required: ["key", "label", "type", "percentDelta", "variation", "prices"],
11572
+ type: "object"
11573
+ },
11574
+ {
11575
+ additionalProperties: false,
11576
+ properties: {
11577
+ key: {
11578
+ maxLength: 24,
11579
+ minLength: 1,
11580
+ pattern: "^[a-z0-9-]+$",
11581
+ type: "string"
11582
+ },
11583
+ label: {
11584
+ maxLength: 60,
11585
+ minLength: 1,
11586
+ type: "string"
11587
+ },
11588
+ prices: {
11589
+ additionalProperties: {
11590
+ additionalProperties: false,
11591
+ properties: {
11592
+ compareAt: {
11593
+ oneOf: [
11594
+ {
11595
+ additionalProperties: false,
11596
+ properties: {
11597
+ amount: {
11598
+ exclusiveMinimum: 0,
11599
+ type: "number"
11600
+ },
11601
+ mode: {
11602
+ const: "set",
11603
+ type: "string"
11604
+ }
11605
+ },
11606
+ required: ["mode", "amount"],
11607
+ type: "object"
11608
+ },
11609
+ {
11610
+ additionalProperties: false,
11611
+ properties: {
11612
+ mode: {
11613
+ const: "clear",
11614
+ type: "string"
11615
+ }
11616
+ },
11617
+ required: ["mode"],
11618
+ type: "object"
11619
+ }
11620
+ ]
11621
+ },
11622
+ price: {
11623
+ anyOf: [
11624
+ {
11625
+ exclusiveMinimum: 0,
11626
+ type: "number"
11627
+ },
11628
+ {
11629
+ type: "null"
11630
+ }
11631
+ ]
11632
+ }
11633
+ },
11634
+ required: ["price"],
11635
+ type: "object"
11636
+ },
11637
+ type: "object"
11638
+ },
11639
+ type: {
11640
+ const: "compare-at",
11641
+ type: "string"
11642
+ },
11643
+ variation: {
11644
+ minLength: 1,
11645
+ type: "string"
11646
+ }
11647
+ },
11648
+ required: ["key", "label", "type", "variation", "prices"],
11649
+ type: "object"
11650
+ }
11651
+ ]
11652
+ },
11653
+ minItems: 1,
11654
+ type: "array"
11655
+ },
11656
+ kind: {
11657
+ const: "price",
11658
+ type: "string"
11659
+ },
11660
+ lever: {
11661
+ $schema: "https://json-schema.org/draft/2020-12/schema",
11662
+ additionalProperties: false,
11663
+ properties: {
11664
+ catalogSource: {
11665
+ anyOf: [
11666
+ {
11667
+ const: "sample",
11668
+ type: "string"
11669
+ },
11670
+ {
11671
+ const: "live",
11672
+ type: "string"
11673
+ }
11674
+ ]
11675
+ },
11676
+ currencyCode: {
11677
+ maxLength: 3,
11678
+ minLength: 3,
11679
+ pattern: "^[A-Z]{3}$",
11680
+ type: "string"
11681
+ },
11682
+ productId: {
11683
+ maxLength: 120,
11684
+ minLength: 1,
11685
+ type: "string"
11686
+ },
11687
+ productTitle: {
11688
+ maxLength: 255,
11689
+ minLength: 1,
11690
+ type: "string"
11691
+ },
11692
+ variants: {
11693
+ items: {
11694
+ additionalProperties: false,
11695
+ properties: {
11696
+ controlPrice: {
11697
+ minimum: 0,
11698
+ type: "number"
11699
+ },
11700
+ sku: {
11701
+ maxLength: 120,
11702
+ type: "string"
11703
+ },
11704
+ title: {
11705
+ maxLength: 255,
11706
+ minLength: 1,
11707
+ type: "string"
11708
+ },
11709
+ variantId: {
11710
+ maxLength: 120,
11711
+ minLength: 1,
11712
+ type: "string"
11713
+ }
11714
+ },
11715
+ required: ["variantId", "title", "controlPrice"],
11716
+ type: "object"
11717
+ },
11718
+ minItems: 1,
11719
+ type: "array"
11720
+ }
11721
+ },
11722
+ required: [
11723
+ "catalogSource",
11724
+ "productId",
11725
+ "productTitle",
11726
+ "currencyCode",
11727
+ "variants"
11728
+ ],
11729
+ type: "object"
11730
+ },
11731
+ schemaVersion: {
11732
+ const: 1,
11733
+ type: "number"
11734
+ },
11735
+ serverOwned: {
11736
+ additionalProperties: false,
11737
+ properties: {
11738
+ carriers: {
11739
+ additionalProperties: {},
11740
+ propertyNames: {
11741
+ type: "string"
11742
+ },
11743
+ type: "object"
11744
+ },
11745
+ readonly: {
11746
+ const: true,
11747
+ type: "boolean"
11748
+ }
11749
+ },
11750
+ readOnly: true,
11751
+ required: ["readonly", "carriers"],
11752
+ type: "object"
11753
+ }
11754
+ },
11755
+ required: ["schemaVersion", "kind", "lever", "arms"],
11756
+ type: "object"
11757
+ },
11758
+ {
11759
+ additionalProperties: false,
11760
+ properties: {
11761
+ carriers: {
11762
+ additionalProperties: {
11763
+ items: {},
11764
+ type: "array"
11765
+ },
11766
+ propertyNames: {
11767
+ type: "string"
11768
+ },
11769
+ type: "object"
11770
+ },
11771
+ kind: {
11772
+ const: "price",
11773
+ type: "string"
11774
+ },
11775
+ readonly: {
11776
+ const: true,
11777
+ type: "boolean"
11778
+ },
11779
+ reason: {
11780
+ type: "string"
11781
+ },
11782
+ schemaVersion: {
11783
+ const: 1,
11784
+ type: "number"
11785
+ }
11786
+ },
11787
+ required: ["schemaVersion", "kind", "readonly", "reason", "carriers"],
11788
+ type: "object"
11789
+ }
11790
+ ]
11791
+ },
11792
+ "commerce/shipping.json": {
11793
+ $schema: "https://json-schema.org/draft/2020-12/schema",
11794
+ oneOf: [
11795
+ {
11796
+ additionalProperties: false,
11797
+ properties: {
11798
+ arms: {
11799
+ items: {
11800
+ anyOf: [
11801
+ {
11802
+ additionalProperties: false,
11803
+ properties: {
11804
+ sameAsControl: {
11805
+ const: true,
11806
+ type: "boolean"
11807
+ },
11808
+ variation: {
11809
+ minLength: 1,
11810
+ type: "string"
11811
+ }
11812
+ },
11813
+ required: ["variation", "sameAsControl"],
11814
+ type: "object"
11815
+ },
11816
+ {
11817
+ additionalProperties: false,
11818
+ properties: {
11819
+ bannerCopy: {
11820
+ default: "",
11821
+ maxLength: 200,
11822
+ type: "string"
11823
+ },
11824
+ control: {
11825
+ const: true,
11826
+ type: "boolean"
11827
+ },
11828
+ flatRate: {
11829
+ anyOf: [
11830
+ {
11831
+ minimum: 0,
11832
+ type: "number"
11833
+ },
11834
+ {
11835
+ type: "null"
11836
+ }
11837
+ ],
11838
+ default: null
11839
+ },
11840
+ key: {
11841
+ maxLength: 24,
11842
+ minLength: 1,
11843
+ pattern: "^[a-z0-9-]+$",
11844
+ type: "string"
11845
+ },
11846
+ label: {
11847
+ maxLength: 60,
11848
+ minLength: 1,
11849
+ type: "string"
11850
+ },
11851
+ percentOff: {
11852
+ anyOf: [
11853
+ {
11854
+ maximum: 100,
11855
+ minimum: 1,
11856
+ type: "integer"
11857
+ },
11858
+ {
11859
+ type: "null"
11860
+ }
11861
+ ],
11862
+ default: null
11863
+ },
11864
+ progressCopy: {
11865
+ maxLength: 200,
11866
+ type: "string"
11867
+ },
11868
+ reachedCopy: {
11869
+ maxLength: 200,
11870
+ type: "string"
11871
+ },
11872
+ target: {
11873
+ additionalProperties: false,
11874
+ default: {
11875
+ productGids: [],
11876
+ variantGids: []
11877
+ },
11878
+ properties: {
11879
+ productGids: {
11880
+ default: [],
11881
+ items: {
11882
+ pattern: "^gid:\\/\\/shopify\\/Product\\/\\d+$",
11883
+ type: "string"
11884
+ },
11885
+ maxItems: 100,
11886
+ type: "array"
11887
+ },
11888
+ variantGids: {
11889
+ default: [],
11890
+ items: {
11891
+ pattern: "^gid:\\/\\/shopify\\/ProductVariant\\/\\d+$",
11892
+ type: "string"
11893
+ },
11894
+ maxItems: 100,
11895
+ type: "array"
11896
+ }
11897
+ },
11898
+ type: "object"
11899
+ },
11900
+ threshold: {
11901
+ anyOf: [
11902
+ {
11903
+ minimum: 0,
11904
+ type: "number"
11905
+ },
11906
+ {
11907
+ type: "null"
11908
+ }
11909
+ ]
11910
+ },
11911
+ treatment: {
11912
+ enum: [
11913
+ "progress_bar",
11914
+ "banner",
11915
+ "free_shipping",
11916
+ "flat_rate",
11917
+ "percent_off",
11918
+ "none"
11919
+ ],
11920
+ type: "string"
11921
+ },
11922
+ variation: {
11923
+ minLength: 1,
11924
+ type: "string"
11925
+ }
11926
+ },
11927
+ required: [
11928
+ "key",
11929
+ "label",
11930
+ "threshold",
11931
+ "treatment",
11932
+ "progressCopy",
11933
+ "reachedCopy",
11934
+ "variation"
11935
+ ],
11936
+ type: "object"
11937
+ }
11938
+ ]
11939
+ },
11940
+ minItems: 1,
11941
+ type: "array"
11942
+ },
11943
+ kind: {
11944
+ const: "shipping",
11945
+ type: "string"
11946
+ },
11947
+ lever: {
11948
+ $schema: "https://json-schema.org/draft/2020-12/schema",
11949
+ additionalProperties: false,
11950
+ properties: {
11951
+ catalogSource: {
11952
+ anyOf: [
11953
+ {
11954
+ const: "sample",
11955
+ type: "string"
11956
+ },
11957
+ {
11958
+ const: "live",
11959
+ type: "string"
11960
+ }
11961
+ ]
11962
+ },
11963
+ currencyCode: {
11964
+ maxLength: 3,
11965
+ minLength: 3,
11966
+ pattern: "^[A-Z]{3}$",
11967
+ type: "string"
11968
+ },
11969
+ enforcement: {
11970
+ default: "none",
11971
+ enum: ["none", "free_shipping"],
11972
+ type: "string"
11973
+ },
11974
+ enforcementPolicy: {
11975
+ additionalProperties: false,
11976
+ properties: {
11977
+ collisionPolicy: {
11978
+ const: "block_on_existing_shipping_discount",
11979
+ type: "string"
11980
+ },
11981
+ expressServiceHandles: {
11982
+ default: [],
11983
+ items: {
11984
+ maxLength: 255,
11985
+ minLength: 1,
11986
+ pattern: "^[a-z0-9][a-z0-9-]*$",
11987
+ type: "string"
11988
+ },
11989
+ maxItems: 50,
11990
+ type: "array"
11991
+ },
11992
+ maximumSubsidy: {
11993
+ exclusiveMinimum: 0,
11994
+ type: "number"
11995
+ },
11996
+ standardServiceHandles: {
11997
+ items: {
11998
+ maxLength: 255,
11999
+ minLength: 1,
12000
+ pattern: "^[a-z0-9][a-z0-9-]*$",
12001
+ type: "string"
12002
+ },
12003
+ maxItems: 50,
12004
+ minItems: 1,
12005
+ type: "array"
12006
+ }
12007
+ },
12008
+ required: ["standardServiceHandles", "maximumSubsidy", "collisionPolicy"],
12009
+ type: "object"
12010
+ },
12011
+ liveFreeShippingThreshold: {
12012
+ anyOf: [
12013
+ {
12014
+ minimum: 0,
12015
+ type: "number"
12016
+ },
12017
+ {
12018
+ type: "null"
12019
+ }
12020
+ ]
12021
+ }
12022
+ },
12023
+ required: ["catalogSource", "currencyCode", "liveFreeShippingThreshold"],
12024
+ type: "object"
12025
+ },
12026
+ schemaVersion: {
12027
+ const: 1,
12028
+ type: "number"
12029
+ },
12030
+ serverOwned: {
12031
+ additionalProperties: false,
12032
+ properties: {
12033
+ carriers: {
12034
+ additionalProperties: {},
12035
+ propertyNames: {
12036
+ type: "string"
12037
+ },
12038
+ type: "object"
12039
+ },
12040
+ readonly: {
12041
+ const: true,
12042
+ type: "boolean"
12043
+ }
12044
+ },
12045
+ readOnly: true,
12046
+ required: ["readonly", "carriers"],
12047
+ type: "object"
12048
+ }
12049
+ },
12050
+ required: ["schemaVersion", "kind", "lever", "arms"],
12051
+ type: "object"
12052
+ },
12053
+ {
12054
+ additionalProperties: false,
12055
+ properties: {
12056
+ carriers: {
12057
+ additionalProperties: {
12058
+ items: {},
12059
+ type: "array"
12060
+ },
12061
+ propertyNames: {
12062
+ type: "string"
12063
+ },
12064
+ type: "object"
12065
+ },
12066
+ kind: {
12067
+ const: "shipping",
12068
+ type: "string"
12069
+ },
12070
+ readonly: {
12071
+ const: true,
12072
+ type: "boolean"
12073
+ },
12074
+ reason: {
12075
+ type: "string"
12076
+ },
12077
+ schemaVersion: {
12078
+ const: 1,
12079
+ type: "number"
12080
+ }
12081
+ },
12082
+ required: ["schemaVersion", "kind", "readonly", "reason", "carriers"],
12083
+ type: "object"
12084
+ }
12085
+ ]
12086
+ },
10647
12087
  "experiment.json": {
10648
12088
  $schema: "https://json-schema.org/draft/2020-12/schema",
10649
12089
  additionalProperties: false,
@@ -11225,13 +12665,7 @@ var experiment_filesystem_schema_default = {
11225
12665
  {
11226
12666
  properties: {
11227
12667
  action: {
11228
- enum: [
11229
- "priceTest",
11230
- "shippingTest",
11231
- "offerTest",
11232
- "postPurchaseOffer",
11233
- "checkoutBlock"
11234
- ]
12668
+ enum: ["checkoutBlock"]
11235
12669
  }
11236
12670
  },
11237
12671
  required: ["action"]
@@ -11522,6 +12956,49 @@ function printExperimentResults(results2, currency) {
11522
12956
  [32, 8, 6, 8, 10]
11523
12957
  );
11524
12958
  }
12959
+ const commerceResults = summary.commerceResults;
12960
+ if (commerceResults) {
12961
+ console.log();
12962
+ console.log(source_default.bold("Profit per visitor (CM1)"));
12963
+ if (commerceResults.degraded || !commerceResults.plane) {
12964
+ console.log(` Unavailable: ${String(commerceResults.reason ?? "unknown")}`);
12965
+ } else {
12966
+ const plane = commerceResults.plane;
12967
+ const commerceArms = Array.isArray(plane.arms) ? plane.arms : [];
12968
+ printTable(
12969
+ ["ARM", "VISITORS", "ORDERS", "CM1/VISITOR", "DELTA (95% CI)", "STATE"],
12970
+ commerceArms.map((arm) => {
12971
+ const deltas = arm.deltaVsControl;
12972
+ const cm = deltas?.cm;
12973
+ const ci = cm?.ci95;
12974
+ const count2 = (value) => typeof value === "number" && Number.isFinite(value) ? String(value) : "-";
12975
+ const money = (value) => typeof value === "number" ? formatRevenue(value, String(plane.currency ?? currency ?? "")) : "-";
12976
+ return [
12977
+ String(arm.name ?? arm.variationId ?? "-"),
12978
+ // Fail closed: a missing count is unavailable, never a measured 0.
12979
+ count2(arm.visitors),
12980
+ count2(arm.orders),
12981
+ money(arm.cmPerVisitor),
12982
+ cm ? `${money(cm.abs)}${ci ? ` (${money(ci.lower)} to ${money(ci.upper)})` : ""}` : "-",
12983
+ String(cm?.state ?? "control")
12984
+ ];
12985
+ })
12986
+ );
12987
+ const oec = plane.oec;
12988
+ const coverage = plane.coverage;
12989
+ console.log(` Verdict: ${String(oec?.verdict ?? "unknown")}`);
12990
+ console.log(` ${String(oec?.plainLanguage ?? "")}`);
12991
+ console.log(
12992
+ ` Cost coverage: ${typeof coverage?.costCoverage === "number" ? `${(coverage.costCoverage * 100).toFixed(1)}%` : "-"}`
12993
+ );
12994
+ const health = plane.health;
12995
+ for (const [name, check] of Object.entries(health ?? {})) {
12996
+ if (name === "trustworthy" || typeof check !== "object" || check === null || check.ok !== false)
12997
+ continue;
12998
+ console.log(` Health: ${name} failed`);
12999
+ }
13000
+ }
13001
+ }
11525
13002
  const metrics = summary.metrics;
11526
13003
  if (metrics.length > 0) {
11527
13004
  console.log();
@@ -11544,13 +13021,14 @@ var filesystemPaths = Object.keys(experiment_filesystem_schema_default.files);
11544
13021
  var EXPERIMENT_FILESYSTEM_PATH_SCHEMA = {
11545
13022
  topLevel: filesystemPaths.filter((entry) => !entry.includes("/")),
11546
13023
  experiment: filesystemPaths.filter((entry) => entry.startsWith("experiment/")).map((entry) => entry.slice("experiment/".length)),
13024
+ commerce: filesystemPaths.filter((entry) => entry.startsWith("commerce/")).map((entry) => entry.slice("commerce/".length)),
11547
13025
  variation: filesystemPaths.filter((entry) => entry.startsWith("variations/*/")).map((entry) => entry.slice("variations/*/".length))
11548
13026
  };
11549
13027
  var SERVER_OWNED_EXPERIMENT_FILES = /* @__PURE__ */ new Set(["qa.json", "launch.json"]);
11550
13028
  var escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
11551
13029
  var pathAlternation = (paths) => paths.map(escapeRegex).join("|");
11552
13030
  var FILESYSTEM_FILE_RE = new RegExp(
11553
- `^(?:${pathAlternation(EXPERIMENT_FILESYSTEM_PATH_SCHEMA.topLevel)}|experiment/(?:${pathAlternation(EXPERIMENT_FILESYSTEM_PATH_SCHEMA.experiment)})|variations/[^/]+/(?:${pathAlternation(EXPERIMENT_FILESYSTEM_PATH_SCHEMA.variation)}))$`
13031
+ `^(?:${pathAlternation(EXPERIMENT_FILESYSTEM_PATH_SCHEMA.topLevel)}|experiment/(?:${pathAlternation(EXPERIMENT_FILESYSTEM_PATH_SCHEMA.experiment)})|commerce/(?:${pathAlternation(EXPERIMENT_FILESYSTEM_PATH_SCHEMA.commerce)})|variations/[^/]+/(?:${pathAlternation(EXPERIMENT_FILESYSTEM_PATH_SCHEMA.variation)}))$`
11554
13032
  );
11555
13033
  function sha256Text(value) {
11556
13034
  return import_node_crypto6.default.createHash("sha256").update(value).digest("hex");
@@ -11650,6 +13128,13 @@ function listExperimentFilesystemFiles(folder, session) {
11650
13128
  const content = import_node_fs8.default.readFileSync(absPath, "utf8");
11651
13129
  files.push({ path: relativePath, content, sha256: sha256Text(content) });
11652
13130
  }
13131
+ for (const fileName of EXPERIMENT_FILESYSTEM_PATH_SCHEMA.commerce) {
13132
+ const relativePath = `commerce/${fileName}`;
13133
+ const absPath = import_node_path6.default.join(folder, relativePath);
13134
+ if (!import_node_fs8.default.existsSync(absPath)) continue;
13135
+ const content = import_node_fs8.default.readFileSync(absPath, "utf8");
13136
+ files.push({ path: relativePath, content, sha256: sha256Text(content) });
13137
+ }
11653
13138
  const variationsRoot = import_node_path6.default.join(folder, "variations");
11654
13139
  if (import_node_fs8.default.existsSync(variationsRoot)) {
11655
13140
  for (const variationDir of import_node_fs8.default.readdirSync(variationsRoot, { withFileTypes: true })) {
@@ -13825,6 +15310,46 @@ var qaEvidence = new Command("evidence").description("Attach screenshot jobs or
13825
15310
  }
13826
15311
  });
13827
15312
  var qa = new Command("qa").description("Manage experiment QA runs from the CLI").addCommand(qaStatus).addCommand(
15313
+ new Command("probe").description("Run or read saved commerce QA probes").argument("<folder-or-id>", EXPERIMENT_REFERENCE_DESCRIPTION).option("--kind <kind...>", "Probe kinds: price, shipping, post_purchase").option("--saved", "Read saved evidence without calling Shopify").action(async function(target, opts) {
15314
+ const kinds = opts.kind;
15315
+ if (kinds && (kinds.length > 3 || new Set(kinds).size !== kinds.length || kinds.some((kind5) => !["price", "shipping", "post_purchase"].includes(kind5))))
15316
+ fail(this, "--kind must be price, shipping, or post_purchase", EXIT_CODES.validation);
15317
+ const creds = requireCredentials();
15318
+ const { experimentId } = await resolveExperimentForFilesystemOrId(target);
15319
+ const response = opts.saved ? await getExperimentCommerceProbes(creds, experimentId) : await runExperimentCommerceProbes(creds, experimentId, kinds);
15320
+ if (!response.ok || !response.data)
15321
+ throw new CliError(
15322
+ response.error ?? "Failed to load commerce probes",
15323
+ classifyStatus(response.status),
15324
+ response.errorDetails
15325
+ );
15326
+ const data = opts.saved && kinds ? {
15327
+ ...response.data,
15328
+ kinds: Object.fromEntries(
15329
+ Object.entries(response.data.kinds).filter(([kind5]) => kinds.includes(kind5))
15330
+ )
15331
+ } : response.data;
15332
+ output(
15333
+ this,
15334
+ data,
15335
+ () => printTable(
15336
+ ["KIND", "STATE", "SUMMARY"],
15337
+ Object.entries(data.kinds).map(([kind5, value]) => [
15338
+ kind5,
15339
+ value.evidence.state,
15340
+ value.result?.summary ?? value.evidence.reasons[0] ?? "Saved evidence is current."
15341
+ ])
15342
+ )
15343
+ );
15344
+ const states = Object.values(data.kinds).map((value) => value?.evidence.state);
15345
+ if (states.some((state) => state !== "pass")) {
15346
+ console.error(
15347
+ "Next: fix stale, pending, or failing evidence and run apex experiments qa probe again."
15348
+ );
15349
+ process.exitCode = states.includes("fail") ? EXIT_CODES.checkFailed : EXIT_CODES.validation;
15350
+ }
15351
+ })
15352
+ ).addCommand(
13828
15353
  new Command("events").description("List QA-tagged events for an experiment session").argument("<id-or-slug>", EXPERIMENT_REFERENCE_DESCRIPTION).option("--session <id>", "QA session id (defaults to the latest QA run)").option("--minutes <n>", "Lookback window in minutes", "60").option("--type <type>", "Event type: all, goal, or custom", "all").action(async function(target, opts) {
13829
15354
  const minutes = Number(opts.minutes);
13830
15355
  if (!Number.isInteger(minutes) || minutes < 5 || minutes > 1440)