@salesforce/plugin-devops-center 1.4.1 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +150 -31
  2. package/lib/commands/devops/pipeline/stage/update.d.ts +19 -0
  3. package/lib/commands/devops/pipeline/stage/update.js +66 -0
  4. package/lib/commands/devops/pipeline/stage/update.js.map +1 -0
  5. package/lib/commands/devops/promote.d.ts +5 -0
  6. package/lib/commands/devops/promote.js +49 -3
  7. package/lib/commands/devops/promote.js.map +1 -1
  8. package/lib/commands/devops/promotion/complete.d.ts +1 -1
  9. package/lib/commands/devops/promotion/complete.js +1 -1
  10. package/lib/commands/devops/promotion/complete.js.map +1 -1
  11. package/lib/commands/devops/promotion/validate.d.ts +21 -0
  12. package/lib/commands/devops/promotion/validate.js +137 -0
  13. package/lib/commands/devops/promotion/validate.js.map +1 -0
  14. package/lib/commands/devops/stage/branch/delete.d.ts +15 -0
  15. package/lib/commands/devops/stage/branch/delete.js +107 -0
  16. package/lib/commands/devops/stage/branch/delete.js.map +1 -0
  17. package/lib/commands/devops/work-item/prepare.js +0 -3
  18. package/lib/commands/devops/work-item/prepare.js.map +1 -1
  19. package/lib/utils/addPipelineStage.js +1 -0
  20. package/lib/utils/addPipelineStage.js.map +1 -1
  21. package/lib/utils/createPipeline.js +24 -12
  22. package/lib/utils/createPipeline.js.map +1 -1
  23. package/lib/utils/deleteStageBranch.d.ts +22 -0
  24. package/lib/utils/deleteStageBranch.js +44 -0
  25. package/lib/utils/deleteStageBranch.js.map +1 -0
  26. package/lib/utils/pipelineUtils.d.ts +9 -0
  27. package/lib/utils/pipelineUtils.js +32 -0
  28. package/lib/utils/pipelineUtils.js.map +1 -1
  29. package/lib/utils/prepareWorkItem.d.ts +1 -1
  30. package/lib/utils/prepareWorkItem.js +4 -5
  31. package/lib/utils/prepareWorkItem.js.map +1 -1
  32. package/lib/utils/{deployStage.d.ts → promotionUtils.d.ts} +24 -0
  33. package/lib/utils/{deployStage.js → promotionUtils.js} +65 -1
  34. package/lib/utils/promotionUtils.js.map +1 -0
  35. package/lib/utils/soqlUtils.d.ts +5 -0
  36. package/lib/utils/soqlUtils.js +7 -0
  37. package/lib/utils/soqlUtils.js.map +1 -1
  38. package/messages/devops.pipeline.stage.update.md +25 -0
  39. package/messages/devops.promote.md +16 -0
  40. package/messages/devops.promotion.complete.md +3 -3
  41. package/messages/devops.promotion.validate.md +64 -0
  42. package/messages/devops.stage.branch.delete.md +37 -0
  43. package/npm-shrinkwrap.json +263 -108
  44. package/oclif.lock +80 -23
  45. package/oclif.manifest.json +398 -160
  46. package/package.json +7 -7
  47. package/schemas/devops-pipeline-stage-update.json +22 -0
  48. package/schemas/devops-promote.json +38 -0
  49. package/schemas/devops-promotion-validate.json +66 -0
  50. package/schemas/devops-stage-branch-delete.json +47 -0
  51. package/lib/utils/deployStage.js.map +0 -1
package/README.md CHANGED
@@ -63,15 +63,18 @@ sf plugins
63
63
  - [`sf devops pipeline project delete`](#sf-devops-pipeline-project-delete)
64
64
  - [`sf devops pipeline stage add`](#sf-devops-pipeline-stage-add)
65
65
  - [`sf devops pipeline stage delete`](#sf-devops-pipeline-stage-delete)
66
+ - [`sf devops pipeline stage update`](#sf-devops-pipeline-stage-update)
66
67
  - [`sf devops pipeline update`](#sf-devops-pipeline-update)
67
68
  - [`sf devops project create`](#sf-devops-project-create)
68
69
  - [`sf devops project list`](#sf-devops-project-list)
69
70
  - [`sf devops project update`](#sf-devops-project-update)
70
71
  - [`sf devops promote`](#sf-devops-promote)
71
72
  - [`sf devops promotion complete`](#sf-devops-promotion-complete)
73
+ - [`sf devops promotion validate`](#sf-devops-promotion-validate)
72
74
  - [`sf devops request status`](#sf-devops-request-status)
73
75
  - [`sf devops review create`](#sf-devops-review-create)
74
76
  - [`sf devops stage branch add`](#sf-devops-stage-branch-add)
77
+ - [`sf devops stage branch delete`](#sf-devops-stage-branch-delete)
75
78
  - [`sf devops stage environment add`](#sf-devops-stage-environment-add)
76
79
  - [`sf devops stage environment delete`](#sf-devops-stage-environment-delete)
77
80
  - [`sf devops work-item combine`](#sf-devops-work-item-combine)
@@ -145,7 +148,7 @@ EXAMPLES
145
148
  https://bitbucket.org/myworkspace/myrepo --description "Main CI/CD pipeline for production releases"
146
149
  ```
147
150
 
148
- _See code: [src/commands/devops/pipeline/create.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/pipeline/create.ts)_
151
+ _See code: [src/commands/devops/pipeline/create.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/create.ts)_
149
152
 
150
153
  ## `sf devops pipeline get`
151
154
 
@@ -177,7 +180,7 @@ EXAMPLES
177
180
  $ sf devops pipeline get --target-org my-devops-org --pipeline-id 0Do000000000001
178
181
  ```
179
182
 
180
- _See code: [src/commands/devops/pipeline/get.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/pipeline/get.ts)_
183
+ _See code: [src/commands/devops/pipeline/get.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/get.ts)_
181
184
 
182
185
  ## `sf devops pipeline list`
183
186
 
@@ -208,7 +211,7 @@ EXAMPLES
208
211
  $ sf devops pipeline list --target-org my-devops-org
209
212
  ```
210
213
 
211
- _See code: [src/commands/devops/pipeline/list.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/pipeline/list.ts)_
214
+ _See code: [src/commands/devops/pipeline/list.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/list.ts)_
212
215
 
213
216
  ## `sf devops pipeline project add`
214
217
 
@@ -242,7 +245,7 @@ EXAMPLES
242
245
  0Hn000000000001
243
246
  ```
244
247
 
245
- _See code: [src/commands/devops/pipeline/project/add.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/pipeline/project/add.ts)_
248
+ _See code: [src/commands/devops/pipeline/project/add.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/project/add.ts)_
246
249
 
247
250
  ## `sf devops pipeline project delete`
248
251
 
@@ -276,7 +279,7 @@ EXAMPLES
276
279
  0Hn000000000001
277
280
  ```
278
281
 
279
- _See code: [src/commands/devops/pipeline/project/delete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/pipeline/project/delete.ts)_
282
+ _See code: [src/commands/devops/pipeline/project/delete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/project/delete.ts)_
280
283
 
281
284
  ## `sf devops pipeline stage add`
282
285
 
@@ -317,7 +320,7 @@ EXAMPLES
317
320
  --next-stage-id 0Xc000000000003
318
321
  ```
319
322
 
320
- _See code: [src/commands/devops/pipeline/stage/add.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/pipeline/stage/add.ts)_
323
+ _See code: [src/commands/devops/pipeline/stage/add.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/stage/add.ts)_
321
324
 
322
325
  ## `sf devops pipeline stage delete`
323
326
 
@@ -352,7 +355,40 @@ EXAMPLES
352
355
  0Xc000000000002
353
356
  ```
354
357
 
355
- _See code: [src/commands/devops/pipeline/stage/delete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/pipeline/stage/delete.ts)_
358
+ _See code: [src/commands/devops/pipeline/stage/delete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/stage/delete.ts)_
359
+
360
+ ## `sf devops pipeline stage update`
361
+
362
+ Update a DevOps Center pipeline stage.
363
+
364
+ ```
365
+ USAGE
366
+ $ sf devops pipeline stage update -o <value> -s <value> -n <value> [--json] [--flags-dir <value>] [--api-version
367
+ <value>]
368
+
369
+ FLAGS
370
+ -n, --name=<value> (required) New name for the pipeline stage.
371
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
372
+ configuration variable is already set.
373
+ -s, --stage-id=<value> (required) ID of the pipeline stage to update.
374
+ --api-version=<value> Override the api version used for api requests made by this command
375
+
376
+ GLOBAL FLAGS
377
+ --flags-dir=<value> Import flag values from a directory.
378
+ --json Format output as json.
379
+
380
+ DESCRIPTION
381
+ Update a DevOps Center pipeline stage.
382
+
383
+ Updates the name of a pipeline stage.
384
+
385
+ EXAMPLES
386
+ Rename a pipeline stage.
387
+
388
+ $ sf devops pipeline stage update --target-org my-devops-org --stage-id 1QV000000000001 --name "Integration"
389
+ ```
390
+
391
+ _See code: [src/commands/devops/pipeline/stage/update.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/stage/update.ts)_
356
392
 
357
393
  ## `sf devops pipeline update`
358
394
 
@@ -395,7 +431,7 @@ EXAMPLES
395
431
  Pipeline"
396
432
  ```
397
433
 
398
- _See code: [src/commands/devops/pipeline/update.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/pipeline/update.ts)_
434
+ _See code: [src/commands/devops/pipeline/update.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/pipeline/update.ts)_
399
435
 
400
436
  ## `sf devops project create`
401
437
 
@@ -432,7 +468,7 @@ EXAMPLES
432
468
  update"
433
469
  ```
434
470
 
435
- _See code: [src/commands/devops/project/create.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/project/create.ts)_
471
+ _See code: [src/commands/devops/project/create.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/project/create.ts)_
436
472
 
437
473
  ## `sf devops project list`
438
474
 
@@ -467,7 +503,7 @@ EXAMPLES
467
503
  $ sf devops project list --target-org devops-center@example.com
468
504
  ```
469
505
 
470
- _See code: [src/commands/devops/project/list.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/project/list.ts)_
506
+ _See code: [src/commands/devops/project/list.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/project/list.ts)_
471
507
 
472
508
  ## `sf devops project update`
473
509
 
@@ -517,7 +553,7 @@ EXAMPLES
517
553
  --description "Archived" --no-is-active
518
554
  ```
519
555
 
520
- _See code: [src/commands/devops/project/update.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/project/update.ts)_
556
+ _See code: [src/commands/devops/project/update.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/project/update.ts)_
521
557
 
522
558
  ## `sf devops promote`
523
559
 
@@ -527,6 +563,7 @@ Promote work items or a pipeline stage to a target pipeline stage.
527
563
  USAGE
528
564
  $ sf devops promote -o <value> -t <value> [--json] [--flags-dir <value>] [--api-version <value>] [-i <value>... |
529
565
  -s <value>] [-a] [-l NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg] [--tests <value>...]
566
+ [--skip-validation]
530
567
 
531
568
  FLAGS
532
569
  -a, --deploy-all Deploy all metadata in the branch to the stage's org.
@@ -539,6 +576,9 @@ FLAGS
539
576
  exclusive with --work-item-id.
540
577
  -t, --target-stage-id=<value> (required) ID of the pipeline stage to promote to.
541
578
  --api-version=<value> Override the api version used for api requests made by this command
579
+ --skip-validation Skip pre-promote validation. By default, promotion is validated before proceeding to
580
+ prevent promoting work items without an associated PR. Use this flag to bypass
581
+ validation.
542
582
  --tests=<value>... Apex tests to run when --test-level is RunSpecifiedTests.
543
583
 
544
584
  GLOBAL FLAGS
@@ -613,7 +653,7 @@ FLAG DESCRIPTIONS
613
653
  spaces.
614
654
  ```
615
655
 
616
- _See code: [src/commands/devops/promote.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/promote.ts)_
656
+ _See code: [src/commands/devops/promote.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/promote.ts)_
617
657
 
618
658
  ## `sf devops promotion complete`
619
659
 
@@ -650,16 +690,16 @@ DESCRIPTION
650
690
  If no undeployed work items are found for the stage, the command exits successfully with no action taken.
651
691
 
652
692
  EXAMPLES
653
- Complete a promotion for an out-of-sync pipeline stage.
693
+ Complete a promotion for an out-of-sync pipeline stage:
654
694
 
655
695
  $ sf devops promotion complete --target-org my-devops-org --target-stage-id 1QV000000000001
656
696
 
657
- Complete a promotion for a specific work item (e.g. first stage of a pipeline).
697
+ Complete a promotion for a specific work item (e.g. first stage of a pipeline):
658
698
 
659
699
  $ sf devops promotion complete --target-org my-devops-org --target-stage-id 1QV000000000001 --work-item-id \
660
700
  1fk000000000001
661
701
 
662
- Complete a promotion with full deploy and a specific test level.
702
+ Complete a promotion with full deploy and a specific test level:
663
703
 
664
704
  $ sf devops promotion complete --target-org my-devops-org --target-stage-id 1QV000000000001 --deploy-all \
665
705
  --test-level RunLocalTests
@@ -696,7 +736,48 @@ FLAG DESCRIPTIONS
696
736
  spaces.
697
737
  ```
698
738
 
699
- _See code: [src/commands/devops/promotion/complete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/promotion/complete.ts)_
739
+ _See code: [src/commands/devops/promotion/complete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/promotion/complete.ts)_
740
+
741
+ ## `sf devops promotion validate`
742
+
743
+ Validate work item promotion for a pipeline stage.
744
+
745
+ ```
746
+ USAGE
747
+ $ sf devops promotion validate -o <value> -t <value> -i <value>... [--json] [--flags-dir <value>] [--api-version
748
+ <value>]
749
+
750
+ FLAGS
751
+ -i, --work-item-id=<value>... (required) ID of a work item to validate for promotion. Specify multiple times for
752
+ multiple work items.
753
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
754
+ configuration variable is already set.
755
+ -t, --target-stage-id=<value> (required) ID of the target pipeline stage to validate promotion to.
756
+ --api-version=<value> Override the api version used for api requests made by this command
757
+
758
+ GLOBAL FLAGS
759
+ --flags-dir=<value> Import flag values from a directory.
760
+ --json Format output as json.
761
+
762
+ DESCRIPTION
763
+ Validate work item promotion for a pipeline stage.
764
+
765
+ Validates whether the specified work items can be promoted to the target pipeline stage. Checks for VCS and object
766
+ permission errors before a promotion is attempted.
767
+
768
+ EXAMPLES
769
+ Validate promotion of a work item to a target stage:
770
+
771
+ $ sf devops promotion validate --target-org my-devops-org --target-stage-id 1QV000000000001 --work-item-id \
772
+ 1fk000000000001
773
+
774
+ Validate promotion of multiple work items:
775
+
776
+ $ sf devops promotion validate --target-org my-devops-org --target-stage-id 1QV000000000001 --work-item-id \
777
+ 1fk000000000001 --work-item-id 1fk000000000002
778
+ ```
779
+
780
+ _See code: [src/commands/devops/promotion/validate.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/promotion/validate.ts)_
700
781
 
701
782
  ## `sf devops request status`
702
783
 
@@ -727,7 +808,7 @@ EXAMPLES
727
808
  $ sf devops request status --target-org my-devops-org --request-token a0B000000000001
728
809
  ```
729
810
 
730
- _See code: [src/commands/devops/request/status.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/request/status.ts)_
811
+ _See code: [src/commands/devops/request/status.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/request/status.ts)_
731
812
 
732
813
  ## `sf devops review create`
733
814
 
@@ -764,7 +845,7 @@ EXAMPLES
764
845
  $ sf devops review create --target-org my-devops-org --work-item-id 0Wx000000000001
765
846
  ```
766
847
 
767
- _See code: [src/commands/devops/review/create.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/review/create.ts)_
848
+ _See code: [src/commands/devops/review/create.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/review/create.ts)_
768
849
 
769
850
  ## `sf devops stage branch add`
770
851
 
@@ -807,7 +888,45 @@ EXAMPLES
807
888
  --branch-name integration --create-vcs-branch
808
889
  ```
809
890
 
810
- _See code: [src/commands/devops/stage/branch/add.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/stage/branch/add.ts)_
891
+ _See code: [src/commands/devops/stage/branch/add.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/stage/branch/add.ts)_
892
+
893
+ ## `sf devops stage branch delete`
894
+
895
+ Delete the source code repository branch associated with a pipeline stage.
896
+
897
+ ```
898
+ USAGE
899
+ $ sf devops stage branch delete -o <value> --pipeline-id <value> --stage-id <value> [--json] [--flags-dir <value>]
900
+ [--api-version <value>]
901
+
902
+ FLAGS
903
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
904
+ configuration variable is already set.
905
+ --api-version=<value> Override the api version used for api requests made by this command
906
+ --pipeline-id=<value> (required) ID of the pipeline that contains the stage. Used to verify the pipeline is
907
+ inactive before deleting.
908
+ --stage-id=<value> (required) ID of the pipeline stage whose branch you want to delete.
909
+
910
+ GLOBAL FLAGS
911
+ --flags-dir=<value> Import flag values from a directory.
912
+ --json Format output as json.
913
+
914
+ DESCRIPTION
915
+ Delete the source code repository branch associated with a pipeline stage.
916
+
917
+ Removes the branch linked to the specified pipeline stage. Because branches are configured from right to left (a stage
918
+ can have a branch only after the stage to its right does), removing a branch also removes the branches from all
919
+ upstream stages (to the left) in the pipeline, keeping it in a valid state. The branch records in the repository are
920
+ not deleted; only their association with the stages is removed. The stage must belong to an inactive pipeline.
921
+
922
+ EXAMPLES
923
+ Delete the branch associated with a pipeline stage:
924
+
925
+ $ sf devops stage branch delete --target-org my-devops-org --pipeline-id 0Xo000000000001 --stage-id \
926
+ 0Xp000000000001
927
+ ```
928
+
929
+ _See code: [src/commands/devops/stage/branch/delete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/stage/branch/delete.ts)_
811
930
 
812
931
  ## `sf devops stage environment add`
813
932
 
@@ -847,7 +966,7 @@ EXAMPLES
847
966
  Production_Org --org-type Production
848
967
  ```
849
968
 
850
- _See code: [src/commands/devops/stage/environment/add.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/stage/environment/add.ts)_
969
+ _See code: [src/commands/devops/stage/environment/add.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/stage/environment/add.ts)_
851
970
 
852
971
  ## `sf devops stage environment delete`
853
972
 
@@ -881,7 +1000,7 @@ EXAMPLES
881
1000
  0Xe000000000001
882
1001
  ```
883
1002
 
884
- _See code: [src/commands/devops/stage/environment/delete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/stage/environment/delete.ts)_
1003
+ _See code: [src/commands/devops/stage/environment/delete.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/stage/environment/delete.ts)_
885
1004
 
886
1005
  ## `sf devops work-item combine`
887
1006
 
@@ -930,7 +1049,7 @@ FLAG DESCRIPTIONS
930
1049
  are merged into the parent's branch during promotion.
931
1050
  ```
932
1051
 
933
- _See code: [src/commands/devops/work-item/combine.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/work-item/combine.ts)_
1052
+ _See code: [src/commands/devops/work-item/combine.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/work-item/combine.ts)_
934
1053
 
935
1054
  ## `sf devops work-item create`
936
1055
 
@@ -971,7 +1090,7 @@ EXAMPLES
971
1090
  --description "Implement dark mode toggle in settings page"
972
1091
  ```
973
1092
 
974
- _See code: [src/commands/devops/work-item/create.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/work-item/create.ts)_
1093
+ _See code: [src/commands/devops/work-item/create.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/work-item/create.ts)_
975
1094
 
976
1095
  ## `sf devops work-item list`
977
1096
 
@@ -1007,7 +1126,7 @@ EXAMPLES
1007
1126
  $ sf devops work-item list --target-org my-devops-org --project-id 1Qg000000000001 --json
1008
1127
  ```
1009
1128
 
1010
- _See code: [src/commands/devops/work-item/list.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/work-item/list.ts)_
1129
+ _See code: [src/commands/devops/work-item/list.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/work-item/list.ts)_
1011
1130
 
1012
1131
  ## `sf devops work-item prepare`
1013
1132
 
@@ -1048,7 +1167,7 @@ EXAMPLES
1048
1167
  --target-stage-id 05S000000000002
1049
1168
  ```
1050
1169
 
1051
- _See code: [src/commands/devops/work-item/prepare.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/work-item/prepare.ts)_
1170
+ _See code: [src/commands/devops/work-item/prepare.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/work-item/prepare.ts)_
1052
1171
 
1053
1172
  ## `sf devops work-item update`
1054
1173
 
@@ -1095,7 +1214,7 @@ EXAMPLES
1095
1214
  --description "Users can't log in on mobile" --status "In Progress"
1096
1215
  ```
1097
1216
 
1098
- _See code: [src/commands/devops/work-item/update.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/devops/work-item/update.ts)_
1217
+ _See code: [src/commands/devops/work-item/update.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/devops/work-item/update.ts)_
1099
1218
 
1100
1219
  ## `sf project deploy pipeline quick`
1101
1220
 
@@ -1169,7 +1288,7 @@ FLAG DESCRIPTIONS
1169
1288
  "sf project deploy pipeline report".
1170
1289
  ```
1171
1290
 
1172
- _See code: [src/commands/project/deploy/pipeline/quick.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/project/deploy/pipeline/quick.ts)_
1291
+ _See code: [src/commands/project/deploy/pipeline/quick.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/project/deploy/pipeline/quick.ts)_
1173
1292
 
1174
1293
  ## `sf project deploy pipeline report`
1175
1294
 
@@ -1217,7 +1336,7 @@ FLAG DESCRIPTIONS
1217
1336
  your most recent operation was longer than 3 days ago, this flag won't find the job ID.
1218
1337
  ```
1219
1338
 
1220
- _See code: [src/commands/project/deploy/pipeline/report.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/project/deploy/pipeline/report.ts)_
1339
+ _See code: [src/commands/project/deploy/pipeline/report.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/project/deploy/pipeline/report.ts)_
1221
1340
 
1222
1341
  ## `sf project deploy pipeline resume`
1223
1342
 
@@ -1284,7 +1403,7 @@ FLAG DESCRIPTIONS
1284
1403
  returns the job ID. To check the status of the operation, run "sf project deploy pipeline report".
1285
1404
  ```
1286
1405
 
1287
- _See code: [src/commands/project/deploy/pipeline/resume.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/project/deploy/pipeline/resume.ts)_
1406
+ _See code: [src/commands/project/deploy/pipeline/resume.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/project/deploy/pipeline/resume.ts)_
1288
1407
 
1289
1408
  ## `sf project deploy pipeline start`
1290
1409
 
@@ -1384,7 +1503,7 @@ FLAG DESCRIPTIONS
1384
1503
  "sf project deploy pipeline report".
1385
1504
  ```
1386
1505
 
1387
- _See code: [src/commands/project/deploy/pipeline/start.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/project/deploy/pipeline/start.ts)_
1506
+ _See code: [src/commands/project/deploy/pipeline/start.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/project/deploy/pipeline/start.ts)_
1388
1507
 
1389
1508
  ## `sf project deploy pipeline validate`
1390
1509
 
@@ -1484,7 +1603,7 @@ FLAG DESCRIPTIONS
1484
1603
  "sf project deploy pipeline report".
1485
1604
  ```
1486
1605
 
1487
- _See code: [src/commands/project/deploy/pipeline/validate.ts](https://github.com/salesforcecli/plugin-devops-center/blob/1.4.1/src/commands/project/deploy/pipeline/validate.ts)_
1606
+ _See code: [src/commands/project/deploy/pipeline/validate.ts](https://github.com/salesforcecli/plugin-devops-center/blob/2.0.1/src/commands/project/deploy/pipeline/validate.ts)_
1488
1607
 
1489
1608
  <!-- commandsstop -->
1490
1609
 
@@ -0,0 +1,19 @@
1
+ import { Org } from '@salesforce/core';
2
+ import { SfCommand } from '@salesforce/sf-plugins-core';
3
+ export type PipelineStageUpdateResult = {
4
+ success: boolean;
5
+ stageId: string;
6
+ name: string;
7
+ };
8
+ export default class DevopsPipelineStageUpdate extends SfCommand<PipelineStageUpdateResult> {
9
+ static readonly summary: string;
10
+ static readonly description: string;
11
+ static readonly examples: string[];
12
+ static readonly flags: {
13
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'stage-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
+ name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
+ };
18
+ run(): Promise<PipelineStageUpdateResult>;
19
+ }
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Messages } from '@salesforce/core';
17
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
+ import { validateSalesforceId } from '../../../../utils/soqlUtils.js';
19
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.stage.update');
21
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
22
+ export default class DevopsPipelineStageUpdate extends SfCommand {
23
+ static summary = messages.getMessage('summary');
24
+ static description = messages.getMessage('description');
25
+ static examples = messages.getMessages('examples');
26
+ static flags = {
27
+ 'target-org': Flags.requiredOrg(),
28
+ 'api-version': Flags.orgApiVersion(),
29
+ 'stage-id': Flags.salesforceId({
30
+ summary: messages.getMessage('flags.stage-id.summary'),
31
+ required: true,
32
+ char: 's',
33
+ }),
34
+ name: Flags.string({
35
+ summary: messages.getMessage('flags.name.summary'),
36
+ required: true,
37
+ char: 'n',
38
+ }),
39
+ };
40
+ async run() {
41
+ const { flags } = await this.parse(DevopsPipelineStageUpdate);
42
+ const org = flags['target-org'];
43
+ const connection = org.getConnection(flags['api-version']);
44
+ const stageId = flags['stage-id'];
45
+ const name = flags['name'];
46
+ validateSalesforceId(stageId, 'stage');
47
+ try {
48
+ await connection.sobject('DevopsPipelineStage').update({ Id: stageId, Name: name });
49
+ }
50
+ catch (error) {
51
+ const errMsg = error instanceof Error ? error.message : String(error);
52
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
53
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
54
+ }
55
+ if (errMsg.toLowerCase().includes('not found') || errMsg.includes('entity is deleted')) {
56
+ this.error(messages.getMessage('error.StageNotFound', [stageId]));
57
+ }
58
+ throw error;
59
+ }
60
+ this.log(`Successfully updated stage "${name}".`);
61
+ this.log(` Stage ID: ${stageId}`);
62
+ this.log(` Name: ${name}`);
63
+ return { success: true, stageId, name };
64
+ }
65
+ }
66
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../src/commands/devops/pipeline/stage/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAA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GAAG,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC;QAEhC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC"}
@@ -1,9 +1,11 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { CombineDetails } from '../../utils/promotionUtils.js';
2
3
  export type PromoteResult = {
3
4
  requestId: string;
4
5
  status: string;
5
6
  message: string;
6
7
  promotedWorkitemIds: string[];
8
+ combineDetails?: CombineDetails | null;
7
9
  };
8
10
  export default class DevopsPromote extends SfCommand<PromoteResult> {
9
11
  static readonly summary: string;
@@ -18,7 +20,10 @@ export default class DevopsPromote extends SfCommand<PromoteResult> {
18
20
  'deploy-all': import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
21
  'test-level': import("@oclif/core/interfaces").OptionFlag<import("../../common/types.js").TestLevel | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
22
  tests: import("@oclif/core/interfaces").OptionFlag<string[] | undefined>;
23
+ 'skip-validation': import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
24
  };
25
+ private static assertWorkItemsPromotable;
22
26
  private static fetchStageWorkItems;
23
27
  run(): Promise<PromoteResult>;
28
+ private runValidation;
24
29
  }
@@ -20,9 +20,12 @@ import { resolveProjectIdFromWorkItem } from '../../utils/prepareWorkItem.js';
20
20
  import { getPipelineIdForProject } from '../../utils/pipelineUtils.js';
21
21
  import { deployAll, testLevel as testLevelFlag, specificTestsNoChar } from '../../common/flags/promote/promoteFlags.js';
22
22
  import { validateSalesforceId } from '../../utils/soqlUtils.js';
23
+ import { validatePromotion, formatValidationDetails, } from '../../utils/promotionUtils.js';
23
24
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
24
25
  const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.promote');
25
26
  const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
27
+ const PROMOTABLE_STATUSES = ['READY_TO_PROMOTE', 'PROMOTED'];
28
+ const PROMOTABLE_STATUS_LIST = PROMOTABLE_STATUSES.join("', '");
26
29
  export default class DevopsPromote extends SfCommand {
27
30
  static summary = messages.getMessage('summary');
28
31
  static description = messages.getMessage('description');
@@ -55,7 +58,21 @@ export default class DevopsPromote extends SfCommand {
55
58
  'deploy-all': deployAll,
56
59
  'test-level': testLevelFlag(),
57
60
  tests: specificTestsNoChar,
61
+ 'skip-validation': Flags.boolean({
62
+ summary: messages.getMessage('flags.skip-validation.summary'),
63
+ default: false,
64
+ }),
58
65
  };
66
+ static async assertWorkItemsPromotable(connection, workItemIds) {
67
+ const idList = workItemIds.map((id) => `'${id}'`).join(', ');
68
+ const result = await connection.query(`SELECT Id, Status FROM WorkItem WHERE Id IN (${idList})`);
69
+ const ineligible = result.records.filter((r) => !PROMOTABLE_STATUSES.includes(r.Status));
70
+ if (ineligible.length > 0) {
71
+ const details = ineligible.map((r) => `${r.Id} (${r.Status})`).join(', ');
72
+ throw new Error(`The following work items are not eligible for promotion: ${details}. Only work items with status READY_TO_PROMOTE or PROMOTED can be promoted.`);
73
+ }
74
+ return result.records.map((r) => r.Id);
75
+ }
59
76
  static async fetchStageWorkItems(connection, pipelineId, sourceStageId, targetStageId) {
60
77
  // Validate all IDs before using in SOQL
61
78
  validateSalesforceId(pipelineId, 'pipeline');
@@ -70,7 +87,7 @@ export default class DevopsPromote extends SfCommand {
70
87
  if (nextStageId !== targetStageId) {
71
88
  throw new Error(`Stage '${sourceStageId}' does not feed into target stage '${targetStageId}'.`);
72
89
  }
73
- const workItemResult = await connection.query(`SELECT Id FROM WorkItem WHERE DevopsPipelineStageId = '${sourceStageId}' LIMIT 200`);
90
+ const workItemResult = await connection.query(`SELECT Id FROM WorkItem WHERE DevopsPipelineStageId = '${sourceStageId}' AND Status IN ('${PROMOTABLE_STATUS_LIST}') LIMIT 200`);
74
91
  return workItemResult.records.map((r) => r.Id);
75
92
  }
76
93
  async run() {
@@ -91,7 +108,7 @@ export default class DevopsPromote extends SfCommand {
91
108
  this.error(`No pipeline found for work item "${workItemIds[0]}". Ensure the project has an associated pipeline.`);
92
109
  }
93
110
  pipelineId = pid;
94
- resolvedWorkItemIds = workItemIds;
111
+ resolvedWorkItemIds = await DevopsPromote.assertWorkItemsPromotable(connection, workItemIds);
95
112
  }
96
113
  else {
97
114
  // Stage path: resolve pipelineId from the source stage
@@ -108,6 +125,9 @@ export default class DevopsPromote extends SfCommand {
108
125
  this.error(messages.getMessage('error.NoWorkItems'));
109
126
  }
110
127
  }
128
+ if (!flags['skip-validation']) {
129
+ await this.runValidation(connection, pipelineId, resolvedWorkItemIds, targetStageId, !workItemIds?.length);
130
+ }
111
131
  let apiResult;
112
132
  try {
113
133
  apiResult = await promoteStage({
@@ -125,7 +145,8 @@ export default class DevopsPromote extends SfCommand {
125
145
  if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
126
146
  this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
127
147
  }
128
- const cleanMsg = errMsg.split('<')[0].trim();
148
+ const htmlStripped = errMsg.split('<')[0].trim();
149
+ const cleanMsg = htmlStripped.replace(/^[A-Z][A-Z0-9_]+:/, '').trim();
129
150
  this.error(messages.getMessage('error.PromoteFailed', [cleanMsg]));
130
151
  }
131
152
  this.log(`Status: ${apiResult.status}`);
@@ -144,5 +165,30 @@ export default class DevopsPromote extends SfCommand {
144
165
  promotedWorkitemIds: apiResult.promotedWorkitemIds,
145
166
  };
146
167
  }
168
+ async runValidation(connection, pipelineId, workItemIds, targetStageId, allWorkItemsInStage = false) {
169
+ let result;
170
+ try {
171
+ result = await validatePromotion(connection, pipelineId, workItemIds, targetStageId, false, allWorkItemsInStage);
172
+ }
173
+ catch (error) {
174
+ const errMsg = error instanceof Error ? error.message : String(error);
175
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
176
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
177
+ }
178
+ const htmlStripped = errMsg.split('<')[0].trim();
179
+ const cleanMsg = htmlStripped.replace(/^[A-Z][A-Z0-9_]+:/, '').trim();
180
+ this.error(messages.getMessage('error.ValidationRequestFailed', [cleanMsg]));
181
+ }
182
+ if (!result.success) {
183
+ if (result.combineDetails) {
184
+ this.log(messages.getMessage('error.ValidationFailedCombineRequired'));
185
+ this.log(JSON.stringify(result.combineDetails, null, 2));
186
+ }
187
+ this.error(messages.getMessage('error.ValidationFailed', [
188
+ result.errorType ?? '',
189
+ formatValidationDetails(result.errorDetails),
190
+ ]));
191
+ }
192
+ }
147
193
  }
148
194
  //# sourceMappingURL=promote.js.map