shop-cli 0.1.0 → 0.1.2

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 (50) hide show
  1. package/dist/cli/approvalRequired.d.ts +30 -0
  2. package/dist/cli/approvalRequired.js +87 -0
  3. package/dist/cli/errors.d.ts +4 -1
  4. package/dist/cli/errors.js +3 -1
  5. package/dist/cli/gid.d.ts +1 -1
  6. package/dist/cli/help/registry.js +1013 -221
  7. package/dist/cli/help/render.d.ts +1 -0
  8. package/dist/cli/help/render.js +47 -0
  9. package/dist/cli/parse-command.d.ts +18 -0
  10. package/dist/cli/parse-command.js +109 -0
  11. package/dist/cli/router.js +3 -0
  12. package/dist/cli/suggest.d.ts +5 -0
  13. package/dist/cli/suggest.js +88 -0
  14. package/dist/cli/verbs/_shared.d.ts +1 -1
  15. package/dist/cli/verbs/_shared.js +4 -3
  16. package/dist/cli/verbs/catalogs.js +1 -1
  17. package/dist/cli/verbs/checkout-branding.js +2 -2
  18. package/dist/cli/verbs/collections.js +147 -12
  19. package/dist/cli/verbs/companies.js +2 -2
  20. package/dist/cli/verbs/company-contacts.js +8 -4
  21. package/dist/cli/verbs/company-locations.js +1 -1
  22. package/dist/cli/verbs/customers.js +156 -19
  23. package/dist/cli/verbs/discounts-automatic.js +36 -10
  24. package/dist/cli/verbs/discounts-code.js +27 -10
  25. package/dist/cli/verbs/draft-orders.js +49 -3
  26. package/dist/cli/verbs/files.js +171 -55
  27. package/dist/cli/verbs/fulfillment-orders.js +19 -4
  28. package/dist/cli/verbs/fulfillments.js +8 -2
  29. package/dist/cli/verbs/graphql.js +2 -0
  30. package/dist/cli/verbs/inventory.js +7 -1
  31. package/dist/cli/verbs/marketing-activities.js +1 -1
  32. package/dist/cli/verbs/markets.js +37 -4
  33. package/dist/cli/verbs/metaobjects.js +10 -1
  34. package/dist/cli/verbs/orders.js +80 -8
  35. package/dist/cli/verbs/product-variants.js +67 -16
  36. package/dist/cli/verbs/products.js +1263 -211
  37. package/dist/cli/verbs/selling-plan-groups.js +32 -10
  38. package/dist/cli/verbs/subscription-contracts.js +1 -0
  39. package/dist/cli/verbs/themes.js +18 -0
  40. package/dist/cli/verbs/url-redirects.js +64 -6
  41. package/dist/cli/workflows/files/stagedUploads.d.ts +3 -3
  42. package/dist/cli/workflows/files/stagedUploads.js +71 -19
  43. package/dist/cli/workflows/files/stdinFile.d.ts +7 -0
  44. package/dist/cli/workflows/files/stdinFile.js +65 -0
  45. package/dist/cli/workflows/files/urlDownloads.d.ts +14 -0
  46. package/dist/cli/workflows/files/urlDownloads.js +114 -0
  47. package/dist/cli/workflows/files/waitForReady.d.ts +20 -0
  48. package/dist/cli/workflows/files/waitForReady.js +114 -0
  49. package/dist/cli.js +115 -29
  50. package/package.json +3 -2
@@ -103,9 +103,19 @@ const flagAt = flag("--at <iso>", "Publish at a specific ISO timestamp");
103
103
  const flagNow = flag("--now", "Publish immediately");
104
104
  const flagUrl = flag("--url <url>", "URL (repeatable)");
105
105
  const flagFile = flag("--file <path>", "Local file path (repeatable)");
106
+ const flagFilesUploadFilename = flag(
107
+ "--filename <name>",
108
+ "Override filename (only with exactly 1 --url, or with --file -)"
109
+ );
106
110
  const flagAlt = flag("--alt <string>", "Alt text");
111
+ const flagFilesUploadMimeType = flag("--mime-type <mime>", "Override MIME detection");
112
+ const flagFilesUploadMediaType = flag("--media-type <type>", "FILE|IMAGE|VIDEO|MODEL_3D");
113
+ const flagFilesUploadWait = flag("--wait", "Poll until fileStatus is READY or FAILED");
114
+ const flagPollIntervalMs = flag("--poll-interval-ms <n>", "Poll interval in milliseconds (default: 1000)");
115
+ const flagTimeoutMs = flag("--timeout-ms <n>", "Polling timeout in milliseconds (default: 600000)");
107
116
  const flagContentType = flag("--content-type <mime>", "Override detected content type");
108
117
  const flagMediaType = flag("--media-type <type>", "IMAGE|VIDEO|MODEL_3D|EXTERNAL_VIDEO");
118
+ const flagMediaContentType = flag("--media-content-type <type>", "IMAGE|VIDEO|MODEL_3D|EXTERNAL_VIDEO");
109
119
  const flagAllowPartialUpdates = flag("--allow-partial-updates", "Allow partial updates");
110
120
  const flagStrategy = flag("--strategy <value>", "DEFAULT|PRESERVE_STANDALONE_VARIANT|REMOVE_STANDALONE_VARIANT");
111
121
  const flagOwnerType = flag("--owner-type <type>", "Owner type filter");
@@ -248,7 +258,7 @@ const flagExpiresAt = flag("--expires-at <iso>", "Expiration timestamp");
248
258
  const flagNotify = flag("--notify", "Notify");
249
259
  const flagToken = flag("--token <string>", "Access token");
250
260
  const flagItems = flag("--items <json>", "Items JSON");
251
- const flagPositions = flag("--positions <json>", "Positions JSON");
261
+ const flagPositions = flag("--positions <json|@file>", "Positions JSON array (inline or @file.json)");
252
262
  const flagMoves = flag("--moves <json>", "Moves JSON array (or @file.json)");
253
263
  const flagMove = flag("--move <id>:<newPosition>", "Move entry (repeatable)");
254
264
  const flagMediaIds = flag("--media-ids <gid>", "Media IDs (repeatable)");
@@ -290,13 +300,28 @@ const flagContextsToAdd = flag("--contexts-to-add <json|@file>", "Catalog contex
290
300
  const flagContextsToRemove = flag("--contexts-to-remove <json|@file>", "Catalog contexts to remove (JSON)");
291
301
  const flagUpdatedAtSince = flag("--updated-at-since <iso>", "Only updated since timestamp");
292
302
  const flagBeforeUpdatedAt = flag("--before-updated-at <iso>", "Only updated before timestamp");
293
- const flagOptions = flag("--options <json|@file>", "Options JSON array (inline or @file.json)");
294
- const flagOption = flag("--option <json|@file>", "Option JSON object (inline or @file.json)");
295
- const flagOptionIds = flag("--option-ids <id,id,...>", "Option IDs (comma-separated or repeatable)");
303
+ const flagOption = flag(
304
+ "--option <name=value1,value2,...>",
305
+ 'Option spec (repeatable). Example: "Size=Small,Medium,Large".'
306
+ );
307
+ const flagOptionsJson = flag("--options-json <json|@file>", "Options JSON array (inline or @file.json)");
308
+ const flagOptionJson = flag("--option-json <json|@file>", "Option JSON object (inline or @file.json)");
309
+ const flagOptionId = flag("--option-id <gid>", "Option ID (repeatable or comma-separated)");
310
+ const flagOptionName = flag("--option-name <string>", "Option name (repeatable or comma-separated)");
296
311
  const flagVariantStrategy = flag("--variant-strategy <value>", "Variant strategy");
297
- const flagOptionValuesToAdd = flag("--option-values-to-add <json|@file>", "Option values to add (JSON)");
298
- const flagOptionValuesToDelete = flag("--option-values-to-delete <json|@file>", "Option value IDs to delete (JSON)");
299
- const flagOptionValuesToUpdate = flag("--option-values-to-update <json|@file>", "Option values to update (JSON)");
312
+ const flagAddValue = flag("--add-value <string>", "Add an option value (repeatable)");
313
+ const flagDeleteValue = flag("--delete-value <string>", "Delete an option value by name (repeatable)");
314
+ const flagRenameValue = flag("--rename-value <from=to>", "Rename an option value by name (repeatable)");
315
+ const flagDeleteValueId = flag("--delete-value-id <gid>", "Delete an option value by ID (repeatable)");
316
+ const flagRenameValueId = flag("--rename-value-id <gid=newName>", "Rename an option value by ID (repeatable)");
317
+ const flagAddValuesJson = flag("--add-values-json <json|@file>", "Option values to add (JSON array)");
318
+ const flagDeleteValueIdsJson = flag("--delete-value-ids-json <json|@file>", "Option value IDs to delete (JSON array)");
319
+ const flagUpdateValuesJson = flag("--update-values-json <json|@file>", "Option values to update (JSON array)");
320
+ const flagOrder = flag(
321
+ "--order <option[=value1,value2,...]>",
322
+ 'Option order spec (repeatable). Example: "Size" or "Color=Green,Red,Blue".'
323
+ );
324
+ const flagPosition = flag("--position <n>", "1-based position");
300
325
  const flagParentProductId = flag("--parent-product-id <gid>", "Parent product ID");
301
326
  const flagProductsAdded = flag("--products-added <json|@file>", "Child products to add (JSON)");
302
327
  const flagProductsEdited = flag("--products-edited <json|@file>", "Child products to edit (JSON)");
@@ -343,63 +368,77 @@ const updateVerb = ({
343
368
  const getVerb = ({
344
369
  operation,
345
370
  description,
346
- notes
371
+ notes,
372
+ examples,
373
+ flags
347
374
  }) => ({
348
375
  verb: "get",
349
376
  description,
350
377
  operation: { type: "query", name: operation },
351
378
  requiredFlags: [flagId],
352
379
  output: { view: true, selection: true },
353
- notes
380
+ flags,
381
+ notes,
382
+ examples
354
383
  });
355
384
  const listVerb = ({
356
385
  operation,
357
386
  description,
358
387
  notes,
359
- flags
388
+ flags,
389
+ examples
360
390
  }) => ({
361
391
  verb: "list",
362
392
  description,
363
393
  operation: { type: "query", name: operation },
364
394
  output: { view: true, selection: true, pagination: true },
365
395
  notes,
366
- flags
396
+ flags,
397
+ examples
367
398
  });
368
399
  const deleteVerb = ({
369
400
  operation,
370
401
  description,
371
402
  requiredFlags = [],
372
- notes
403
+ flags,
404
+ notes,
405
+ examples
373
406
  }) => ({
374
407
  verb: "delete",
375
408
  description,
376
409
  operation: { type: "mutation", name: operation },
377
410
  requiredFlags: [flagId, flagYes, ...requiredFlags],
378
- notes
411
+ flags,
412
+ notes,
413
+ examples
379
414
  });
380
415
  const duplicateVerb = ({
381
416
  operation,
382
417
  description,
383
418
  requiredFlags = [],
384
419
  flags,
385
- notes
420
+ notes,
421
+ examples
386
422
  }) => ({
387
423
  verb: "duplicate",
388
424
  description,
389
425
  operation: { type: "mutation", name: operation },
390
426
  requiredFlags: [flagId, ...requiredFlags],
391
427
  flags,
392
- notes
428
+ notes,
429
+ examples
393
430
  });
394
431
  const countVerb = ({
395
432
  operation,
396
433
  description,
397
- flags
434
+ flags,
435
+ examples
398
436
  }) => ({
399
437
  verb: "count",
400
438
  description,
401
439
  operation: { type: "query", name: operation },
402
- flags
440
+ flags,
441
+ examples
403
442
  });
404
443
  const inputVerb = ({
405
444
  verb,
@@ -409,6 +448,7 @@ const inputVerb = ({
409
448
  requiredFlags = [],
410
449
  flags,
411
450
  notes,
451
+ examples,
412
452
  inputRequired = true,
413
453
  output
414
454
  }) => ({
@@ -419,6 +459,7 @@ const inputVerb = ({
419
459
  requiredFlags,
420
460
  flags,
421
461
  notes,
462
+ examples,
422
463
  output
423
464
  });
424
465
  const fieldsVerb = {
@@ -430,156 +471,295 @@ const baseCommandRegistry = [
430
471
  {
431
472
  resource: "products",
432
473
  description: "Manage products.",
474
+ notes: [
475
+ "To list products in a collection, use `shop collections list-products --id <collectionId>` or `shop collections list-products --handle <handle>`."
476
+ ],
433
477
  verbs: [
434
- createVerb({ operation: "productCreate", description: "Create a new product." }),
435
- getVerb({ operation: "product", description: "Fetch a product by ID." }),
478
+ createVerb({
479
+ operation: "productCreate",
480
+ description: "Create a new product.",
481
+ examples: [
482
+ 'shop products create --set title="Summer Hat" --set status=DRAFT',
483
+ "shop products create --input @product.json"
484
+ ]
485
+ }),
486
+ getVerb({
487
+ operation: "product",
488
+ description: "Fetch a product by ID.",
489
+ flags: [flagProductId],
490
+ notes: [
491
+ "To list products in a collection, use `shop collections list-products --id <collectionId>` or `shop collections list-products --handle <handle>`."
492
+ ],
493
+ examples: [
494
+ "shop products get --id 123",
495
+ "shop products get --product-id 123",
496
+ "shop products get --id gid://shopify/Product/123 --view full"
497
+ ]
498
+ }),
436
499
  {
437
500
  verb: "by-handle",
438
501
  description: "Fetch a product by handle.",
439
502
  operation: { type: "query", name: "productByHandle" },
440
503
  requiredFlags: [flagHandle],
441
- output: { view: true, selection: true }
504
+ output: { view: true, selection: true },
505
+ examples: [
506
+ 'shop products by-handle --handle "summer-hat"'
507
+ ]
442
508
  },
443
509
  {
444
510
  verb: "by-identifier",
445
511
  description: "Fetch a product by identifier.",
446
512
  operation: { type: "query", name: "productByIdentifier" },
447
513
  requiredFlags: [flagIdentifierJsonFile],
448
- output: { view: true, selection: true }
514
+ output: { view: true, selection: true },
515
+ examples: [
516
+ `shop products by-identifier --identifier '{"handle":"summer-hat"}'`
517
+ ]
449
518
  },
450
519
  listVerb({
451
520
  operation: "products",
452
521
  description: "List products.",
453
- flags: [flagPublished]
522
+ flags: [flagPublished],
523
+ notes: [
524
+ "To list products in a collection, use `shop collections list-products --id <collectionId>` or `shop collections list-products --handle <handle>`."
525
+ ],
526
+ examples: [
527
+ "shop products list",
528
+ 'shop products list --query "status:active"',
529
+ "shop products list --published --first 50"
530
+ ]
454
531
  }),
455
532
  countVerb({
456
533
  operation: "productsCount",
457
534
  description: "Count products.",
458
- flags: [flagQuery, flagLimit, flagSavedSearchId]
535
+ flags: [flagQuery, flagLimit, flagSavedSearchId],
536
+ examples: [
537
+ "shop products count",
538
+ 'shop products count --query "status:active"'
539
+ ]
459
540
  }),
460
541
  {
461
542
  verb: "tags",
462
543
  description: "List product tags in the shop.",
463
544
  operation: { type: "query", name: "productTags" },
464
- output: { pagination: true }
545
+ output: { pagination: true },
546
+ examples: ["shop products tags"]
465
547
  },
466
548
  {
467
549
  verb: "types",
468
550
  description: "List product types in the shop.",
469
551
  operation: { type: "query", name: "productTypes" },
470
- output: { pagination: true }
552
+ output: { pagination: true },
553
+ examples: ["shop products types"]
471
554
  },
472
555
  {
473
556
  verb: "vendors",
474
557
  description: "List product vendors in the shop.",
475
558
  operation: { type: "query", name: "productVendors" },
476
- output: { pagination: true }
559
+ output: { pagination: true },
560
+ examples: ["shop products vendors"]
477
561
  },
478
- updateVerb({ operation: "productUpdate", description: "Update a product." }),
479
- deleteVerb({ operation: "productDelete", description: "Delete a product." }),
562
+ updateVerb({
563
+ operation: "productUpdate",
564
+ description: "Update a product.",
565
+ flags: [flagProductId],
566
+ examples: [
567
+ 'shop products update --id 123 --set title="New Title"',
568
+ 'shop products update --product-id 123 --set title="New Title"',
569
+ "shop products update --id 123 --input @updates.json"
570
+ ]
571
+ }),
572
+ deleteVerb({
573
+ operation: "productDelete",
574
+ description: "Delete a product.",
575
+ flags: [flagProductId],
576
+ examples: ["shop products delete --id 123 --yes"]
577
+ }),
480
578
  duplicateVerb({
481
579
  operation: "productDuplicate",
482
580
  description: "Duplicate a product.",
483
581
  flags: [
582
+ flagProductId,
484
583
  flagNewTitle,
485
584
  flagSet,
486
585
  flagSetJson
487
586
  ],
488
- notes: ['You can also pass --set newTitle="..." to override the duplicate title.']
587
+ notes: ['You can also pass --set newTitle="..." to override the duplicate title.'],
588
+ examples: [
589
+ "shop products duplicate --id 123",
590
+ "shop products duplicate --product-id 123",
591
+ 'shop products duplicate --id 123 --set newTitle="Copy of Product"'
592
+ ]
489
593
  }),
490
594
  {
491
595
  verb: "archive",
492
596
  description: "Archive a product (sets status=ARCHIVED).",
493
597
  operation: { type: "mutation", name: "productUpdate" },
494
598
  requiredFlags: [flagId],
495
- output: { view: true, selection: true }
599
+ flags: [flagProductId],
600
+ output: { view: true, selection: true },
601
+ examples: ["shop products archive --id 123"]
496
602
  },
497
603
  {
498
604
  verb: "unarchive",
499
605
  description: "Unarchive a product (sets status=DRAFT by default).",
500
606
  operation: { type: "mutation", name: "productUpdate" },
501
607
  requiredFlags: [flagId],
502
- flags: [flagStatus],
608
+ flags: [flagProductId, flagStatus],
503
609
  notes: ["Use --status to set the post-unarchive status (default: DRAFT)."],
504
- output: { view: true, selection: true }
610
+ output: { view: true, selection: true },
611
+ examples: [
612
+ "shop products unarchive --id 123",
613
+ "shop products unarchive --product-id 123",
614
+ "shop products unarchive --id 123 --status ACTIVE"
615
+ ]
505
616
  },
506
617
  {
507
618
  verb: "set-status",
508
619
  description: "Set product status.",
509
620
  operation: { type: "mutation", name: "productUpdate" },
510
- requiredFlags: [flagId, flagStatus]
621
+ requiredFlags: [flagId, flagStatus],
622
+ flags: [flagProductId],
623
+ examples: ["shop products set-status --id 123 --status ACTIVE"]
511
624
  },
512
625
  {
513
626
  verb: "change-status",
514
627
  description: "Change product status (deprecated).",
515
628
  operation: { type: "mutation", name: "productChangeStatus" },
516
629
  requiredFlags: [flagId, flagStatus],
517
- notes: ["Prefer `shop products set-status` (productUpdate)."]
630
+ flags: [flagProductId],
631
+ notes: ["Prefer `shop products set-status` (productUpdate)."],
632
+ examples: ["shop products change-status --id 123 --status DRAFT"]
518
633
  },
519
634
  {
520
635
  verb: "set",
521
636
  description: "Create or update products via productSet.",
522
637
  operation: { type: "mutation", name: "productSet", inputArg: "input" },
523
638
  input: { mode: "set", arg: "input", required: true },
524
- flags: [...inputFlags, flagIdentifierJsonFile, flagSynchronous]
639
+ flags: [...inputFlags, flagIdentifierJsonFile, flagSynchronous],
640
+ examples: [
641
+ "shop products set --input @product.json",
642
+ 'shop products set --set title="Hat" --set productType="Accessories"'
643
+ ]
525
644
  },
526
645
  {
527
646
  verb: "operation",
528
647
  description: "Fetch a product operation by ID.",
529
648
  operation: { type: "query", name: "productOperation" },
530
649
  requiredFlags: [flagId],
531
- output: { view: true, selection: true }
650
+ output: { view: true, selection: true },
651
+ examples: ["shop products operation --id gid://shopify/ProductSetOperation/123"]
532
652
  },
533
653
  {
534
654
  verb: "duplicate-job",
535
655
  description: "Fetch a product duplicate job by ID.",
536
656
  operation: { type: "query", name: "productDuplicateJob" },
537
657
  requiredFlags: [flagId],
538
- output: { view: true, selection: true }
658
+ output: { view: true, selection: true },
659
+ examples: ["shop products duplicate-job --id gid://shopify/ProductDuplicateJob/123"]
539
660
  },
540
661
  {
541
662
  verb: "join-selling-plan-groups",
542
663
  description: "Join selling plan groups.",
543
664
  operation: { type: "mutation", name: "productJoinSellingPlanGroups" },
544
- requiredFlags: [flagId, flagGroupIds]
665
+ requiredFlags: [flagId, flagGroupIds],
666
+ flags: [flagProductId],
667
+ examples: ["shop products join-selling-plan-groups --id 123 --group-ids 456"]
545
668
  },
546
669
  {
547
670
  verb: "leave-selling-plan-groups",
548
671
  description: "Leave selling plan groups.",
549
672
  operation: { type: "mutation", name: "productLeaveSellingPlanGroups" },
550
- requiredFlags: [flagId, flagGroupIds]
673
+ requiredFlags: [flagId, flagGroupIds],
674
+ flags: [flagProductId],
675
+ examples: ["shop products leave-selling-plan-groups --id 123 --group-ids 456"]
551
676
  },
552
677
  {
553
- verb: "option-update",
554
- description: "Update a product option.",
555
- operation: { type: "mutation", name: "productOptionUpdate" },
556
- requiredFlags: [flagProductId, flagOption],
557
- flags: [
558
- flagOptionValuesToAdd,
559
- flagOptionValuesToDelete,
560
- flagOptionValuesToUpdate,
561
- flagVariantStrategy
678
+ verb: "options list",
679
+ description: "List options for a product.",
680
+ operation: { type: "query", name: "product" },
681
+ requiredFlags: [flagProductId],
682
+ output: { view: true, selection: true },
683
+ notes: ["Product options are not paginated (no --after / Next page)."],
684
+ examples: [
685
+ "shop products options list --product-id 123",
686
+ "shop products options list --product-id 123 --view full"
562
687
  ]
563
688
  },
564
689
  {
565
- verb: "options-create",
690
+ verb: "options create",
566
691
  description: "Create product options.",
567
692
  operation: { type: "mutation", name: "productOptionsCreate" },
568
- requiredFlags: [flagProductId, flagOptions],
569
- flags: [flagVariantStrategy]
693
+ requiredFlags: [flagProductId],
694
+ flags: [
695
+ flagVariantStrategy,
696
+ flagOption,
697
+ flagOptionsJson
698
+ ],
699
+ notes: ["Pass one or more --option entries, or use --options-json for advanced inputs."],
700
+ output: { view: true, selection: true },
701
+ examples: [
702
+ 'shop products options create --product-id 123 --option "Size=Small,Medium,Large"',
703
+ 'shop products options create --product-id 123 --option "Size=S,M,L" --option "Color=Red,Blue" --variant-strategy CREATE'
704
+ ]
570
705
  },
571
706
  {
572
- verb: "options-delete",
707
+ verb: "options update",
708
+ description: "Update a product option.",
709
+ operation: { type: "mutation", name: "productOptionUpdate" },
710
+ requiredFlags: [flagProductId, flagOptionId],
711
+ flags: [
712
+ flagName,
713
+ flagPosition,
714
+ flagVariantStrategy,
715
+ flagAddValue,
716
+ flagDeleteValue,
717
+ flagRenameValue,
718
+ flagDeleteValueId,
719
+ flagRenameValueId,
720
+ flagOptionJson,
721
+ flagAddValuesJson,
722
+ flagDeleteValueIdsJson,
723
+ flagUpdateValuesJson
724
+ ],
725
+ notes: [
726
+ "Name-based value changes require fetching current option value IDs.",
727
+ "In --dry-run mode, prefer ID-based flags (e.g. --delete-value-id) or JSON flags."
728
+ ],
729
+ output: { view: true, selection: true },
730
+ examples: [
731
+ 'shop products options update --product-id 123 --option-id 456 --name "Size"',
732
+ "shop products options update --product-id 123 --option-id 456 --add-value XL",
733
+ 'shop products options update --product-id 123 --option-id 456 --rename-value "Medium=Med"'
734
+ ]
735
+ },
736
+ {
737
+ verb: "options delete",
573
738
  description: "Delete product options.",
574
739
  operation: { type: "mutation", name: "productOptionsDelete" },
575
- requiredFlags: [flagProductId, flagOptionIds],
576
- flags: [flagStrategy]
740
+ requiredFlags: [flagProductId],
741
+ flags: [flagOptionId, flagOptionName, flagStrategy],
742
+ notes: ["Pass one or more --option-id and/or --option-name entries."],
743
+ examples: [
744
+ 'shop products options delete --product-id 123 --option-name "Color"',
745
+ "shop products options delete --product-id 123 --option-id gid://shopify/ProductOption/456"
746
+ ]
577
747
  },
578
748
  {
579
- verb: "options-reorder",
749
+ verb: "options reorder",
580
750
  description: "Reorder product options and values.",
581
751
  operation: { type: "mutation", name: "productOptionsReorder" },
582
- requiredFlags: [flagProductId, flagOptions]
752
+ requiredFlags: [flagProductId],
753
+ flags: [flagOrder, flagOptionsJson],
754
+ notes: [
755
+ 'If you specify values (e.g. --order "Color=Green,Red,Blue"), you must include the full value order for that option.',
756
+ "In --dry-run mode, value reordering via --order is not supported (use --options-json)."
757
+ ],
758
+ output: { view: true, selection: true },
759
+ examples: [
760
+ 'shop products options reorder --product-id 123 --order "Size" --order "Color"',
761
+ 'shop products options reorder --product-id 123 --order "Color=Green,Red,Blue"'
762
+ ]
583
763
  },
584
764
  {
585
765
  verb: "combined-listing-update",
@@ -592,19 +772,93 @@ const baseCommandRegistry = [
592
772
  flagProductsEdited,
593
773
  flagProductsRemovedIds,
594
774
  flagOptionsAndValues
775
+ ],
776
+ examples: [
777
+ 'shop products combined-listing-update --parent-product-id 123 --title "Combined Product"'
595
778
  ]
596
779
  },
597
780
  {
598
781
  verb: "add-tags",
599
782
  description: "Add tags to a product.",
600
783
  operation: { type: "mutation", name: "tagsAdd" },
601
- requiredFlags: [flagId, flagTags]
784
+ requiredFlags: [flagId, flagTags],
785
+ flags: [flagProductId],
786
+ examples: ['shop products add-tags --id 123 --tags "sale,featured"']
602
787
  },
603
788
  {
604
789
  verb: "remove-tags",
605
790
  description: "Remove tags from a product.",
606
791
  operation: { type: "mutation", name: "tagsRemove" },
607
- requiredFlags: [flagId, flagTags]
792
+ requiredFlags: [flagId, flagTags],
793
+ flags: [flagProductId],
794
+ examples: ['shop products remove-tags --id 123 --tags "clearance"']
795
+ },
796
+ {
797
+ verb: "variants list",
798
+ description: "List variants for a product.",
799
+ operation: { type: "query", name: "product" },
800
+ requiredFlags: [flagProductId],
801
+ flags: [flagFirst, flagAfter, flagSort, flagReverse],
802
+ output: { view: true, selection: true, pagination: true },
803
+ notes: ["This is product-scoped (no --query). For global search, use `shop product-variants list --query ...`."],
804
+ examples: ["shop products variants list --product-id 123"]
805
+ },
806
+ {
807
+ verb: "variants create",
808
+ description: "Create a single variant for a product.",
809
+ operation: { type: "mutation", name: "productVariantsBulkCreate" },
810
+ requiredFlags: [flagProductId, flag("--variant-option <name=value>", "Variant option value (repeatable)")],
811
+ flags: [
812
+ flag("--sku <string>", "SKU (sets inventoryItem.sku)"),
813
+ flag("--barcode <string>", "Barcode"),
814
+ flag("--price <amount>", "Price amount"),
815
+ flag("--compare-at-price <amount>", "Compare-at price amount"),
816
+ flag("--inventory-policy <value>", "DENY|CONTINUE"),
817
+ flagStrategy
818
+ ],
819
+ output: { view: true, selection: true },
820
+ notes: ["Uses productVariantsBulkCreate with a single-item variants array."],
821
+ examples: [
822
+ "shop products variants create --product-id 123 --variant-option Size=Large --price 29.99",
823
+ "shop products variants create --product-id 123 --variant-option Color=Red --variant-option Size=M --sku RED-M-001"
824
+ ]
825
+ },
826
+ {
827
+ verb: "variants update",
828
+ description: "Update a single variant for a product.",
829
+ operation: { type: "mutation", name: "productVariantsBulkUpdate" },
830
+ requiredFlags: [flagProductId, flagVariantId],
831
+ flags: [
832
+ flag("--variant-option <name=value>", "Variant option value (repeatable)"),
833
+ flag("--sku <string>", "SKU (sets inventoryItem.sku)"),
834
+ flag("--barcode <string>", "Barcode"),
835
+ flag("--price <amount>", "Price amount"),
836
+ flag("--compare-at-price <amount>", "Compare-at price amount"),
837
+ flag("--inventory-policy <value>", "DENY|CONTINUE"),
838
+ flagAllowPartialUpdates
839
+ ],
840
+ output: { view: true, selection: true },
841
+ notes: ["Uses productVariantsBulkUpdate with a single-item variants array."],
842
+ examples: [
843
+ "shop products variants update --product-id 123 --variant-id 456 --price 24.99",
844
+ "shop products variants update --product-id 123 --variant-id 456 --sku NEW-SKU --barcode 123456789"
845
+ ]
846
+ },
847
+ {
848
+ verb: "variants delete",
849
+ description: "Delete a single variant from a product.",
850
+ operation: { type: "mutation", name: "productVariantsBulkDelete" },
851
+ requiredFlags: [flagProductId, flagVariantId],
852
+ notes: ["Uses productVariantsBulkDelete with a single variant ID."],
853
+ examples: ["shop products variants delete --product-id 123 --variant-id 456"]
854
+ },
855
+ {
856
+ verb: "variants reorder",
857
+ description: "Move a single variant to a specific 1-based position.",
858
+ operation: { type: "mutation", name: "productVariantsBulkReorder" },
859
+ requiredFlags: [flagProductId, flagVariantId, flag("--position <n>", "1-based position")],
860
+ notes: ["Uses productVariantsBulkReorder with a single position entry."],
861
+ examples: ["shop products variants reorder --product-id 123 --variant-id 456 --position 1"]
608
862
  },
609
863
  {
610
864
  verb: "set-price",
@@ -615,116 +869,153 @@ const baseCommandRegistry = [
615
869
  flag("--compare-at-price <amount>", "Compare-at price amount"),
616
870
  flagProductId
617
871
  ],
618
- notes: ["--product-id is required in --dry-run mode."]
872
+ notes: ["--product-id is required in --dry-run mode."],
873
+ examples: [
874
+ "shop products set-price --variant-id 456 --price 19.99",
875
+ "shop products set-price --variant-id 456 --price 19.99 --compare-at-price 29.99"
876
+ ]
619
877
  },
620
878
  {
621
879
  verb: "publish",
622
880
  description: "Publish a product to specific publications.",
623
881
  operation: { type: "mutation", name: "publishablePublish" },
624
882
  requiredFlags: [flagId],
625
- flags: [flagPublicationId, flagPublication, flagAt, flagNow],
626
- notes: ["Pass either --publication-id or --publication (name)."]
883
+ flags: [flagProductId, flagPublicationId, flagPublication, flagAt, flagNow],
884
+ notes: ["Pass either --publication-id or --publication (name)."],
885
+ examples: [
886
+ 'shop products publish --id 123 --publication "Online Store"',
887
+ 'shop products publish --product-id 123 --publication "Online Store"',
888
+ "shop products publish --id 123 --publication-id 456 --now"
889
+ ]
627
890
  },
628
891
  {
629
892
  verb: "unpublish",
630
893
  description: "Unpublish a product from specific publications.",
631
894
  operation: { type: "mutation", name: "publishableUnpublish" },
632
895
  requiredFlags: [flagId],
633
- flags: [flagPublicationId, flagPublication],
634
- notes: ["Pass either --publication-id or --publication (name)."]
896
+ flags: [flagProductId, flagPublicationId, flagPublication],
897
+ notes: ["Pass either --publication-id or --publication (name)."],
898
+ examples: [
899
+ 'shop products unpublish --id 123 --publication "Online Store"',
900
+ 'shop products unpublish --product-id 123 --publication "Online Store"'
901
+ ]
635
902
  },
636
903
  {
637
904
  verb: "publish-all",
638
905
  description: "Publish a product to all publications.",
639
906
  operation: { type: "mutation", name: "publishablePublish" },
640
907
  requiredFlags: [flagId],
641
- flags: [flagAt, flagNow]
908
+ flags: [flagProductId, flagAt, flagNow],
909
+ examples: [
910
+ "shop products publish-all --id 123",
911
+ "shop products publish-all --product-id 123"
912
+ ]
642
913
  },
643
914
  {
644
915
  verb: "metafields upsert",
645
916
  description: "Upsert product metafields.",
646
917
  operation: { type: "mutation", name: "metafieldsSet", inputArg: "metafields" },
647
918
  input: { mode: "set", arg: "metafields", required: true },
648
- requiredFlags: [flagId],
649
- notes: ["Input can be a single object or { metafields: [...] }."]
919
+ requiredFlags: [flagProductId],
920
+ notes: ["Input can be a single object or { metafields: [...] }."],
921
+ examples: [
922
+ "shop products metafields upsert --product-id 123 --set namespace=custom --set key=color --set value=red --set type=single_line_text_field"
923
+ ]
650
924
  },
651
925
  {
652
926
  verb: "media add",
653
927
  description: "Attach remote media URLs to a product.",
654
928
  operation: { type: "mutation", name: "productUpdate" },
655
- requiredFlags: [flagId, flagUrl],
656
- flags: [flagAlt, flagMediaType]
929
+ requiredFlags: [flagProductId, flagUrl],
930
+ flags: [
931
+ flagAlt,
932
+ flagMediaType,
933
+ flagFilesUploadWait,
934
+ flagPollIntervalMs,
935
+ flagTimeoutMs
936
+ ],
937
+ notes: [
938
+ "Alias: --media-content-type is accepted as --media-type."
939
+ ],
940
+ examples: [
941
+ 'shop products media add --product-id 123 --url "https://example.com/image.jpg"',
942
+ 'shop products media add --product-id 123 --url "https://example.com/a.jpg" --url "https://example.com/b.jpg" --wait'
943
+ ]
657
944
  },
658
945
  {
659
946
  verb: "media upload",
660
947
  description: "Upload local files as product media.",
661
948
  operation: { type: "mutation", name: "productUpdate" },
662
- requiredFlags: [flagId, flagFile],
663
- flags: [flagAlt, flagContentType, flagMediaType]
949
+ requiredFlags: [flagProductId, flagFile],
950
+ flags: [
951
+ flagAlt,
952
+ flagFilesUploadFilename,
953
+ flagFilesUploadMimeType,
954
+ flagMediaType,
955
+ flagFilesUploadWait,
956
+ flagPollIntervalMs,
957
+ flagTimeoutMs
958
+ ],
959
+ notes: [
960
+ "To attach by URL, use `shop products media add --url ...`.",
961
+ "Use --file - to read from stdin; requires --filename.",
962
+ "Aliases: --content-type is accepted as --mime-type; --media-content-type is accepted as --media-type."
963
+ ],
964
+ examples: [
965
+ "shop products media upload --product-id 123 --file ./photo.jpg",
966
+ "shop products media upload --product-id 123 --file ./a.jpg --file ./b.jpg --wait",
967
+ "cat image.png | shop products media upload --product-id 123 --file - --filename image.png"
968
+ ]
664
969
  },
665
970
  {
666
971
  verb: "media list",
667
972
  description: "List media for a product.",
668
973
  operation: { type: "query", name: "product" },
669
- requiredFlags: [flagId],
670
- output: { pagination: true }
974
+ requiredFlags: [flagProductId],
975
+ output: { pagination: true },
976
+ examples: ["shop products media list --product-id 123"]
671
977
  },
672
978
  {
673
979
  verb: "media remove",
674
980
  description: "Remove media references from a product.",
675
981
  operation: { type: "mutation", name: "fileUpdate" },
676
- requiredFlags: [flagId, flagMediaId],
677
- notes: ["Repeat --media-id to remove multiple items."]
982
+ requiredFlags: [flagProductId, flagMediaId],
983
+ notes: ["Repeat --media-id to remove multiple items."],
984
+ examples: [
985
+ "shop products media remove --product-id 123 --media-id gid://shopify/MediaImage/1",
986
+ "shop products media remove --product-id 123 --media-id gid://shopify/MediaImage/1 --media-id gid://shopify/MediaImage/2"
987
+ ]
678
988
  },
679
989
  {
680
990
  verb: "media update",
681
991
  description: "Update media metadata (alt text).",
682
992
  operation: { type: "mutation", name: "fileUpdate" },
683
- requiredFlags: [flagMediaId, flagAlt]
993
+ requiredFlags: [flagMediaId, flagAlt],
994
+ examples: ['shop products media update --media-id gid://shopify/MediaImage/1 --alt "Product photo"']
684
995
  },
685
996
  {
686
997
  verb: "media reorder",
687
- description: "Reorder a product\u2019s media.",
998
+ description: "Reorder a product's media.",
688
999
  operation: { type: "mutation", name: "productReorderMedia" },
689
- requiredFlags: [flagId],
690
- flags: [flagMoves, flagMove],
691
- notes: ["Pass either --moves or one or more --move entries."]
692
- },
693
- {
694
- verb: "reorder-media",
695
- description: "Reorder a product\u2019s media.",
696
- operation: { type: "mutation", name: "productReorderMedia" },
697
- requiredFlags: [flagId],
1000
+ requiredFlags: [flagProductId],
698
1001
  flags: [flagMoves, flagMove],
699
- notes: ["Alias for `shop products media reorder`."]
700
- },
701
- {
702
- verb: "create-media",
703
- description: "Create media for a product (deprecated).",
704
- operation: { type: "mutation", name: "productCreateMedia" },
705
- requiredFlags: [flagProductId, flagMedia]
706
- },
707
- {
708
- verb: "update-media",
709
- description: "Update media for a product (deprecated).",
710
- operation: { type: "mutation", name: "productUpdateMedia" },
711
- requiredFlags: [flagProductId, flagMedia]
712
- },
713
- {
714
- verb: "delete-media",
715
- description: "Delete media from a product (deprecated).",
716
- operation: { type: "mutation", name: "productDeleteMedia" },
717
- requiredFlags: [flagProductId, flagMediaIds]
1002
+ notes: ["Pass either --moves or one or more --move entries."],
1003
+ examples: [
1004
+ "shop products media reorder --product-id 123 --move gid://shopify/MediaImage/1:0",
1005
+ `shop products media reorder --product-id 123 --moves '[{"id":"gid://shopify/MediaImage/1","newPosition":0}]'`
1006
+ ]
718
1007
  },
719
1008
  inputVerb({
720
1009
  verb: "bundle-create",
721
1010
  description: "Create a product bundle.",
722
- operation: "productBundleCreate"
1011
+ operation: "productBundleCreate",
1012
+ examples: ["shop products bundle-create --input @bundle.json"]
723
1013
  }),
724
1014
  inputVerb({
725
1015
  verb: "bundle-update",
726
1016
  description: "Update a product bundle.",
727
- operation: "productBundleUpdate"
1017
+ operation: "productBundleUpdate",
1018
+ examples: ["shop products bundle-update --input @bundle.json"]
728
1019
  })
729
1020
  ]
730
1021
  },
@@ -738,16 +1029,31 @@ const baseCommandRegistry = [
738
1029
  input: { mode: "set", required: true },
739
1030
  requiredFlags: [flagProductId],
740
1031
  flags: [flagAllowPartialUpdates, flagStrategy],
741
- notes: ["Input can be an array or { variants: [...] }."]
1032
+ notes: ["Input can be an array or { variants: [...] }."],
1033
+ examples: [
1034
+ "shop product-variants upsert --product-id 123 --input @variants.json",
1035
+ "shop product-variants upsert --product-id 123 --input @variants.json --allow-partial-updates --strategy PRESERVE_STANDALONE_VARIANT"
1036
+ ]
742
1037
  },
743
- getVerb({ operation: "productVariant", description: "Fetch a variant by ID." }),
1038
+ getVerb({
1039
+ operation: "productVariant",
1040
+ description: "Fetch a variant by ID.",
1041
+ examples: [
1042
+ "shop product-variants get --id 123",
1043
+ "shop product-variants get --id 123 --view full"
1044
+ ]
1045
+ }),
744
1046
  {
745
1047
  verb: "get-by-identifier",
746
1048
  description: "Fetch a variant by identifier (product + sku/barcode).",
747
1049
  operation: { type: "query", name: "productVariantByIdentifier" },
748
1050
  flags: [flagProductId, flag("--sku <string>", "SKU"), flag("--barcode <string>", "Barcode")],
749
1051
  output: { view: true, selection: true },
750
- notes: ["Provide --product-id plus --sku or --barcode, or pass --input."]
1052
+ notes: ["Provide --product-id plus --sku or --barcode, or pass --input."],
1053
+ examples: [
1054
+ 'shop product-variants get-by-identifier --product-id 123 --sku "SKU-123"',
1055
+ "shop product-variants get-by-identifier --input @variant-identifier.json"
1056
+ ]
751
1057
  },
752
1058
  {
753
1059
  verb: "by-identifier",
@@ -755,23 +1061,49 @@ const baseCommandRegistry = [
755
1061
  operation: { type: "query", name: "productVariantByIdentifier" },
756
1062
  flags: [flagProductId, flag("--sku <string>", "SKU"), flag("--barcode <string>", "Barcode")],
757
1063
  output: { view: true, selection: true },
758
- notes: ["Alias for `shop product-variants get-by-identifier`."]
1064
+ notes: ["Alias for `shop product-variants get-by-identifier`."],
1065
+ examples: [
1066
+ 'shop product-variants by-identifier --product-id 123 --barcode "0123456789012"'
1067
+ ]
759
1068
  },
760
- listVerb({ operation: "productVariants", description: "List product variants." }),
761
- countVerb({ operation: "productVariantsCount", description: "Count product variants.", flags: [flagQuery] }),
1069
+ listVerb({
1070
+ operation: "productVariants",
1071
+ description: "List product variants.",
1072
+ examples: [
1073
+ "shop product-variants list --first 10 --format table",
1074
+ 'shop product-variants list --query "sku:SKU-*" --first 50'
1075
+ ]
1076
+ }),
1077
+ countVerb({
1078
+ operation: "productVariantsCount",
1079
+ description: "Count product variants.",
1080
+ flags: [flagQuery],
1081
+ examples: [
1082
+ "shop product-variants count",
1083
+ 'shop product-variants count --query "sku:SKU-*"'
1084
+ ]
1085
+ }),
762
1086
  inputVerb({
763
1087
  verb: "bulk-create",
764
1088
  description: "Bulk create variants for a product.",
765
1089
  operation: "productVariantsBulkCreate",
766
1090
  requiredFlags: [flagProductId],
767
- flags: [flagAllowPartialUpdates]
1091
+ flags: [flagAllowPartialUpdates],
1092
+ output: { view: true, selection: true },
1093
+ examples: [
1094
+ "shop product-variants bulk-create --product-id 123 --input @variants.json"
1095
+ ]
768
1096
  }),
769
1097
  inputVerb({
770
1098
  verb: "bulk-update",
771
1099
  description: "Bulk update variants for a product.",
772
1100
  operation: "productVariantsBulkUpdate",
773
1101
  requiredFlags: [flagProductId],
774
- flags: [flagAllowPartialUpdates]
1102
+ flags: [flagAllowPartialUpdates],
1103
+ output: { view: true, selection: true },
1104
+ examples: [
1105
+ "shop product-variants bulk-update --product-id 123 --input @variants.json"
1106
+ ]
775
1107
  }),
776
1108
  {
777
1109
  verb: "bulk-delete",
@@ -779,44 +1111,72 @@ const baseCommandRegistry = [
779
1111
  operation: { type: "mutation", name: "productVariantsBulkDelete" },
780
1112
  requiredFlags: [flagProductId, flagVariantIds],
781
1113
  flags: [flagIds],
782
- notes: ["Use --variant-ids or --ids."]
1114
+ notes: ["Use --variant-ids or --ids."],
1115
+ examples: [
1116
+ "shop product-variants bulk-delete --product-id 123 --variant-ids 456,789",
1117
+ "shop product-variants bulk-delete --product-id 123 --ids 456,789"
1118
+ ]
783
1119
  },
784
1120
  {
785
1121
  verb: "bulk-reorder",
786
1122
  description: "Reorder variants for a product.",
787
1123
  operation: { type: "mutation", name: "productVariantsBulkReorder" },
788
- requiredFlags: [flagProductId, flagPositions]
1124
+ requiredFlags: [flagProductId, flagPositions],
1125
+ notes: ["Positions format: [{ id: <variant gid>, position: <int> }, ...]. Position is 1-based (first is 1)."],
1126
+ examples: [
1127
+ `shop product-variants bulk-reorder --product-id 123 --positions '[{"id":"gid://shopify/ProductVariant/1","position":1}]'`,
1128
+ "shop product-variants bulk-reorder --product-id 123 --positions @positions.json"
1129
+ ]
789
1130
  },
790
1131
  {
791
1132
  verb: "append-media",
792
1133
  description: "Append media to a variant.",
793
1134
  operation: { type: "mutation", name: "productVariantAppendMedia" },
794
1135
  requiredFlags: [flagId],
795
- flags: [flagProductId, flagMediaIds, flagVariantMedia]
1136
+ flags: [flagProductId, flagMediaIds, flagVariantMedia],
1137
+ output: { view: true, selection: true },
1138
+ examples: [
1139
+ "shop product-variants append-media --id 123 --media-ids gid://shopify/MediaImage/1",
1140
+ "shop product-variants append-media --id 123 --product-id 456 --variant-media @variant-media.json"
1141
+ ]
796
1142
  },
797
1143
  {
798
1144
  verb: "detach-media",
799
1145
  description: "Detach media from a variant.",
800
1146
  operation: { type: "mutation", name: "productVariantDetachMedia" },
801
1147
  requiredFlags: [flagId],
802
- flags: [flagProductId, flagMediaIds, flagVariantMedia]
1148
+ flags: [flagProductId, flagMediaIds, flagVariantMedia],
1149
+ output: { view: true, selection: true },
1150
+ examples: [
1151
+ "shop product-variants detach-media --id 123 --media-ids gid://shopify/MediaImage/1",
1152
+ "shop product-variants detach-media --id 123 --product-id 456 --variant-media @variant-media.json"
1153
+ ]
803
1154
  },
804
1155
  {
805
1156
  verb: "join-selling-plans",
806
1157
  description: "Join selling plan groups.",
807
1158
  operation: { type: "mutation", name: "productVariantJoinSellingPlanGroups" },
808
- requiredFlags: [flagId, flagGroupIds]
1159
+ requiredFlags: [flagId, flagGroupIds],
1160
+ examples: [
1161
+ "shop product-variants join-selling-plans --id 123 --group-ids 456,789"
1162
+ ]
809
1163
  },
810
1164
  {
811
1165
  verb: "leave-selling-plans",
812
1166
  description: "Leave selling plan groups.",
813
1167
  operation: { type: "mutation", name: "productVariantLeaveSellingPlanGroups" },
814
- requiredFlags: [flagId, flagGroupIds]
1168
+ requiredFlags: [flagId, flagGroupIds],
1169
+ examples: [
1170
+ "shop product-variants leave-selling-plans --id 123 --group-ids 456,789"
1171
+ ]
815
1172
  },
816
1173
  inputVerb({
817
1174
  verb: "update-relationships",
818
1175
  description: "Bulk update variant relationships.",
819
- operation: "productVariantRelationshipBulkUpdate"
1176
+ operation: "productVariantRelationshipBulkUpdate",
1177
+ examples: [
1178
+ "shop product-variants update-relationships --input @variant-relationships.json"
1179
+ ]
820
1180
  })
821
1181
  ]
822
1182
  },
@@ -887,52 +1247,102 @@ const baseCommandRegistry = [
887
1247
  resource: "collections",
888
1248
  description: "Manage collections.",
889
1249
  verbs: [
890
- createVerb({ operation: "collectionCreate", description: "Create a collection." }),
891
- getVerb({ operation: "collection", description: "Fetch a collection by ID." }),
1250
+ createVerb({
1251
+ operation: "collectionCreate",
1252
+ description: "Create a collection.",
1253
+ examples: [
1254
+ 'shop collections create --set title="Summer collection"',
1255
+ "shop collections create --input @collection.json"
1256
+ ]
1257
+ }),
1258
+ getVerb({
1259
+ operation: "collection",
1260
+ description: "Fetch a collection by ID.",
1261
+ examples: [
1262
+ "shop collections get --id 123",
1263
+ "shop collections get --id 123 --view full"
1264
+ ]
1265
+ }),
892
1266
  {
893
1267
  verb: "by-handle",
894
1268
  description: "Fetch a collection by handle.",
895
1269
  operation: { type: "query", name: "collectionByHandle" },
896
1270
  requiredFlags: [flagHandle],
897
- output: { view: true, selection: true }
1271
+ output: { view: true, selection: true },
1272
+ examples: ["shop collections by-handle --handle frontpage"]
898
1273
  },
899
1274
  {
900
1275
  verb: "by-identifier",
901
1276
  description: "Fetch a collection by identifier.",
902
1277
  operation: { type: "query", name: "collectionByIdentifier" },
903
1278
  requiredFlags: [flagIdentifierJsonFile],
904
- output: { view: true, selection: true }
1279
+ output: { view: true, selection: true },
1280
+ examples: [`shop collections by-identifier --identifier '{"handle":"frontpage"}'`]
905
1281
  },
906
1282
  {
907
1283
  verb: "rules-conditions",
908
1284
  description: "List available smart collection rule conditions.",
909
1285
  operation: { type: "query", name: "collectionRulesConditions" },
910
- output: { view: true, selection: true }
1286
+ output: { view: true, selection: true },
1287
+ examples: ["shop collections rules-conditions"]
911
1288
  },
912
- listVerb({ operation: "collections", description: "List collections." }),
1289
+ listVerb({
1290
+ operation: "collections",
1291
+ description: "List collections.",
1292
+ examples: [
1293
+ "shop collections list --first 10 --format table",
1294
+ 'shop collections list --query "title:Summer"'
1295
+ ]
1296
+ }),
913
1297
  countVerb({
914
1298
  operation: "collectionsCount",
915
1299
  description: "Count collections.",
916
- flags: [flagQuery, flagLimit]
1300
+ flags: [flagQuery, flagLimit],
1301
+ examples: [
1302
+ "shop collections count",
1303
+ 'shop collections count --query "title:Summer"'
1304
+ ]
1305
+ }),
1306
+ updateVerb({
1307
+ operation: "collectionUpdate",
1308
+ description: "Update a collection.",
1309
+ examples: [
1310
+ 'shop collections update --id 123 --set title="Updated collection title"',
1311
+ "shop collections update --id 123 --input @collection-update.json"
1312
+ ]
1313
+ }),
1314
+ deleteVerb({
1315
+ operation: "collectionDelete",
1316
+ description: "Delete a collection.",
1317
+ examples: ["shop collections delete --id 123 --yes"]
917
1318
  }),
918
- updateVerb({ operation: "collectionUpdate", description: "Update a collection." }),
919
- deleteVerb({ operation: "collectionDelete", description: "Delete a collection." }),
920
1319
  duplicateVerb({
921
1320
  operation: "collectionDuplicate",
922
1321
  description: "Duplicate a collection.",
923
- flags: [flag("--copy-publications", "Copy publication settings to the duplicate")]
1322
+ flags: [flag("--copy-publications", "Copy publication settings to the duplicate")],
1323
+ examples: [
1324
+ "shop collections duplicate --id 123",
1325
+ "shop collections duplicate --id 123 --copy-publications"
1326
+ ]
924
1327
  }),
925
1328
  {
926
1329
  verb: "add-products",
927
1330
  description: "Add products to a collection.",
928
1331
  operation: { type: "mutation", name: "collectionAddProductsV2" },
929
- requiredFlags: [flagId, flag("--product-id <gid>", "Product IDs (repeatable or comma-separated)")]
1332
+ requiredFlags: [flagId, flag("--product-id <gid>", "Product IDs (repeatable or comma-separated)")],
1333
+ examples: [
1334
+ "shop collections add-products --id 123 --product-id 456 --product-id 789",
1335
+ "shop collections add-products --id 123 --product-id 456,789"
1336
+ ]
930
1337
  },
931
1338
  {
932
1339
  verb: "remove-products",
933
1340
  description: "Remove products from a collection.",
934
1341
  operation: { type: "mutation", name: "collectionRemoveProducts" },
935
- requiredFlags: [flagId, flag("--product-id <gid>", "Product IDs (repeatable or comma-separated)")]
1342
+ requiredFlags: [flagId, flag("--product-id <gid>", "Product IDs (repeatable or comma-separated)")],
1343
+ examples: [
1344
+ "shop collections remove-products --id 123 --product-id 456,789"
1345
+ ]
936
1346
  },
937
1347
  {
938
1348
  verb: "reorder-products",
@@ -940,7 +1350,26 @@ const baseCommandRegistry = [
940
1350
  operation: { type: "mutation", name: "collectionReorderProducts" },
941
1351
  requiredFlags: [flagId],
942
1352
  flags: [flagMoves, flagMove],
943
- notes: ["Pass either --moves or one or more --move entries."]
1353
+ notes: ["Pass either --moves or one or more --move entries."],
1354
+ examples: [
1355
+ "shop collections reorder-products --id 123 --move 456:0 --move 789:1",
1356
+ `shop collections reorder-products --id 123 --moves '[{"id":"gid://shopify/Product/456","newPosition":0}]'`
1357
+ ]
1358
+ },
1359
+ {
1360
+ verb: "list-products",
1361
+ description: "List products in a collection.",
1362
+ operation: { type: "query", name: "products" },
1363
+ flags: [flagId, flagHandle, flagPublished],
1364
+ notes: [
1365
+ "Pass exactly one of --id or --handle.",
1366
+ "Supports the same flags as `shop products list`."
1367
+ ],
1368
+ output: { view: true, selection: true, pagination: true },
1369
+ examples: [
1370
+ "shop collections list-products --id 123",
1371
+ "shop collections list-products --handle frontpage --published --format table"
1372
+ ]
944
1373
  },
945
1374
  {
946
1375
  verb: "publish",
@@ -948,7 +1377,11 @@ const baseCommandRegistry = [
948
1377
  operation: { type: "mutation", name: "collectionPublish" },
949
1378
  requiredFlags: [flagId],
950
1379
  flags: [flagPublicationId, flagPublication],
951
- notes: ["Pass either --publication-id or --publication (name)."]
1380
+ notes: ["Pass either --publication-id or --publication (name)."],
1381
+ examples: [
1382
+ 'shop collections publish --id 123 --publication "Online Store"',
1383
+ "shop collections publish --id 123 --publication-id gid://shopify/Publication/1"
1384
+ ]
952
1385
  },
953
1386
  {
954
1387
  verb: "unpublish",
@@ -956,7 +1389,11 @@ const baseCommandRegistry = [
956
1389
  operation: { type: "mutation", name: "collectionUnpublish" },
957
1390
  requiredFlags: [flagId],
958
1391
  flags: [flagPublicationId, flagPublication],
959
- notes: ["Pass either --publication-id or --publication (name)."]
1392
+ notes: ["Pass either --publication-id or --publication (name)."],
1393
+ examples: [
1394
+ 'shop collections unpublish --id 123 --publication "Online Store"',
1395
+ "shop collections unpublish --id 123 --publication-id gid://shopify/Publication/1"
1396
+ ]
960
1397
  }
961
1398
  ]
962
1399
  },
@@ -964,21 +1401,50 @@ const baseCommandRegistry = [
964
1401
  resource: "customers",
965
1402
  description: "Manage customers.",
966
1403
  verbs: [
967
- createVerb({ operation: "customerCreate", description: "Create a customer." }),
968
- getVerb({ operation: "customer", description: "Fetch a customer by ID." }),
1404
+ createVerb({
1405
+ operation: "customerCreate",
1406
+ description: "Create a customer.",
1407
+ examples: [
1408
+ 'shop customers create --set email="jane.doe@example.com" --set firstName=Jane --set lastName=Doe',
1409
+ "shop customers create --input @customer.json"
1410
+ ]
1411
+ }),
1412
+ getVerb({
1413
+ operation: "customer",
1414
+ description: "Fetch a customer by ID.",
1415
+ examples: [
1416
+ "shop customers get --id 123",
1417
+ "shop customers get --id 123 --view full"
1418
+ ]
1419
+ }),
969
1420
  {
970
1421
  verb: "by-identifier",
971
1422
  description: "Fetch a customer by identifier.",
972
1423
  operation: { type: "query", name: "customerByIdentifier" },
973
1424
  flags: [flagEmailAddress, flagPhoneNumber, flagIdentifierId, flagCustomId],
974
1425
  notes: ["Pass exactly one of --email-address, --phone-number, --identifier-id, --custom-id."],
975
- output: { view: true, selection: true }
1426
+ output: { view: true, selection: true },
1427
+ examples: [
1428
+ 'shop customers by-identifier --email-address "jane.doe@example.com"',
1429
+ 'shop customers by-identifier --phone-number "+14155550123"'
1430
+ ]
976
1431
  },
977
- listVerb({ operation: "customers", description: "List customers." }),
1432
+ listVerb({
1433
+ operation: "customers",
1434
+ description: "List customers.",
1435
+ examples: [
1436
+ "shop customers list --first 10 --format table",
1437
+ 'shop customers list --query "email:jane.doe@example.com"'
1438
+ ]
1439
+ }),
978
1440
  countVerb({
979
1441
  operation: "customersCount",
980
1442
  description: "Count customers.",
981
- flags: [flagQuery, flagLimit]
1443
+ flags: [flagQuery, flagLimit],
1444
+ examples: [
1445
+ "shop customers count",
1446
+ 'shop customers count --query "tag:vip" --limit 10000'
1447
+ ]
982
1448
  }),
983
1449
  {
984
1450
  verb: "set",
@@ -986,83 +1452,128 @@ const baseCommandRegistry = [
986
1452
  operation: { type: "mutation", name: "customerSet" },
987
1453
  requiredFlags: [],
988
1454
  flags: [...inputFlags, flagIdentifier],
989
- notes: ["Input is CustomerSetInput JSON. Optionally pass --identifier (CustomerSetIdentifiers JSON)."]
1455
+ notes: ["Input is CustomerSetInput JSON. Optionally pass --identifier (CustomerSetIdentifiers JSON)."],
1456
+ examples: [
1457
+ "shop customers set --input @customer-set.json",
1458
+ "shop customers set --input @customer-set.json --identifier @customer-identifiers.json"
1459
+ ]
990
1460
  },
991
- updateVerb({ operation: "customerUpdate", description: "Update a customer." }),
992
- deleteVerb({ operation: "customerDelete", description: "Delete a customer." }),
1461
+ updateVerb({
1462
+ operation: "customerUpdate",
1463
+ description: "Update a customer.",
1464
+ examples: [
1465
+ 'shop customers update --id 123 --set note="VIP customer"',
1466
+ "shop customers update --id 123 --input @customer-update.json"
1467
+ ]
1468
+ }),
1469
+ deleteVerb({
1470
+ operation: "customerDelete",
1471
+ description: "Delete a customer.",
1472
+ examples: ["shop customers delete --id 123 --yes"]
1473
+ }),
993
1474
  {
994
1475
  verb: "address-create",
995
1476
  description: "Create a customer address.",
996
1477
  operation: { type: "mutation", name: "customerAddressCreate" },
997
1478
  requiredFlags: [flagId, flagAddress],
998
- flags: [flagSetAsDefault]
1479
+ flags: [flagSetAsDefault],
1480
+ examples: [
1481
+ "shop customers address-create --id 123 --address @address.json --set-as-default true"
1482
+ ]
999
1483
  },
1000
1484
  {
1001
1485
  verb: "address-update",
1002
1486
  description: "Update a customer address.",
1003
1487
  operation: { type: "mutation", name: "customerAddressUpdate" },
1004
1488
  requiredFlags: [flagId, flagAddressId, flagAddress],
1005
- flags: [flagSetAsDefault]
1489
+ flags: [flagSetAsDefault],
1490
+ examples: [
1491
+ "shop customers address-update --id 123 --address-id 456 --address @address.json"
1492
+ ]
1006
1493
  },
1007
1494
  {
1008
1495
  verb: "address-delete",
1009
1496
  description: "Delete a customer address.",
1010
1497
  operation: { type: "mutation", name: "customerAddressDelete" },
1011
- requiredFlags: [flagId, flagAddressId]
1498
+ requiredFlags: [flagId, flagAddressId],
1499
+ examples: [
1500
+ "shop customers address-delete --id 123 --address-id 456"
1501
+ ]
1012
1502
  },
1013
1503
  {
1014
1504
  verb: "update-default-address",
1015
1505
  description: "Update a customer\u2019s default address.",
1016
1506
  operation: { type: "mutation", name: "customerUpdateDefaultAddress" },
1017
- requiredFlags: [flagId, flagAddressId]
1507
+ requiredFlags: [flagId, flagAddressId],
1508
+ examples: [
1509
+ "shop customers update-default-address --id 123 --address-id 456"
1510
+ ]
1018
1511
  },
1019
1512
  {
1020
1513
  verb: "email-marketing-consent-update",
1021
1514
  description: "Update a customer\u2019s email marketing consent.",
1022
1515
  operation: { type: "mutation", name: "customerEmailMarketingConsentUpdate" },
1023
- requiredFlags: [flagId, flagEmailMarketingConsent]
1516
+ requiredFlags: [flagId, flagEmailMarketingConsent],
1517
+ examples: [
1518
+ "shop customers email-marketing-consent-update --id 123 --email-marketing-consent @email-consent.json"
1519
+ ]
1024
1520
  },
1025
1521
  {
1026
1522
  verb: "sms-marketing-consent-update",
1027
1523
  description: "Update a customer\u2019s SMS marketing consent.",
1028
1524
  operation: { type: "mutation", name: "customerSmsMarketingConsentUpdate" },
1029
- requiredFlags: [flagId, flagSmsMarketingConsent]
1525
+ requiredFlags: [flagId, flagSmsMarketingConsent],
1526
+ examples: [
1527
+ "shop customers sms-marketing-consent-update --id 123 --sms-marketing-consent @sms-consent.json"
1528
+ ]
1030
1529
  },
1031
1530
  {
1032
1531
  verb: "add-tax-exemptions",
1033
1532
  description: "Add tax exemptions to a customer.",
1034
1533
  operation: { type: "mutation", name: "customerAddTaxExemptions" },
1035
- requiredFlags: [flagId, flagExemptions]
1534
+ requiredFlags: [flagId, flagExemptions],
1535
+ examples: [
1536
+ "shop customers add-tax-exemptions --id 123 --exemptions CA_STATUS_CARD"
1537
+ ]
1036
1538
  },
1037
1539
  {
1038
1540
  verb: "remove-tax-exemptions",
1039
1541
  description: "Remove tax exemptions from a customer.",
1040
1542
  operation: { type: "mutation", name: "customerRemoveTaxExemptions" },
1041
- requiredFlags: [flagId, flagExemptions]
1543
+ requiredFlags: [flagId, flagExemptions],
1544
+ examples: [
1545
+ "shop customers remove-tax-exemptions --id 123 --exemptions CA_STATUS_CARD"
1546
+ ]
1042
1547
  },
1043
1548
  {
1044
1549
  verb: "replace-tax-exemptions",
1045
1550
  description: "Replace tax exemptions on a customer.",
1046
1551
  operation: { type: "mutation", name: "customerReplaceTaxExemptions" },
1047
- requiredFlags: [flagId, flagExemptions]
1552
+ requiredFlags: [flagId, flagExemptions],
1553
+ examples: [
1554
+ "shop customers replace-tax-exemptions --id 123 --exemptions CA_STATUS_CARD,CA_BC_RESELLER"
1555
+ ]
1048
1556
  },
1049
1557
  {
1050
1558
  verb: "generate-account-activation-url",
1051
1559
  description: "Generate a one-time account activation URL (legacy accounts).",
1052
1560
  operation: { type: "mutation", name: "customerGenerateAccountActivationUrl" },
1053
- requiredFlags: [flagId]
1561
+ requiredFlags: [flagId],
1562
+ examples: ["shop customers generate-account-activation-url --id 123"]
1054
1563
  },
1055
1564
  {
1056
1565
  verb: "request-data-erasure",
1057
1566
  description: "Request erasure of a customer\u2019s data.",
1058
1567
  operation: { type: "mutation", name: "customerRequestDataErasure" },
1059
- requiredFlags: [flagId]
1568
+ requiredFlags: [flagId],
1569
+ examples: ["shop customers request-data-erasure --id 123"]
1060
1570
  },
1061
1571
  {
1062
1572
  verb: "cancel-data-erasure",
1063
1573
  description: "Cancel a pending customer data erasure request.",
1064
1574
  operation: { type: "mutation", name: "customerCancelDataErasure" },
1065
- requiredFlags: [flagId]
1575
+ requiredFlags: [flagId],
1576
+ examples: ["shop customers cancel-data-erasure --id 123"]
1066
1577
  },
1067
1578
  {
1068
1579
  verb: "metafields upsert",
@@ -1070,46 +1581,65 @@ const baseCommandRegistry = [
1070
1581
  operation: { type: "mutation", name: "metafieldsSet", inputArg: "metafields" },
1071
1582
  input: { mode: "set", arg: "metafields", required: true },
1072
1583
  requiredFlags: [flagId],
1073
- notes: ["Input can be a single object or { metafields: [...] }."]
1584
+ notes: ["Input can be a single object or { metafields: [...] }."],
1585
+ examples: [
1586
+ "shop customers metafields upsert --id 123 --set namespace=custom --set key=vip --set type=single_line_text_field --set value=yes",
1587
+ "shop customers metafields upsert --id 123 --input @metafields.json"
1588
+ ]
1074
1589
  },
1075
1590
  {
1076
1591
  verb: "add-tags",
1077
1592
  description: "Add tags to a customer.",
1078
1593
  operation: { type: "mutation", name: "tagsAdd" },
1079
- requiredFlags: [flagId, flagTags]
1594
+ requiredFlags: [flagId, flagTags],
1595
+ examples: ['shop customers add-tags --id 123 --tags "vip,wholesale"']
1080
1596
  },
1081
1597
  {
1082
1598
  verb: "remove-tags",
1083
1599
  description: "Remove tags from a customer.",
1084
1600
  operation: { type: "mutation", name: "tagsRemove" },
1085
- requiredFlags: [flagId, flagTags]
1601
+ requiredFlags: [flagId, flagTags],
1602
+ examples: ['shop customers remove-tags --id 123 --tags "vip,wholesale"']
1086
1603
  },
1087
1604
  {
1088
1605
  verb: "merge",
1089
1606
  description: "Merge two customers.",
1090
1607
  operation: { type: "mutation", name: "customerMerge" },
1091
1608
  requiredFlags: [flagId, flag("--other-id <gid>", "Other customer ID to merge into --id")],
1092
- flags: [flag("--override-fields <json>", "Override fields JSON (optional)")]
1609
+ flags: [flag("--override-fields <json>", "Override fields JSON (optional)")],
1610
+ examples: [
1611
+ "shop customers merge --id 123 --other-id 456",
1612
+ "shop customers merge --id 123 --other-id 456 --override-fields @override-fields.json"
1613
+ ]
1093
1614
  },
1094
1615
  {
1095
1616
  verb: "merge-preview",
1096
1617
  description: "Preview a customer merge request.",
1097
1618
  operation: { type: "query", name: "customerMergePreview" },
1098
1619
  requiredFlags: [flagId, flag("--other-id <gid>", "Other customer ID to merge into --id")],
1099
- flags: [flag("--override-fields <json>", "Override fields JSON (optional)")]
1620
+ flags: [flag("--override-fields <json>", "Override fields JSON (optional)")],
1621
+ examples: [
1622
+ "shop customers merge-preview --id 123 --other-id 456",
1623
+ "shop customers merge-preview --id 123 --other-id 456 --override-fields @override-fields.json"
1624
+ ]
1100
1625
  },
1101
1626
  {
1102
1627
  verb: "merge-job-status",
1103
1628
  description: "Fetch customer merge job status.",
1104
1629
  operation: { type: "query", name: "customerMergeJobStatus" },
1105
- requiredFlags: [flagJobId]
1630
+ requiredFlags: [flagJobId],
1631
+ examples: ["shop customers merge-job-status --job-id 123"]
1106
1632
  },
1107
1633
  {
1108
1634
  verb: "send-invite",
1109
1635
  description: "Send a customer account invite email.",
1110
1636
  operation: { type: "mutation", name: "customerSendAccountInviteEmail" },
1111
1637
  requiredFlags: [flagId],
1112
- flags: [flag("--email <json>", "Email input JSON (optional)")]
1638
+ flags: [flag("--email <json>", "Email input JSON (optional)")],
1639
+ examples: [
1640
+ "shop customers send-invite --id 123",
1641
+ "shop customers send-invite --id 123 --email @invite-email.json"
1642
+ ]
1113
1643
  }
1114
1644
  ]
1115
1645
  },
@@ -1264,27 +1794,65 @@ const baseCommandRegistry = [
1264
1794
  resource: "orders",
1265
1795
  description: "Manage orders.",
1266
1796
  verbs: [
1267
- createVerb({ operation: "orderCreate", description: "Create an order.", inputArg: "order" }),
1268
- getVerb({ operation: "order", description: "Fetch an order by ID." }),
1269
- listVerb({ operation: "orders", description: "List orders." }),
1797
+ createVerb({
1798
+ operation: "orderCreate",
1799
+ description: "Create an order.",
1800
+ inputArg: "order",
1801
+ examples: [
1802
+ "shop orders create --input @order.json"
1803
+ ]
1804
+ }),
1805
+ getVerb({
1806
+ operation: "order",
1807
+ description: "Fetch an order by ID.",
1808
+ examples: [
1809
+ "shop orders get --id 123",
1810
+ "shop orders get --id 123 --view full"
1811
+ ]
1812
+ }),
1813
+ listVerb({
1814
+ operation: "orders",
1815
+ description: "List orders.",
1816
+ examples: [
1817
+ "shop orders list --first 10 --format table",
1818
+ 'shop orders list --query "financial_status:paid"'
1819
+ ]
1820
+ }),
1270
1821
  countVerb({
1271
1822
  operation: "ordersCount",
1272
1823
  description: "Count orders.",
1273
- flags: [flagQuery, flagLimit]
1824
+ flags: [flagQuery, flagLimit],
1825
+ examples: [
1826
+ "shop orders count",
1827
+ 'shop orders count --query "status:open"'
1828
+ ]
1829
+ }),
1830
+ updateVerb({
1831
+ operation: "orderUpdate",
1832
+ description: "Update an order.",
1833
+ examples: [
1834
+ 'shop orders update --id 123 --set note="Internal note"',
1835
+ "shop orders update --id 123 --input @order-update.json"
1836
+ ]
1837
+ }),
1838
+ deleteVerb({
1839
+ operation: "orderDelete",
1840
+ description: "Delete an order.",
1841
+ examples: ["shop orders delete --id 123 --yes"]
1274
1842
  }),
1275
- updateVerb({ operation: "orderUpdate", description: "Update an order." }),
1276
- deleteVerb({ operation: "orderDelete", description: "Delete an order." }),
1277
1843
  {
1278
1844
  verb: "add-tags",
1279
1845
  description: "Add tags to an order.",
1280
1846
  operation: { type: "mutation", name: "tagsAdd" },
1281
- requiredFlags: [flagId, flagTags]
1847
+ requiredFlags: [flagId, flagTags],
1848
+ examples: ['shop orders add-tags --id 123 --tags "priority,wholesale"']
1282
1849
  },
1283
1850
  {
1284
1851
  verb: "remove-tags",
1285
1852
  description: "Remove tags from an order.",
1286
1853
  operation: { type: "mutation", name: "tagsRemove" },
1287
- requiredFlags: [flagId, flagTags]
1854
+ requiredFlags: [flagId, flagTags],
1855
+ examples: ['shop orders remove-tags --id 123 --tags "priority,wholesale"']
1288
1856
  },
1289
1857
  {
1290
1858
  verb: "cancel",
@@ -1298,25 +1866,35 @@ const baseCommandRegistry = [
1298
1866
  flagReason,
1299
1867
  flagNotifyCustomer,
1300
1868
  flagStaffNote
1869
+ ],
1870
+ examples: [
1871
+ "shop orders cancel --id 123",
1872
+ "shop orders cancel --id 123 --refund --notify-customer --reason CUSTOMER"
1301
1873
  ]
1302
1874
  },
1303
1875
  {
1304
1876
  verb: "close",
1305
1877
  description: "Close an order.",
1306
1878
  operation: { type: "mutation", name: "orderClose" },
1307
- requiredFlags: [flagId]
1879
+ requiredFlags: [flagId],
1880
+ examples: ["shop orders close --id 123"]
1308
1881
  },
1309
1882
  {
1310
1883
  verb: "mark-paid",
1311
1884
  description: "Mark an order as paid.",
1312
1885
  operation: { type: "mutation", name: "orderMarkAsPaid" },
1313
- requiredFlags: [flagId]
1886
+ requiredFlags: [flagId],
1887
+ examples: ["shop orders mark-paid --id 123"]
1314
1888
  },
1315
1889
  {
1316
1890
  verb: "add-note",
1317
1891
  description: "Add a note to an order.",
1318
1892
  operation: { type: "mutation", name: "orderUpdate" },
1319
- requiredFlags: [flagId, flag("--note <string|@file>", "Order note text")]
1893
+ requiredFlags: [flagId, flag("--note <string|@file>", "Order note text")],
1894
+ examples: [
1895
+ 'shop orders add-note --id 123 --note "Packed and shipped"',
1896
+ "shop orders add-note --id 123 --note @note.txt"
1897
+ ]
1320
1898
  },
1321
1899
  {
1322
1900
  verb: "fulfill",
@@ -1330,6 +1908,9 @@ const baseCommandRegistry = [
1330
1908
  flagTrackingNumber,
1331
1909
  flagTrackingUrl,
1332
1910
  flagNotifyCustomer
1911
+ ],
1912
+ examples: [
1913
+ "shop orders fulfill --id 123 --tracking-company UPS --tracking-number 1Z999AA10123456784 --notify-customer"
1333
1914
  ]
1334
1915
  },
1335
1916
  {
@@ -1341,13 +1922,18 @@ const baseCommandRegistry = [
1341
1922
  flagPaymentScheduleId,
1342
1923
  flag("--amount <json>", "MoneyInput JSON (optional)"),
1343
1924
  flagAutoCapture
1925
+ ],
1926
+ examples: [
1927
+ 'shop orders create-mandate-payment --id 123 --mandate-id gid://shopify/PaymentMandate/1 --idempotency-key "order-123-payment-1"',
1928
+ 'shop orders create-mandate-payment --id 123 --mandate-id gid://shopify/PaymentMandate/1 --idempotency-key "order-123-payment-1" --amount @money.json'
1344
1929
  ]
1345
1930
  },
1346
1931
  {
1347
1932
  verb: "transaction-void",
1348
1933
  description: "Void an uncaptured authorization transaction.",
1349
1934
  operation: { type: "mutation", name: "transactionVoid" },
1350
- requiredFlags: [flagParentTransactionId]
1935
+ requiredFlags: [flagParentTransactionId],
1936
+ examples: ["shop orders transaction-void --parent-transaction-id gid://shopify/OrderTransaction/1"]
1351
1937
  },
1352
1938
  {
1353
1939
  verb: "by-identifier",
@@ -1355,12 +1941,17 @@ const baseCommandRegistry = [
1355
1941
  operation: { type: "query", name: "orderByIdentifier" },
1356
1942
  flags: [flagId, flagCustomIdNamespace, flagCustomIdKey, flagCustomIdValue],
1357
1943
  notes: ["Provide either --id or --custom-id-key/--custom-id-value (optionally with --custom-id-namespace)."],
1358
- output: { view: true, selection: true }
1944
+ output: { view: true, selection: true },
1945
+ examples: [
1946
+ "shop orders by-identifier --id 123",
1947
+ "shop orders by-identifier --custom-id-namespace external --custom-id-key erp_id --custom-id-value 10001"
1948
+ ]
1359
1949
  },
1360
1950
  {
1361
1951
  verb: "pending-count",
1362
1952
  description: "Get the count of pending orders.",
1363
- operation: { type: "query", name: "pendingOrdersCount" }
1953
+ operation: { type: "query", name: "pendingOrdersCount" },
1954
+ examples: ["shop orders pending-count"]
1364
1955
  },
1365
1956
  {
1366
1957
  verb: "payment-status",
@@ -1368,14 +1959,21 @@ const baseCommandRegistry = [
1368
1959
  operation: { type: "query", name: "orderPaymentStatus" },
1369
1960
  requiredFlags: [flagPaymentReferenceId],
1370
1961
  flags: [flagId, flagOrderId],
1371
- notes: ["Use --order-id to specify the order; otherwise uses --id."]
1962
+ notes: ["Use --order-id to specify the order; otherwise uses --id."],
1963
+ examples: [
1964
+ 'shop orders payment-status --payment-reference-id "pi_123" --order-id 456'
1965
+ ]
1372
1966
  },
1373
1967
  {
1374
1968
  verb: "capture",
1375
1969
  description: "Capture an authorized payment for an order.",
1376
1970
  operation: { type: "mutation", name: "orderCapture" },
1377
1971
  requiredFlags: [flagId, flagParentTransactionId, flagAmount, flagCurrency],
1378
- flags: [flagFinalCapture]
1972
+ flags: [flagFinalCapture],
1973
+ examples: [
1974
+ "shop orders capture --id 123 --parent-transaction-id gid://shopify/OrderTransaction/1 --amount 10.00 --currency USD",
1975
+ "shop orders capture --id 123 --parent-transaction-id gid://shopify/OrderTransaction/1 --amount 10.00 --currency USD --final-capture true"
1976
+ ]
1379
1977
  },
1380
1978
  {
1381
1979
  verb: "create-manual-payment",
@@ -1383,38 +1981,51 @@ const baseCommandRegistry = [
1383
1981
  operation: { type: "mutation", name: "orderCreateManualPayment" },
1384
1982
  requiredFlags: [flagId],
1385
1983
  flags: [flagAmount, flagCurrency, flagPaymentMethodName, flagProcessedAt],
1386
- notes: ["If you pass --amount, you must also pass --currency."]
1984
+ notes: ["If you pass --amount, you must also pass --currency."],
1985
+ examples: [
1986
+ 'shop orders create-manual-payment --id 123 --amount 10.00 --currency USD --payment-method-name "Cash"'
1987
+ ]
1387
1988
  },
1388
1989
  {
1389
1990
  verb: "invoice-send",
1390
1991
  description: "Send an invoice for an order.",
1391
1992
  operation: { type: "mutation", name: "orderInvoiceSend" },
1392
1993
  requiredFlags: [flagId],
1393
- flags: [flag("--email <json|@file>", "Email input JSON (optional)")]
1994
+ flags: [flag("--email <json|@file>", "Email input JSON (optional)")],
1995
+ examples: [
1996
+ "shop orders invoice-send --id 123",
1997
+ "shop orders invoice-send --id 123 --email @invoice-email.json"
1998
+ ]
1394
1999
  },
1395
2000
  {
1396
2001
  verb: "open",
1397
2002
  description: "Open an order.",
1398
2003
  operation: { type: "mutation", name: "orderOpen" },
1399
- requiredFlags: [flagId]
2004
+ requiredFlags: [flagId],
2005
+ examples: ["shop orders open --id 123"]
1400
2006
  },
1401
2007
  {
1402
2008
  verb: "customer-set",
1403
2009
  description: "Set a customer on an order.",
1404
2010
  operation: { type: "mutation", name: "orderCustomerSet" },
1405
- requiredFlags: [flagId, flagCustomerId]
2011
+ requiredFlags: [flagId, flagCustomerId],
2012
+ examples: ["shop orders customer-set --id 123 --customer-id 456"]
1406
2013
  },
1407
2014
  {
1408
2015
  verb: "customer-remove",
1409
2016
  description: "Remove the customer from an order.",
1410
2017
  operation: { type: "mutation", name: "orderCustomerRemove" },
1411
- requiredFlags: [flagId]
2018
+ requiredFlags: [flagId],
2019
+ examples: ["shop orders customer-remove --id 123"]
1412
2020
  },
1413
2021
  {
1414
2022
  verb: "risk-assessment-create",
1415
2023
  description: "Create a risk assessment for an order.",
1416
2024
  operation: { type: "mutation", name: "orderRiskAssessmentCreate" },
1417
- requiredFlags: [flagId, flagRiskLevel, flagFacts]
2025
+ requiredFlags: [flagId, flagRiskLevel, flagFacts],
2026
+ examples: [
2027
+ "shop orders risk-assessment-create --id 123 --risk-level HIGH --facts @facts.json"
2028
+ ]
1418
2029
  }
1419
2030
  ]
1420
2031
  },
@@ -2097,26 +2708,58 @@ const baseCommandRegistry = [
2097
2708
  verb: "get",
2098
2709
  description: "Fetch a file by ID.",
2099
2710
  operation: { type: "query", name: "files" },
2100
- requiredFlags: [flagId]
2711
+ requiredFlags: [flagId],
2712
+ examples: [
2713
+ "shop files get --id 123",
2714
+ "shop files get --id gid://shopify/File/123 --view full"
2715
+ ]
2101
2716
  },
2102
2717
  {
2103
2718
  verb: "list",
2104
2719
  description: "List files.",
2105
2720
  operation: { type: "query", name: "files" },
2106
- output: { pagination: true }
2721
+ output: { pagination: true },
2722
+ examples: [
2723
+ "shop files list --first 10 --format table",
2724
+ 'shop files list --query "file_status:ready"'
2725
+ ]
2107
2726
  },
2108
2727
  {
2109
2728
  verb: "upload",
2110
- description: "Upload local files to Shopify.",
2729
+ description: "Upload local files or URLs to Shopify.",
2111
2730
  operation: { type: "mutation", name: "fileCreate" },
2112
- requiredFlags: [flagFile],
2113
- flags: [flagAlt, flagContentType]
2731
+ requiredFlags: [],
2732
+ flags: [
2733
+ flagFile,
2734
+ flagUrl,
2735
+ flagFilesUploadFilename,
2736
+ flagAlt,
2737
+ flagFilesUploadMimeType,
2738
+ flagFilesUploadMediaType,
2739
+ flagFilesUploadWait,
2740
+ flagPollIntervalMs,
2741
+ flagTimeoutMs
2742
+ ],
2743
+ notes: [
2744
+ "Provide one or more --file or --url (but not both).",
2745
+ "Use --file - to read from stdin; requires --filename.",
2746
+ "Aliases: --resource and --content-type are accepted as --media-type."
2747
+ ],
2748
+ examples: [
2749
+ "shop files upload --file ./cat.png",
2750
+ "shop files upload --url https://example.com/cat.png --wait",
2751
+ "shop files upload --url https://example.com/cat.png --filename kitten.png --mime-type image/png",
2752
+ "cat ./cat.png | shop files upload --file - --filename cat.png --mime-type image/png"
2753
+ ]
2114
2754
  },
2115
2755
  {
2116
2756
  verb: "update",
2117
2757
  description: "Update a file (alt text).",
2118
2758
  operation: { type: "mutation", name: "fileUpdate" },
2119
- requiredFlags: [flagId, flagAlt]
2759
+ requiredFlags: [flagId, flagAlt],
2760
+ examples: [
2761
+ 'shop files update --id 123 --alt "Hero image"'
2762
+ ]
2120
2763
  },
2121
2764
  {
2122
2765
  verb: "acknowledge-update-failed",
@@ -2124,7 +2767,11 @@ const baseCommandRegistry = [
2124
2767
  operation: { type: "mutation", name: "fileAcknowledgeUpdateFailed" },
2125
2768
  requiredFlags: [flagId],
2126
2769
  flags: [flagId, flagIds],
2127
- notes: ["Provide --id or --ids."]
2770
+ notes: ["Provide --id or --ids."],
2771
+ examples: [
2772
+ "shop files acknowledge-update-failed --id 123",
2773
+ "shop files acknowledge-update-failed --ids 123,456"
2774
+ ]
2128
2775
  },
2129
2776
  {
2130
2777
  verb: "delete",
@@ -2132,7 +2779,11 @@ const baseCommandRegistry = [
2132
2779
  operation: { type: "mutation", name: "fileDelete" },
2133
2780
  requiredFlags: [flagYes],
2134
2781
  flags: [flagId, flagIds],
2135
- notes: ["Provide --id or --ids."]
2782
+ notes: ["Provide --id or --ids."],
2783
+ examples: [
2784
+ "shop files delete --id 123 --yes",
2785
+ "shop files delete --ids 123,456 --yes"
2786
+ ]
2136
2787
  }
2137
2788
  ]
2138
2789
  },
@@ -2173,95 +2824,227 @@ const baseCommandRegistry = [
2173
2824
  verb: "authors",
2174
2825
  description: "List article authors.",
2175
2826
  operation: { type: "query", name: "articleAuthors" },
2176
- output: { pagination: true }
2827
+ output: { pagination: true },
2828
+ examples: [
2829
+ "shop articles authors --first 25 --format table"
2830
+ ]
2177
2831
  },
2178
2832
  {
2179
2833
  verb: "tags",
2180
2834
  description: "List article tags.",
2181
2835
  operation: { type: "query", name: "articleTags" },
2182
2836
  requiredFlags: [flagLimit],
2183
- flags: [flagSort, flagLimit]
2837
+ flags: [flagSort, flagLimit],
2838
+ examples: [
2839
+ "shop articles tags --limit 50",
2840
+ "shop articles tags --limit 100 --sort ALPHABETICAL"
2841
+ ]
2184
2842
  },
2185
- createVerb({ operation: "articleCreate", description: "Create an article." }),
2186
- getVerb({ operation: "article", description: "Fetch an article by ID." }),
2187
- listVerb({ operation: "articles", description: "List articles." }),
2188
- updateVerb({ operation: "articleUpdate", description: "Update an article." }),
2843
+ createVerb({
2844
+ operation: "articleCreate",
2845
+ description: "Create an article.",
2846
+ examples: [
2847
+ 'shop articles create --set title="Hello world" --set author.name="Shop Admin"',
2848
+ "shop articles create --input @article.json"
2849
+ ]
2850
+ }),
2851
+ getVerb({
2852
+ operation: "article",
2853
+ description: "Fetch an article by ID.",
2854
+ examples: [
2855
+ "shop articles get --id 123",
2856
+ "shop articles get --id 123 --view full"
2857
+ ]
2858
+ }),
2859
+ listVerb({
2860
+ operation: "articles",
2861
+ description: "List articles.",
2862
+ examples: [
2863
+ "shop articles list --first 10 --format table",
2864
+ 'shop articles list --query "published_status:published"'
2865
+ ]
2866
+ }),
2867
+ updateVerb({
2868
+ operation: "articleUpdate",
2869
+ description: "Update an article.",
2870
+ examples: [
2871
+ 'shop articles update --id 123 --set title="Updated title"',
2872
+ "shop articles update --id 123 --input @article-update.json"
2873
+ ]
2874
+ }),
2189
2875
  {
2190
2876
  verb: "publish",
2191
2877
  description: "Publish an article.",
2192
2878
  operation: { type: "mutation", name: "articleUpdate" },
2193
2879
  requiredFlags: [flagId],
2194
- flags: [flagAt, flagNow]
2880
+ flags: [flagAt, flagNow],
2881
+ examples: [
2882
+ "shop articles publish --id 123 --now",
2883
+ "shop articles publish --id 123 --at 2026-01-15T12:00:00Z"
2884
+ ]
2195
2885
  },
2196
2886
  {
2197
2887
  verb: "unpublish",
2198
2888
  description: "Unpublish an article.",
2199
2889
  operation: { type: "mutation", name: "articleUpdate" },
2200
- requiredFlags: [flagId]
2890
+ requiredFlags: [flagId],
2891
+ examples: [
2892
+ "shop articles unpublish --id 123"
2893
+ ]
2201
2894
  },
2202
- deleteVerb({ operation: "articleDelete", description: "Delete an article." })
2895
+ deleteVerb({
2896
+ operation: "articleDelete",
2897
+ description: "Delete an article.",
2898
+ examples: ["shop articles delete --id 123 --yes"]
2899
+ })
2203
2900
  ]
2204
2901
  },
2205
2902
  {
2206
2903
  resource: "blogs",
2207
2904
  description: "Manage blogs.",
2208
2905
  verbs: [
2209
- createVerb({ operation: "blogCreate", description: "Create a blog." }),
2210
- getVerb({ operation: "blog", description: "Fetch a blog by ID." }),
2211
- listVerb({ operation: "blogs", description: "List blogs." }),
2906
+ createVerb({
2907
+ operation: "blogCreate",
2908
+ description: "Create a blog.",
2909
+ examples: [
2910
+ 'shop blogs create --set title="News"',
2911
+ "shop blogs create --input @blog.json"
2912
+ ]
2913
+ }),
2914
+ getVerb({
2915
+ operation: "blog",
2916
+ description: "Fetch a blog by ID.",
2917
+ examples: [
2918
+ "shop blogs get --id 123",
2919
+ "shop blogs get --id 123 --view full"
2920
+ ]
2921
+ }),
2922
+ listVerb({
2923
+ operation: "blogs",
2924
+ description: "List blogs.",
2925
+ examples: [
2926
+ "shop blogs list --format table",
2927
+ "shop blogs list --first 25"
2928
+ ]
2929
+ }),
2212
2930
  {
2213
2931
  verb: "count",
2214
2932
  description: "Count blogs.",
2215
2933
  operation: { type: "query", name: "blogsCount" },
2216
- flags: [flagQuery, flagLimit]
2934
+ flags: [flagQuery, flagLimit],
2935
+ examples: [
2936
+ "shop blogs count",
2937
+ 'shop blogs count --query "title:News"'
2938
+ ]
2217
2939
  },
2218
- updateVerb({ operation: "blogUpdate", description: "Update a blog." }),
2940
+ updateVerb({
2941
+ operation: "blogUpdate",
2942
+ description: "Update a blog.",
2943
+ examples: [
2944
+ 'shop blogs update --id 123 --set title="Updated blog title"',
2945
+ "shop blogs update --id 123 --input @blog-update.json"
2946
+ ]
2947
+ }),
2219
2948
  {
2220
2949
  verb: "publish",
2221
2950
  description: "Publish all articles in a blog.",
2222
2951
  operation: { type: "mutation", name: "articleUpdate" },
2223
2952
  requiredFlags: [flagId],
2224
2953
  flags: [flagAt, flagNow],
2225
- notes: ["Not supported in --dry-run mode (requires pagination)."]
2954
+ notes: ["Not supported in --dry-run mode (requires pagination)."],
2955
+ examples: [
2956
+ "shop blogs publish --id 123 --now",
2957
+ "shop blogs publish --id 123 --at 2026-01-15T12:00:00Z"
2958
+ ]
2226
2959
  },
2227
2960
  {
2228
2961
  verb: "unpublish",
2229
2962
  description: "Unpublish all articles in a blog.",
2230
2963
  operation: { type: "mutation", name: "articleUpdate" },
2231
2964
  requiredFlags: [flagId],
2232
- notes: ["Not supported in --dry-run mode (requires pagination)."]
2965
+ notes: ["Not supported in --dry-run mode (requires pagination)."],
2966
+ examples: [
2967
+ "shop blogs unpublish --id 123"
2968
+ ]
2233
2969
  },
2234
- deleteVerb({ operation: "blogDelete", description: "Delete a blog." })
2970
+ deleteVerb({
2971
+ operation: "blogDelete",
2972
+ description: "Delete a blog.",
2973
+ examples: ["shop blogs delete --id 123 --yes"]
2974
+ })
2235
2975
  ]
2236
2976
  },
2237
2977
  {
2238
2978
  resource: "pages",
2239
2979
  description: "Manage pages.",
2240
2980
  verbs: [
2241
- createVerb({ operation: "pageCreate", description: "Create a page." }),
2242
- getVerb({ operation: "page", description: "Fetch a page by ID." }),
2243
- listVerb({ operation: "pages", description: "List pages." }),
2981
+ createVerb({
2982
+ operation: "pageCreate",
2983
+ description: "Create a page.",
2984
+ examples: [
2985
+ 'shop pages create --set title="About us" --set body="<p>Welcome!</p>"',
2986
+ "shop pages create --input @page.json"
2987
+ ]
2988
+ }),
2989
+ getVerb({
2990
+ operation: "page",
2991
+ description: "Fetch a page by ID.",
2992
+ examples: [
2993
+ "shop pages get --id 123",
2994
+ "shop pages get --id 123 --view full"
2995
+ ]
2996
+ }),
2997
+ listVerb({
2998
+ operation: "pages",
2999
+ description: "List pages.",
3000
+ examples: [
3001
+ "shop pages list --first 10 --format table",
3002
+ 'shop pages list --query "title:About"'
3003
+ ]
3004
+ }),
2244
3005
  {
2245
3006
  verb: "count",
2246
3007
  description: "Count pages.",
2247
3008
  operation: { type: "query", name: "pagesCount" },
2248
- flags: [flagLimit]
3009
+ flags: [flagLimit],
3010
+ examples: [
3011
+ "shop pages count",
3012
+ "shop pages count --limit 1000"
3013
+ ]
2249
3014
  },
2250
- updateVerb({ operation: "pageUpdate", description: "Update a page." }),
3015
+ updateVerb({
3016
+ operation: "pageUpdate",
3017
+ description: "Update a page.",
3018
+ examples: [
3019
+ 'shop pages update --id 123 --set title="Updated page title"',
3020
+ "shop pages update --id 123 --input @page-update.json"
3021
+ ]
3022
+ }),
2251
3023
  {
2252
3024
  verb: "publish",
2253
3025
  description: "Publish a page.",
2254
3026
  operation: { type: "mutation", name: "pageUpdate" },
2255
3027
  requiredFlags: [flagId],
2256
- flags: [flagAt, flagNow]
3028
+ flags: [flagAt, flagNow],
3029
+ examples: [
3030
+ "shop pages publish --id 123 --now",
3031
+ "shop pages publish --id 123 --at 2026-01-15T12:00:00Z"
3032
+ ]
2257
3033
  },
2258
3034
  {
2259
3035
  verb: "unpublish",
2260
3036
  description: "Unpublish a page.",
2261
3037
  operation: { type: "mutation", name: "pageUpdate" },
2262
- requiredFlags: [flagId]
3038
+ requiredFlags: [flagId],
3039
+ examples: [
3040
+ "shop pages unpublish --id 123"
3041
+ ]
2263
3042
  },
2264
- deleteVerb({ operation: "pageDelete", description: "Delete a page." })
3043
+ deleteVerb({
3044
+ operation: "pageDelete",
3045
+ description: "Delete a page.",
3046
+ examples: ["shop pages delete --id 123 --yes"]
3047
+ })
2265
3048
  ]
2266
3049
  },
2267
3050
  {
@@ -2811,7 +3594,12 @@ const baseCommandRegistry = [
2811
3594
  verb: "create",
2812
3595
  description: "Create a subscription contract draft.",
2813
3596
  operation: "subscriptionContractCreate",
2814
- flags: [flagCustomerId]
3597
+ flags: [flagCustomerId],
3598
+ notes: [
3599
+ "Returns a SubscriptionDraft (not a live contract).",
3600
+ "Commit the draft with `shop subscription-drafts commit --id <draftId>` to apply changes.",
3601
+ "If you want to create a live contract immediately, use `shop subscription-contracts atomic-create`."
3602
+ ]
2815
3603
  }),
2816
3604
  inputVerb({
2817
3605
  verb: "atomic-create",
@@ -2824,7 +3612,11 @@ const baseCommandRegistry = [
2824
3612
  operation: "subscriptionContractUpdate",
2825
3613
  requiredFlags: [flagId],
2826
3614
  inputRequired: false,
2827
- notes: ["If no input is provided, returns a draft ID."]
3615
+ notes: [
3616
+ "Returns a SubscriptionDraft (not the live contract).",
3617
+ "Changes remain in draft state until you commit with `shop subscription-drafts commit --id <draftId>`.",
3618
+ "If no input is provided, returns a draft ID."
3619
+ ]
2828
3620
  }),
2829
3621
  {
2830
3622
  verb: "activate",
@@ -5636,7 +6428,7 @@ const baseCommandRegistry = [
5636
6428
  const commandRegistry = baseCommandRegistry.map((spec) => {
5637
6429
  if (!resourcesWithFields.has(spec.resource)) return spec;
5638
6430
  if (spec.verbs.some((v) => v.verb === fieldsVerb.verb)) return spec;
5639
- return { ...spec, verbs: [...spec.verbs, fieldsVerb] };
6431
+ return { ...spec, verbs: [...spec.verbs, { ...fieldsVerb, examples: [`shop ${spec.resource} fields`] }] };
5640
6432
  });
5641
6433
  const commonOutputFlags = [flagFormat, flagView, flagSelect, flagInclude, flagSelection, flagQuiet];
5642
6434
  const paginationFlags = [flagFirst, flagAfter, flagQuery, flagSort, flagReverse];