@salesforce/plugin-devops-center 1.3.0 → 1.4.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 (185) hide show
  1. package/README.md +649 -102
  2. package/lib/commands/devops/pipeline/create.d.ts +2 -1
  3. package/lib/commands/devops/pipeline/create.js +37 -7
  4. package/lib/commands/devops/pipeline/create.js.map +1 -1
  5. package/lib/commands/devops/pipeline/{activate.d.ts → get.d.ts} +3 -3
  6. package/lib/commands/devops/pipeline/get.js +81 -0
  7. package/lib/commands/devops/pipeline/get.js.map +1 -0
  8. package/lib/commands/devops/pipeline/list.d.ts +13 -0
  9. package/lib/commands/devops/pipeline/list.js +58 -0
  10. package/lib/commands/devops/pipeline/list.js.map +1 -0
  11. package/lib/commands/devops/pipeline/{attach-project.d.ts → project/add.d.ts} +2 -2
  12. package/lib/commands/devops/pipeline/{attach-project.js → project/add.js} +5 -5
  13. package/lib/commands/devops/pipeline/project/add.js.map +1 -0
  14. package/lib/commands/devops/pipeline/project/delete.d.ts +15 -0
  15. package/lib/commands/devops/pipeline/{activate.js → project/delete.js} +17 -28
  16. package/lib/commands/devops/pipeline/project/delete.js.map +1 -0
  17. package/lib/commands/devops/pipeline/stage/delete.d.ts +15 -0
  18. package/lib/commands/devops/pipeline/stage/delete.js +69 -0
  19. package/lib/commands/devops/pipeline/stage/delete.js.map +1 -0
  20. package/lib/commands/devops/pipeline/update.d.ts +18 -0
  21. package/lib/commands/devops/pipeline/update.js +126 -0
  22. package/lib/commands/devops/pipeline/update.js.map +1 -0
  23. package/lib/commands/devops/project/update.d.ts +17 -0
  24. package/lib/commands/devops/project/update.js +86 -0
  25. package/lib/commands/devops/project/update.js.map +1 -0
  26. package/lib/commands/devops/promote.d.ts +24 -0
  27. package/lib/commands/devops/promote.js +148 -0
  28. package/lib/commands/devops/promote.js.map +1 -0
  29. package/lib/commands/devops/promotion/complete.d.ts +20 -0
  30. package/lib/commands/devops/promotion/complete.js +112 -0
  31. package/lib/commands/devops/promotion/complete.js.map +1 -0
  32. package/lib/commands/devops/request/status.d.ts +14 -0
  33. package/lib/commands/devops/request/status.js +71 -0
  34. package/lib/commands/devops/request/status.js.map +1 -0
  35. package/lib/commands/devops/{pull-request → review}/create.d.ts +1 -3
  36. package/lib/commands/devops/{pull-request → review}/create.js +11 -43
  37. package/lib/commands/devops/review/create.js.map +1 -0
  38. package/lib/commands/devops/stage/{add-branch.d.ts → branch/add.d.ts} +2 -2
  39. package/lib/commands/devops/stage/{add-branch.js → branch/add.js} +6 -6
  40. package/lib/commands/devops/stage/branch/add.js.map +1 -0
  41. package/lib/commands/devops/stage/{add-environment.d.ts → environment/add.d.ts} +2 -2
  42. package/lib/commands/devops/stage/{add-environment.js → environment/add.js} +13 -6
  43. package/lib/commands/devops/stage/environment/add.js.map +1 -0
  44. package/lib/commands/devops/stage/environment/delete.d.ts +15 -0
  45. package/lib/commands/devops/stage/environment/delete.js +75 -0
  46. package/lib/commands/devops/stage/environment/delete.js.map +1 -0
  47. package/lib/commands/devops/work-item/combine.d.ts +15 -0
  48. package/lib/commands/devops/work-item/combine.js +109 -0
  49. package/lib/commands/devops/work-item/combine.js.map +1 -0
  50. package/lib/commands/devops/work-item/prepare.d.ts +14 -0
  51. package/lib/commands/devops/work-item/prepare.js +98 -0
  52. package/lib/commands/devops/work-item/prepare.js.map +1 -0
  53. package/lib/commands/devops/work-item/{status/update.d.ts → update.d.ts} +6 -4
  54. package/lib/commands/devops/work-item/{status/update.js → update.js} +30 -9
  55. package/lib/commands/devops/work-item/update.js.map +1 -0
  56. package/lib/common/flags/promote/promoteFlags.d.ts +1 -0
  57. package/lib/common/flags/promote/promoteFlags.js +5 -0
  58. package/lib/common/flags/promote/promoteFlags.js.map +1 -1
  59. package/lib/common/outputService/aorOutputService.js +4 -4
  60. package/lib/common/outputService/aorOutputService.js.map +1 -1
  61. package/lib/common/outputService/outputUtils.js +1 -2
  62. package/lib/common/outputService/outputUtils.js.map +1 -1
  63. package/lib/common/selectors/asyncOperationResultsSelector.js +3 -1
  64. package/lib/common/selectors/asyncOperationResultsSelector.js.map +1 -1
  65. package/lib/common/selectors/deployComponentsSelector.js +5 -6
  66. package/lib/common/selectors/deployComponentsSelector.js.map +1 -1
  67. package/lib/common/selectors/deployProgressSummarySelector.js +3 -1
  68. package/lib/common/selectors/deployProgressSummarySelector.js.map +1 -1
  69. package/lib/common/selectors/deploymentResultsSelector.js +10 -6
  70. package/lib/common/selectors/deploymentResultsSelector.js.map +1 -1
  71. package/lib/common/selectors/environmentSelector.js +4 -2
  72. package/lib/common/selectors/environmentSelector.js.map +1 -1
  73. package/lib/common/selectors/namedCredentialSelector.js +2 -1
  74. package/lib/common/selectors/namedCredentialSelector.js.map +1 -1
  75. package/lib/common/selectors/pipelineStageSelector.js +5 -3
  76. package/lib/common/selectors/pipelineStageSelector.js.map +1 -1
  77. package/lib/common/selectors/validateDeploySelector.js +3 -1
  78. package/lib/common/selectors/validateDeploySelector.js.map +1 -1
  79. package/lib/common/selectors/workItemSelector.js +4 -1
  80. package/lib/common/selectors/workItemSelector.js.map +1 -1
  81. package/lib/utils/activatePipeline.d.ts +13 -4
  82. package/lib/utils/activatePipeline.js +7 -6
  83. package/lib/utils/activatePipeline.js.map +1 -1
  84. package/lib/utils/attachProject.js +2 -0
  85. package/lib/utils/attachProject.js.map +1 -1
  86. package/lib/utils/combineWorkItems.d.ts +20 -0
  87. package/lib/utils/combineWorkItems.js +42 -0
  88. package/lib/utils/combineWorkItems.js.map +1 -0
  89. package/lib/utils/createPipeline.d.ts +14 -1
  90. package/lib/utils/createPipeline.js +52 -6
  91. package/lib/utils/createPipeline.js.map +1 -1
  92. package/lib/utils/createProject.js +1 -0
  93. package/lib/utils/createProject.js.map +1 -1
  94. package/lib/utils/createPullRequest.d.ts +7 -19
  95. package/lib/utils/createPullRequest.js +51 -122
  96. package/lib/utils/createPullRequest.js.map +1 -1
  97. package/lib/utils/deletePipelineStage.d.ts +12 -0
  98. package/lib/utils/deletePipelineStage.js +41 -0
  99. package/lib/utils/deletePipelineStage.js.map +1 -0
  100. package/lib/utils/deleteStageEnvironment.d.ts +8 -0
  101. package/lib/utils/deleteStageEnvironment.js +33 -0
  102. package/lib/utils/deleteStageEnvironment.js.map +1 -0
  103. package/lib/utils/deployStage.d.ts +29 -0
  104. package/lib/utils/deployStage.js +68 -0
  105. package/lib/utils/deployStage.js.map +1 -0
  106. package/lib/utils/detachProject.d.ts +8 -0
  107. package/lib/utils/detachProject.js +37 -0
  108. package/lib/utils/detachProject.js.map +1 -0
  109. package/lib/utils/getPipeline.d.ts +27 -0
  110. package/lib/utils/getPipeline.js +66 -0
  111. package/lib/utils/getPipeline.js.map +1 -0
  112. package/lib/utils/getRequestStatus.d.ts +10 -0
  113. package/lib/utils/getRequestStatus.js +32 -0
  114. package/lib/utils/getRequestStatus.js.map +1 -0
  115. package/lib/utils/listPipelines.d.ts +11 -0
  116. package/lib/utils/listPipelines.js +20 -0
  117. package/lib/utils/listPipelines.js.map +1 -0
  118. package/lib/utils/pipelineUtils.js +3 -0
  119. package/lib/utils/pipelineUtils.js.map +1 -1
  120. package/lib/utils/prepareWorkItem.d.ts +25 -0
  121. package/lib/utils/prepareWorkItem.js +55 -0
  122. package/lib/utils/prepareWorkItem.js.map +1 -0
  123. package/lib/utils/promoteStage.d.ts +21 -0
  124. package/lib/utils/promoteStage.js +46 -0
  125. package/lib/utils/promoteStage.js.map +1 -0
  126. package/lib/utils/soqlUtils.d.ts +23 -0
  127. package/lib/utils/soqlUtils.js +63 -0
  128. package/lib/utils/soqlUtils.js.map +1 -0
  129. package/lib/utils/updateProject.d.ts +17 -0
  130. package/lib/utils/updateProject.js +41 -0
  131. package/lib/utils/updateProject.js.map +1 -0
  132. package/lib/utils/{updateWorkItemStatus.d.ts → updateWorkItem.d.ts} +12 -14
  133. package/lib/utils/{updateWorkItemStatus.js → updateWorkItem.js} +31 -27
  134. package/lib/utils/updateWorkItem.js.map +1 -0
  135. package/lib/utils/workItems.js +2 -0
  136. package/lib/utils/workItems.js.map +1 -1
  137. package/messages/devops.pipeline.create.md +26 -6
  138. package/messages/devops.pipeline.get.md +17 -0
  139. package/messages/devops.pipeline.list.md +13 -0
  140. package/messages/devops.pipeline.project.delete.md +25 -0
  141. package/messages/devops.pipeline.stage.delete.md +25 -0
  142. package/messages/devops.pipeline.update.md +47 -0
  143. package/messages/devops.project.update.md +45 -0
  144. package/messages/devops.promote.md +61 -0
  145. package/messages/devops.promotion.complete.md +47 -0
  146. package/messages/devops.request.status.md +21 -0
  147. package/messages/devops.review.create.md +33 -0
  148. package/messages/{devops.stage.add-environment.md → devops.stage.environment.add.md} +4 -0
  149. package/messages/devops.stage.environment.delete.md +29 -0
  150. package/messages/devops.work-item.combine.md +39 -0
  151. package/messages/devops.work-item.prepare.md +27 -0
  152. package/messages/devops.work-item.update.md +45 -0
  153. package/npm-shrinkwrap.json +37 -174
  154. package/oclif.lock +1 -1
  155. package/oclif.manifest.json +1167 -223
  156. package/package.json +20 -8
  157. package/schemas/devops-pipeline-get.json +98 -0
  158. package/schemas/devops-pipeline-list.json +38 -0
  159. package/schemas/devops-pipeline-project-delete.json +25 -0
  160. package/schemas/devops-pipeline-stage-delete.json +25 -0
  161. package/schemas/{devops-pipeline-activate.json → devops-pipeline-update.json} +5 -2
  162. package/schemas/devops-project-update.json +31 -0
  163. package/schemas/devops-promote.json +28 -0
  164. package/schemas/devops-promotion-complete.json +34 -0
  165. package/schemas/devops-request-status.json +31 -0
  166. package/schemas/{devops-pull__request-create.json → devops-review-create.json} +0 -3
  167. package/schemas/devops-stage-environment-delete.json +25 -0
  168. package/schemas/devops-work__item-combine.json +25 -0
  169. package/schemas/devops-work__item-prepare.json +25 -0
  170. package/schemas/{devops-work__item-status-update.json → devops-work__item-update.json} +8 -2
  171. package/lib/commands/devops/pipeline/activate.js.map +0 -1
  172. package/lib/commands/devops/pipeline/attach-project.js.map +0 -1
  173. package/lib/commands/devops/pull-request/create.js.map +0 -1
  174. package/lib/commands/devops/stage/add-branch.js.map +0 -1
  175. package/lib/commands/devops/stage/add-environment.js.map +0 -1
  176. package/lib/commands/devops/work-item/status/update.js.map +0 -1
  177. package/lib/utils/updateWorkItemStatus.js.map +0 -1
  178. package/messages/devops.pipeline.activate.md +0 -29
  179. package/messages/devops.pull-request.create.md +0 -57
  180. package/messages/devops.work-item.status.update.md +0 -29
  181. /package/messages/{devops.pipeline.attach-project.md → devops.pipeline.project.add.md} +0 -0
  182. /package/messages/{devops.stage.add-branch.md → devops.stage.branch.add.md} +0 -0
  183. /package/schemas/{devops-pipeline-attach__project.json → devops-pipeline-project-add.json} +0 -0
  184. /package/schemas/{devops-stage-add__branch.json → devops-stage-branch-add.json} +0 -0
  185. /package/schemas/{devops-stage-add__environment.json → devops-stage-environment-add.json} +0 -0
@@ -0,0 +1,71 @@
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 { getRequestStatus } from '../../../utils/getRequestStatus.js';
19
+ import { colorStatus } from '../../../common/outputService/outputUtils.js';
20
+ import { AsyncOperationStatus } from '../../../common/types.js';
21
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.request.status');
23
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
24
+ export default class DevopsRequestStatus extends SfCommand {
25
+ static summary = messages.getMessage('summary');
26
+ static description = messages.getMessage('description');
27
+ static examples = messages.getMessages('examples');
28
+ static flags = {
29
+ 'target-org': Flags.requiredOrg(),
30
+ 'api-version': Flags.orgApiVersion(),
31
+ 'request-token': Flags.string({
32
+ summary: messages.getMessage('flags.request-token.summary'),
33
+ required: true,
34
+ char: 'i',
35
+ }),
36
+ };
37
+ async run() {
38
+ const { flags } = await this.parse(DevopsRequestStatus);
39
+ const org = flags['target-org'];
40
+ const connection = org.getConnection(flags['api-version']);
41
+ const requestToken = flags['request-token'];
42
+ let result;
43
+ try {
44
+ result = await getRequestStatus(connection, requestToken);
45
+ }
46
+ catch (error) {
47
+ const errMsg = error instanceof Error ? error.message : String(error);
48
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
49
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
50
+ }
51
+ if (errMsg.startsWith('RequestNotFound:') || errMsg.includes('entity is deleted')) {
52
+ this.error(messages.getMessage('error.RequestNotFound', [requestToken]));
53
+ }
54
+ throw error;
55
+ }
56
+ const statusStr = Object.values(AsyncOperationStatus).includes(result.status)
57
+ ? colorStatus(result.status)
58
+ : result.status;
59
+ this.log(` Request Token: ${result.requestToken}`);
60
+ this.log(` ID: ${result.id}`);
61
+ this.log(` Status: ${statusStr}`);
62
+ if (result.message)
63
+ this.log(` Message: ${result.message}`);
64
+ if (result.errorDetails)
65
+ this.log(` Error Details: ${result.errorDetails}`);
66
+ if (result.requestCompletionDate)
67
+ this.log(` Completion Date: ${result.requestCompletionDate}`);
68
+ return result;
69
+ }
70
+ }
71
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/commands/devops/request/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6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MAAM,CAAC,OAAO;YAAE,IAAI,CAAC,GAAG,CAAC,yBAAyB,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QACxE,IAAI,MAAM,CAAC,YAAY;YAAE,IAAI,CAAC,GAAG,CAAC,yBAAyB,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;QAClF,IAAI,MAAM,CAAC,qBAAqB;YAAE,IAAI,CAAC,GAAG,CAAC,yBAAyB,MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC;QAEpG,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Org } from '@salesforce/core';
2
2
  import { SfCommand } from '@salesforce/sf-plugins-core';
3
3
  import { CreatePullRequestResult } from '../../../utils/createPullRequest.js';
4
- export default class DevopsPullRequestCreate extends SfCommand<CreatePullRequestResult> {
4
+ export default class DevopsReviewCreate extends SfCommand<CreatePullRequestResult> {
5
5
  static readonly summary: string;
6
6
  static readonly description: string;
7
7
  static readonly examples: string[];
@@ -10,8 +10,6 @@ export default class DevopsPullRequestCreate extends SfCommand<CreatePullRequest
10
10
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  'work-item-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
12
  'work-item-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
- title: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
- body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
13
  };
16
14
  run(): Promise<CreatePullRequestResult>;
17
15
  }
@@ -15,11 +15,11 @@
15
15
  */
16
16
  import { Messages } from '@salesforce/core';
17
17
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
- import { createPullRequest, fetchWorkItemDetail, resolveGitHubToken, } from '../../../utils/createPullRequest.js';
18
+ import { createPullRequest, fetchWorkItemDetail, } from '../../../utils/createPullRequest.js';
19
19
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
- const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pull-request.create');
20
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.review.create');
21
21
  const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
22
- export default class DevopsPullRequestCreate extends SfCommand {
22
+ export default class DevopsReviewCreate extends SfCommand {
23
23
  static summary = messages.getMessage('summary');
24
24
  static description = messages.getMessage('description');
25
25
  static examples = messages.getMessages('examples');
@@ -36,15 +36,9 @@ export default class DevopsPullRequestCreate extends SfCommand {
36
36
  char: 'w',
37
37
  exactlyOne: ['work-item-name', 'work-item-id'],
38
38
  }),
39
- title: Flags.string({
40
- summary: messages.getMessage('flags.title.summary'),
41
- }),
42
- body: Flags.string({
43
- summary: messages.getMessage('flags.body.summary'),
44
- }),
45
39
  };
46
40
  async run() {
47
- const { flags } = await this.parse(DevopsPullRequestCreate);
41
+ const { flags } = await this.parse(DevopsReviewCreate);
48
42
  const org = flags['target-org'];
49
43
  const connection = org.getConnection(flags['api-version']);
50
44
  const filter = flags['work-item-name'] ? { name: flags['work-item-name'] } : { id: flags['work-item-id'] };
@@ -62,41 +56,15 @@ export default class DevopsPullRequestCreate extends SfCommand {
62
56
  if (!detail.branchName) {
63
57
  this.error(messages.getMessage('error.NoBranch', [detail.workItemName]));
64
58
  }
65
- if (!detail.repoOwner || !detail.repoName) {
66
- this.error(messages.getMessage('error.NoRepo', [detail.workItemName]));
67
- }
68
- if (!detail.targetBranch) {
69
- this.error(messages.getMessage('error.NoTargetBranch', [detail.workItemName]));
70
- }
71
- if (!detail.provider) {
72
- this.error(messages.getMessage('error.NoProvider', [detail.workItemName]));
73
- }
74
- let token;
75
- if (detail.provider === 'github') {
76
- token = await resolveGitHubToken();
77
- }
78
- else {
79
- token = process.env.BITBUCKET_TOKEN;
80
- }
81
- if (!token) {
82
- this.error(messages.getMessage('error.NoToken', [detail.provider]));
83
- }
84
- const prTitle = flags['title'] ?? detail.subject;
85
- const result = await createPullRequest({
86
- owner: detail.repoOwner,
87
- repo: detail.repoName,
88
- head: detail.branchName,
89
- base: detail.targetBranch,
90
- title: prTitle,
91
- body: flags['body'],
92
- provider: detail.provider,
93
- token,
94
- });
59
+ const result = await createPullRequest(connection, detail.workItemId);
95
60
  if (result.success) {
96
61
  this.log(`Successfully created pull request for ${detail.workItemName}.`);
97
- this.log(` Title: ${result.title ?? prTitle}`);
98
- this.log(` URL: ${result.url ?? ''}`);
99
- this.log(` Source: ${detail.workItemName} → ${result.targetBranch ?? detail.targetBranch}`);
62
+ if (result.url) {
63
+ this.log(` URL: ${result.url}`);
64
+ }
65
+ if (detail.branchName && detail.targetBranch) {
66
+ this.log(` Source: ${detail.branchName} → ${detail.targetBranch}`);
67
+ }
100
68
  }
101
69
  return result;
102
70
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/devops/review/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,iBAAiB,EAEjB,mBAAmB,GAEpB,MAAM,qCAAqC,CAAC;AAE7C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,sBAAsB,CAAC,CAAC;AACnG,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,SAAkC;IACzE,MAAM,CAAU,OAAO,GA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/sf-plugins-core';
3
- import { AddStageBranchResult } from '../../../utils/addStageBranch.js';
4
- export default class DevopsStageAddBranch extends SfCommand<AddStageBranchResult> {
3
+ import { AddStageBranchResult } from '../../../../utils/addStageBranch.js';
4
+ export default class DevopsStageBranchAdd extends SfCommand<AddStageBranchResult> {
5
5
  static readonly summary: string;
6
6
  static readonly description: string;
7
7
  static readonly examples: string[];
@@ -15,12 +15,12 @@
15
15
  */
16
16
  import { Messages } from '@salesforce/core';
17
17
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
- import { addStageBranch } from '../../../utils/addStageBranch.js';
19
- import { fetchPipelineStages } from '../../../utils/pipelineUtils.js';
18
+ import { addStageBranch } from '../../../../utils/addStageBranch.js';
19
+ import { fetchPipelineStages } from '../../../../utils/pipelineUtils.js';
20
20
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
21
- const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.stage.add-branch');
21
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.stage.branch.add');
22
22
  const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
23
- export default class DevopsStageAddBranch extends SfCommand {
23
+ export default class DevopsStageBranchAdd extends SfCommand {
24
24
  static summary = messages.getMessage('summary');
25
25
  static description = messages.getMessage('description');
26
26
  static examples = messages.getMessages('examples');
@@ -48,7 +48,7 @@ export default class DevopsStageAddBranch extends SfCommand {
48
48
  }),
49
49
  };
50
50
  async run() {
51
- const { flags } = await this.parse(DevopsStageAddBranch);
51
+ const { flags } = await this.parse(DevopsStageBranchAdd);
52
52
  const org = flags['target-org'];
53
53
  const connection = org.getConnection(flags['api-version']);
54
54
  const pipelineId = flags['pipeline-id'];
@@ -107,4 +107,4 @@ export default class DevopsStageAddBranch extends SfCommand {
107
107
  return result;
108
108
  }
109
109
  }
110
- //# sourceMappingURL=add-branch.js.map
110
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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CAAC;gBAC3E,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,CAAC;YAC7E,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,gCAAgC,CAAC;YAC5G,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,kBAAkB,CAAC,CAAC;YACtC,IAAI,CAAC,GAAG,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAC;YACzC,IAAI,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,UAAU,IAAI,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1G,IAAI,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,GAAG,CAAC,qBAAqB,UAAU,EAAE,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,0BAA0B,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Org } from '@salesforce/core';
2
2
  import { SfCommand } from '@salesforce/sf-plugins-core';
3
- import { AddStageEnvironmentResult } from '../../../utils/addStageEnvironment.js';
4
- export default class DevopsStageAddEnvironment extends SfCommand<AddStageEnvironmentResult> {
3
+ import { AddStageEnvironmentResult } from '../../../../utils/addStageEnvironment.js';
4
+ export default class DevopsStageEnvironmentAdd extends SfCommand<AddStageEnvironmentResult> {
5
5
  static readonly summary: string;
6
6
  static readonly description: string;
7
7
  static readonly examples: string[];
@@ -16,10 +16,11 @@
16
16
  import { exec } from 'node:child_process';
17
17
  import { Messages } from '@salesforce/core';
18
18
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
- import { addStageEnvironment } from '../../../utils/addStageEnvironment.js';
20
- import { fetchPipelineStages } from '../../../utils/pipelineUtils.js';
19
+ import { addStageEnvironment } from '../../../../utils/addStageEnvironment.js';
20
+ import { fetchPipelineStages } from '../../../../utils/pipelineUtils.js';
21
+ import { validateSalesforceId } from '../../../../utils/soqlUtils.js';
21
22
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
- const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.stage.add-environment');
23
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.stage.environment.add');
23
24
  const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
24
25
  function openUrl(url) {
25
26
  const platform = process.platform;
@@ -29,7 +30,7 @@ function openUrl(url) {
29
30
  function decodeRedirectUrl(url) {
30
31
  return url.replace(/&amp;/g, '&');
31
32
  }
32
- export default class DevopsStageAddEnvironment extends SfCommand {
33
+ export default class DevopsStageEnvironmentAdd extends SfCommand {
33
34
  static summary = messages.getMessage('summary');
34
35
  static description = messages.getMessage('description');
35
36
  static examples = messages.getMessages('examples');
@@ -62,7 +63,7 @@ export default class DevopsStageAddEnvironment extends SfCommand {
62
63
  }),
63
64
  };
64
65
  async run() {
65
- const { flags } = await this.parse(DevopsStageAddEnvironment);
66
+ const { flags } = await this.parse(DevopsStageEnvironmentAdd);
66
67
  const org = flags['target-org'];
67
68
  const connection = org.getConnection(flags['api-version']);
68
69
  const pipelineId = flags['pipeline-id'];
@@ -84,6 +85,12 @@ export default class DevopsStageAddEnvironment extends SfCommand {
84
85
  if (!stages.some((s) => s.Id === stageId)) {
85
86
  this.error(messages.getMessage('error.StageNotFound', [stageId, pipelineId]));
86
87
  }
88
+ validateSalesforceId(pipelineId, 'pipeline');
89
+ const pipelineQueryResult = await connection.query(`SELECT IsActive FROM DevopsPipeline WHERE Id = '${pipelineId}' LIMIT 1`);
90
+ const pipelineRecord = (pipelineQueryResult.records ?? [])[0];
91
+ if (pipelineRecord?.IsActive) {
92
+ this.error(messages.getMessage('error.PipelineAlreadyActive', [pipelineId]));
93
+ }
87
94
  let result;
88
95
  try {
89
96
  result = await addStageEnvironment({
@@ -133,4 +140,4 @@ export default class DevopsStageAddEnvironment extends SfCommand {
133
140
  return result;
134
141
  }
135
142
  }
136
- //# sourceMappingURL=add-environment.js.map
143
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/devops/stage/environment/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAsC,MAAM,0CAA0C,CAAC;AACnH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,8BAA8B,CAAC,CAAC;AAC3G,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,SAAS,OAAO,CAAC,GAAW;IAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,GAAG,GAAG,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MA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AAG,CAAC,uBAAuB,UAAU,EAAE,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,cAAc,IAAI,EAAE,EAAE,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,+BAA+B,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACzF,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Org } from '@salesforce/core';
2
+ import { SfCommand } from '@salesforce/sf-plugins-core';
3
+ import { DeleteStageEnvironmentResult } from '../../../../utils/deleteStageEnvironment.js';
4
+ export default class DevopsStageEnvironmentDelete extends SfCommand<DeleteStageEnvironmentResult> {
5
+ static readonly summary: string;
6
+ static readonly description: string;
7
+ static readonly examples: string[];
8
+ static readonly flags: {
9
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ 'environment-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<DeleteStageEnvironmentResult>;
15
+ }
@@ -0,0 +1,75 @@
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 { deleteStageEnvironment } from '../../../../utils/deleteStageEnvironment.js';
19
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.stage.environment.delete');
21
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
22
+ export default class DevopsStageEnvironmentDelete 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
+ 'pipeline-id': Flags.salesforceId({
30
+ summary: messages.getMessage('flags.pipeline-id.summary'),
31
+ required: true,
32
+ char: undefined,
33
+ }),
34
+ 'environment-id': Flags.salesforceId({
35
+ summary: messages.getMessage('flags.environment-id.summary'),
36
+ required: true,
37
+ char: 'e',
38
+ }),
39
+ };
40
+ async run() {
41
+ const { flags } = await this.parse(DevopsStageEnvironmentDelete);
42
+ const org = flags['target-org'];
43
+ const connection = org.getConnection(flags['api-version']);
44
+ const pipelineId = flags['pipeline-id'];
45
+ const environmentId = flags['environment-id'];
46
+ // pipeline-id and environment-id are already validated by Flags.salesforceId()
47
+ const pipelineQueryResult = await connection.query(`SELECT IsActive FROM DevopsPipeline WHERE Id = '${pipelineId}' LIMIT 1`);
48
+ const pipelineRecord = (pipelineQueryResult.records ?? [])[0];
49
+ if (pipelineRecord?.IsActive) {
50
+ this.error(messages.getMessage('error.PipelineAlreadyActive', [pipelineId]));
51
+ }
52
+ let result;
53
+ try {
54
+ result = await deleteStageEnvironment(connection, environmentId);
55
+ }
56
+ catch (error) {
57
+ const errMsg = error instanceof Error ? error.message : String(error);
58
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
59
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
60
+ }
61
+ if (errMsg.includes('entity is deleted')) {
62
+ this.error(messages.getMessage('error.EnvironmentNotFound', [environmentId]));
63
+ }
64
+ throw error;
65
+ }
66
+ if (result.success) {
67
+ this.log(`Successfully deleted environment ${environmentId}.`);
68
+ }
69
+ else {
70
+ this.error(`Failed to delete environment: ${result.error ?? ''}`);
71
+ }
72
+ return result;
73
+ }
74
+ }
75
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/devops/stage/environment/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAgC,MAAM,6CAA6C,CAAC;AAEnH,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,iCAAiC,CAAC,CAAC;AAC9G,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,SAAuC;IACxF,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,aAAa,EAAE,KAAK,CA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M,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtE,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAC3E,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,CAAC;YAC7E,CAAC;YACD,IAAI,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBACzC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,2BAA2B,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YAChF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,oCAAoC,aAAa,GAAG,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,iCAAiC,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { CombineWorkItemsPrepareResult } from '../../../utils/combineWorkItems.js';
3
+ export default class DevopsWorkItemCombine extends SfCommand<CombineWorkItemsPrepareResult> {
4
+ static readonly summary: string;
5
+ static readonly description: string;
6
+ static readonly examples: string[];
7
+ static readonly flags: {
8
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'parent-work-item-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'child-work-item-id': import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
12
+ 'target-stage-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<CombineWorkItemsPrepareResult>;
15
+ }
@@ -0,0 +1,109 @@
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 { combineWorkItemsPrepare } from '../../../utils/combineWorkItems.js';
19
+ import { getPipelineIdForProject } from '../../../utils/pipelineUtils.js';
20
+ import { resolveProjectIdFromWorkItem } from '../../../utils/prepareWorkItem.js';
21
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.work-item.combine');
23
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
24
+ export default class DevopsWorkItemCombine extends SfCommand {
25
+ static summary = messages.getMessage('summary');
26
+ static description = messages.getMessage('description');
27
+ static examples = messages.getMessages('examples');
28
+ static flags = {
29
+ 'target-org': Flags.requiredOrg(),
30
+ 'api-version': Flags.orgApiVersion(),
31
+ 'parent-work-item-id': Flags.salesforceId({
32
+ summary: messages.getMessage('flags.parent-work-item-id.summary'),
33
+ description: messages.getMessage('flags.parent-work-item-id.description'),
34
+ required: true,
35
+ startsWith: '1fk',
36
+ char: undefined,
37
+ }),
38
+ 'child-work-item-id': Flags.salesforceId({
39
+ summary: messages.getMessage('flags.child-work-item-id.summary'),
40
+ description: messages.getMessage('flags.child-work-item-id.description'),
41
+ required: true,
42
+ multiple: true,
43
+ startsWith: '1fk',
44
+ char: undefined,
45
+ }),
46
+ 'target-stage-id': Flags.salesforceId({
47
+ summary: messages.getMessage('flags.target-stage-id.summary'),
48
+ char: 't',
49
+ required: true,
50
+ startsWith: '1QV',
51
+ }),
52
+ };
53
+ async run() {
54
+ const { flags } = await this.parse(DevopsWorkItemCombine);
55
+ const org = flags['target-org'];
56
+ const connection = org.getConnection(flags['api-version']);
57
+ const parentWorkItemId = flags['parent-work-item-id'];
58
+ const childWorkItemIds = flags['child-work-item-id'];
59
+ let pipelineId;
60
+ let sourceStageId;
61
+ try {
62
+ const { projectId, pipelineStageId } = await resolveProjectIdFromWorkItem(connection, parentWorkItemId);
63
+ sourceStageId = pipelineStageId;
64
+ pipelineId = await getPipelineIdForProject(connection, projectId);
65
+ }
66
+ catch (error) {
67
+ const errMsg = error instanceof Error ? error.message : String(error);
68
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
69
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
70
+ }
71
+ throw error;
72
+ }
73
+ if (!pipelineId) {
74
+ this.error(messages.getMessage('error.NoPipeline'));
75
+ }
76
+ let result;
77
+ try {
78
+ result = await combineWorkItemsPrepare({
79
+ connection,
80
+ pipelineId,
81
+ parentWorkItemId,
82
+ childWorkItemIds,
83
+ sourceStageId,
84
+ targetStageId: flags['target-stage-id'],
85
+ });
86
+ }
87
+ catch (error) {
88
+ const errMsg = error instanceof Error ? error.message : String(error);
89
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
90
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
91
+ }
92
+ throw error;
93
+ }
94
+ if (result.success) {
95
+ this.log('Work items prepared for custom promotion.');
96
+ this.log(` Request Token: ${result.requestToken ?? ''}`);
97
+ this.log('');
98
+ this.log('To complete the promotion, run:');
99
+ this.log(` sf devops work-item promote --target-org ${org.getUsername() ?? '<org>'} --work-item-id ${parentWorkItemId} --target-stage-id ${flags['target-stage-id']}`);
100
+ }
101
+ else {
102
+ this.log('Failed to prepare work items for custom promotion.');
103
+ this.log(` Error Code: ${result.errorCode ?? ''}`);
104
+ this.log(` Error Message: ${result.errorMessage ?? ''}`);
105
+ }
106
+ return result;
107
+ }
108
+ }
109
+ //# sourceMappingURL=combine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combine.js","sourceRoot":"","sources":["../../../../src/commands/devops/work-item/combine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAiC,MAAM,oCAAoC,CAAC;AAC5G,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,0BAA0B,CAAC,CAAC;AACvG,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,SAAwC;IAClF,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,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AI,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAC3E,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,CAAC;YAC7E,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;YACtD,IAAI,CAAC,GAAG,CAAC,oBAAoB,MAAM,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1D,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;YAC5C,IAAI,CAAC,GAAG,CACN,8CACE,GAAG,CAAC,WAAW,EAAE,IAAI,OACvB,mBAAmB,gBAAgB,sBAAsB,KAAK,CAAC,iBAAiB,CAAC,EAAE,CACpF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;YAC/D,IAAI,CAAC,GAAG,CAAC,oBAAoB,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,oBAAoB,MAAM,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { PrepareWorkItemResult } from '../../../utils/prepareWorkItem.js';
3
+ export default class DevopsWorkItemPrepare extends SfCommand<PrepareWorkItemResult> {
4
+ static readonly summary: string;
5
+ static readonly description: string;
6
+ static readonly examples: string[];
7
+ static readonly flags: {
8
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'work-item-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'target-stage-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ };
13
+ run(): Promise<PrepareWorkItemResult>;
14
+ }