@salesforce/plugin-devops-center 1.2.27 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/LICENSE.txt +200 -6
  2. package/README.md +515 -19
  3. package/bin/dev.js +15 -0
  4. package/bin/run.js +5 -0
  5. package/lib/commands/devops/pipeline/activate.d.ts +14 -0
  6. package/lib/commands/devops/pipeline/activate.js +82 -0
  7. package/lib/commands/devops/pipeline/activate.js.map +1 -0
  8. package/lib/commands/devops/pipeline/attach-project.d.ts +15 -0
  9. package/lib/commands/devops/pipeline/attach-project.js +82 -0
  10. package/lib/commands/devops/pipeline/attach-project.js.map +1 -0
  11. package/lib/commands/devops/pipeline/create.d.ts +23 -0
  12. package/lib/commands/devops/pipeline/create.js +136 -0
  13. package/lib/commands/devops/pipeline/create.js.map +1 -0
  14. package/lib/commands/devops/pipeline/stage/add.d.ts +16 -0
  15. package/lib/commands/devops/pipeline/stage/add.js +94 -0
  16. package/lib/commands/devops/pipeline/stage/add.js.map +1 -0
  17. package/lib/commands/devops/project/create.d.ts +15 -0
  18. package/lib/commands/devops/project/create.js +72 -0
  19. package/lib/commands/devops/project/create.js.map +1 -0
  20. package/lib/commands/devops/project/list.d.ts +20 -0
  21. package/lib/commands/devops/project/list.js +59 -0
  22. package/lib/commands/devops/project/list.js.map +1 -0
  23. package/lib/commands/devops/pull-request/create.d.ts +17 -0
  24. package/lib/commands/devops/pull-request/create.js +104 -0
  25. package/lib/commands/devops/pull-request/create.js.map +1 -0
  26. package/lib/commands/devops/stage/add-branch.d.ts +17 -0
  27. package/lib/commands/devops/stage/add-branch.js +110 -0
  28. package/lib/commands/devops/stage/add-branch.js.map +1 -0
  29. package/lib/commands/devops/stage/add-environment.d.ts +18 -0
  30. package/lib/commands/devops/stage/add-environment.js +136 -0
  31. package/lib/commands/devops/stage/add-environment.js.map +1 -0
  32. package/lib/commands/devops/work-item/create.d.ts +16 -0
  33. package/lib/commands/devops/work-item/create.js +76 -0
  34. package/lib/commands/devops/work-item/create.js.map +1 -0
  35. package/lib/commands/devops/work-item/list.d.ts +17 -0
  36. package/lib/commands/devops/work-item/list.js +72 -0
  37. package/lib/commands/devops/work-item/list.js.map +1 -0
  38. package/lib/commands/devops/work-item/status/update.d.ts +16 -0
  39. package/lib/commands/devops/work-item/status/update.js +90 -0
  40. package/lib/commands/devops/work-item/status/update.js.map +1 -0
  41. package/lib/commands/project/deploy/pipeline/quick.d.ts +2 -2
  42. package/lib/commands/project/deploy/pipeline/quick.js +24 -21
  43. package/lib/commands/project/deploy/pipeline/quick.js.map +1 -1
  44. package/lib/commands/project/deploy/pipeline/report.d.ts +4 -4
  45. package/lib/commands/project/deploy/pipeline/report.js +38 -35
  46. package/lib/commands/project/deploy/pipeline/report.js.map +1 -1
  47. package/lib/commands/project/deploy/pipeline/resume.d.ts +2 -2
  48. package/lib/commands/project/deploy/pipeline/resume.js +24 -21
  49. package/lib/commands/project/deploy/pipeline/resume.js.map +1 -1
  50. package/lib/commands/project/deploy/pipeline/start.d.ts +3 -3
  51. package/lib/commands/project/deploy/pipeline/start.js +26 -23
  52. package/lib/commands/project/deploy/pipeline/start.js.map +1 -1
  53. package/lib/commands/project/deploy/pipeline/validate.d.ts +3 -3
  54. package/lib/commands/project/deploy/pipeline/validate.js +24 -21
  55. package/lib/commands/project/deploy/pipeline/validate.js.map +1 -1
  56. package/lib/common/base/abstractAsyncOperation.d.ts +3 -3
  57. package/lib/common/base/abstractAsyncOperation.js +31 -23
  58. package/lib/common/base/abstractAsyncOperation.js.map +1 -1
  59. package/lib/common/base/abstractPromote.d.ts +5 -4
  60. package/lib/common/base/abstractPromote.js +52 -38
  61. package/lib/common/base/abstractPromote.js.map +1 -1
  62. package/lib/common/base/abstractQuick.d.ts +4 -3
  63. package/lib/common/base/abstractQuick.js +44 -43
  64. package/lib/common/base/abstractQuick.js.map +1 -1
  65. package/lib/common/base/abstractReportOnPromote.d.ts +2 -1
  66. package/lib/common/base/abstractReportOnPromote.js +31 -24
  67. package/lib/common/base/abstractReportOnPromote.js.map +1 -1
  68. package/lib/common/base/abstractResume.d.ts +3 -2
  69. package/lib/common/base/abstractResume.js +40 -33
  70. package/lib/common/base/abstractResume.js.map +1 -1
  71. package/lib/common/constants.js +19 -13
  72. package/lib/common/constants.js.map +1 -1
  73. package/lib/common/deployPipelineCache.js +20 -15
  74. package/lib/common/deployPipelineCache.js.map +1 -1
  75. package/lib/common/flags/flags.d.ts +2 -2
  76. package/lib/common/flags/flags.js +34 -29
  77. package/lib/common/flags/flags.js.map +1 -1
  78. package/lib/common/flags/promote/promoteFlags.d.ts +3 -3
  79. package/lib/common/flags/promote/promoteFlags.js +26 -20
  80. package/lib/common/flags/promote/promoteFlags.js.map +1 -1
  81. package/lib/common/index.d.ts +3 -2
  82. package/lib/common/index.js +2 -17
  83. package/lib/common/index.js.map +1 -1
  84. package/lib/common/outputColumns.d.ts +3 -13
  85. package/lib/common/outputColumns.js +23 -19
  86. package/lib/common/outputColumns.js.map +1 -1
  87. package/lib/common/outputService/aorOutputService.d.ts +4 -4
  88. package/lib/common/outputService/aorOutputService.js +27 -20
  89. package/lib/common/outputService/aorOutputService.js.map +1 -1
  90. package/lib/common/outputService/deployCommandOutputService.d.ts +2 -2
  91. package/lib/common/outputService/deployCommandOutputService.js +17 -12
  92. package/lib/common/outputService/deployCommandOutputService.js.map +1 -1
  93. package/lib/common/outputService/deploySummaryBuilder.d.ts +1 -1
  94. package/lib/common/outputService/deploySummaryBuilder.js +45 -31
  95. package/lib/common/outputService/deploySummaryBuilder.js.map +1 -1
  96. package/lib/common/outputService/deploymentResultOutputService.d.ts +4 -4
  97. package/lib/common/outputService/deploymentResultOutputService.js +16 -10
  98. package/lib/common/outputService/deploymentResultOutputService.js.map +1 -1
  99. package/lib/common/outputService/index.d.ts +8 -6
  100. package/lib/common/outputService/index.js +5 -19
  101. package/lib/common/outputService/index.js.map +1 -1
  102. package/lib/common/outputService/outputService.d.ts +6 -4
  103. package/lib/common/outputService/outputService.js +20 -14
  104. package/lib/common/outputService/outputService.js.map +1 -1
  105. package/lib/common/outputService/outputServiceFactory.d.ts +8 -8
  106. package/lib/common/outputService/outputServiceFactory.js +21 -16
  107. package/lib/common/outputService/outputServiceFactory.js.map +1 -1
  108. package/lib/common/outputService/outputUtils.d.ts +1 -1
  109. package/lib/common/outputService/outputUtils.js +24 -19
  110. package/lib/common/outputService/outputUtils.js.map +1 -1
  111. package/lib/common/outputService/promoteOutputService.d.ts +4 -5
  112. package/lib/common/outputService/promoteOutputService.js +19 -13
  113. package/lib/common/outputService/promoteOutputService.js.map +1 -1
  114. package/lib/common/outputService/reportOutputService.d.ts +5 -6
  115. package/lib/common/outputService/reportOutputService.js +32 -27
  116. package/lib/common/outputService/reportOutputService.js.map +1 -1
  117. package/lib/common/outputService/resumeCommandOutputService.d.ts +3 -3
  118. package/lib/common/outputService/resumeCommandOutputService.js +19 -13
  119. package/lib/common/outputService/resumeCommandOutputService.js.map +1 -1
  120. package/lib/common/outputService/resumeOutputService.d.ts +3 -3
  121. package/lib/common/outputService/resumeOutputService.js +23 -17
  122. package/lib/common/outputService/resumeOutputService.js.map +1 -1
  123. package/lib/common/selectors/asyncOperationResultsSelector.d.ts +1 -1
  124. package/lib/common/selectors/asyncOperationResultsSelector.js +16 -10
  125. package/lib/common/selectors/asyncOperationResultsSelector.js.map +1 -1
  126. package/lib/common/selectors/deployComponentsSelector.d.ts +1 -1
  127. package/lib/common/selectors/deployComponentsSelector.js +18 -13
  128. package/lib/common/selectors/deployComponentsSelector.js.map +1 -1
  129. package/lib/common/selectors/deployProgressSummarySelector.d.ts +2 -2
  130. package/lib/common/selectors/deployProgressSummarySelector.js +16 -10
  131. package/lib/common/selectors/deployProgressSummarySelector.js.map +1 -1
  132. package/lib/common/selectors/deploymentResultsSelector.d.ts +2 -2
  133. package/lib/common/selectors/deploymentResultsSelector.js +20 -16
  134. package/lib/common/selectors/deploymentResultsSelector.js.map +1 -1
  135. package/lib/common/selectors/environmentSelector.d.ts +2 -2
  136. package/lib/common/selectors/environmentSelector.js +16 -10
  137. package/lib/common/selectors/environmentSelector.js.map +1 -1
  138. package/lib/common/selectors/namedCredentialSelector.d.ts +1 -1
  139. package/lib/common/selectors/namedCredentialSelector.js +16 -10
  140. package/lib/common/selectors/namedCredentialSelector.js.map +1 -1
  141. package/lib/common/selectors/pipelineStageSelector.d.ts +1 -1
  142. package/lib/common/selectors/pipelineStageSelector.js +18 -13
  143. package/lib/common/selectors/pipelineStageSelector.js.map +1 -1
  144. package/lib/common/selectors/selectorUtils.d.ts +1 -1
  145. package/lib/common/selectors/selectorUtils.js +17 -11
  146. package/lib/common/selectors/selectorUtils.js.map +1 -1
  147. package/lib/common/selectors/validateDeploySelector.d.ts +1 -1
  148. package/lib/common/selectors/validateDeploySelector.js +16 -10
  149. package/lib/common/selectors/validateDeploySelector.js.map +1 -1
  150. package/lib/common/selectors/workItemSelector.d.ts +2 -2
  151. package/lib/common/selectors/workItemSelector.js +16 -10
  152. package/lib/common/selectors/workItemSelector.js.map +1 -1
  153. package/lib/common/types.d.ts +4 -4
  154. package/lib/common/types.js +4 -7
  155. package/lib/common/types.js.map +1 -1
  156. package/lib/common/utils.d.ts +4 -4
  157. package/lib/common/utils.js +42 -43
  158. package/lib/common/utils.js.map +1 -1
  159. package/lib/configMeta.js +21 -15
  160. package/lib/configMeta.js.map +1 -1
  161. package/lib/streamer/doceMonitor.d.ts +3 -2
  162. package/lib/streamer/doceMonitor.js +14 -6
  163. package/lib/streamer/doceMonitor.js.map +1 -1
  164. package/lib/streamer/doceStream.d.ts +1 -1
  165. package/lib/streamer/doceStream.js +19 -11
  166. package/lib/streamer/doceStream.js.map +1 -1
  167. package/lib/streamer/processors/asyncOpStream.d.ts +2 -2
  168. package/lib/streamer/processors/asyncOpStream.js +22 -15
  169. package/lib/streamer/processors/asyncOpStream.js.map +1 -1
  170. package/lib/streamer/sObjectStream.d.ts +1 -1
  171. package/lib/streamer/sObjectStream.js +9 -10
  172. package/lib/streamer/sObjectStream.js.map +1 -1
  173. package/lib/utils/activatePipeline.d.ts +17 -0
  174. package/lib/utils/activatePipeline.js +35 -0
  175. package/lib/utils/activatePipeline.js.map +1 -0
  176. package/lib/utils/addPipelineStage.d.ts +20 -0
  177. package/lib/utils/addPipelineStage.js +43 -0
  178. package/lib/utils/addPipelineStage.js.map +1 -0
  179. package/lib/utils/addStageBranch.d.ts +22 -0
  180. package/lib/utils/addStageBranch.js +48 -0
  181. package/lib/utils/addStageBranch.js.map +1 -0
  182. package/lib/utils/addStageEnvironment.d.ts +92 -0
  183. package/lib/utils/addStageEnvironment.js +120 -0
  184. package/lib/utils/addStageEnvironment.js.map +1 -0
  185. package/lib/utils/attachProject.d.ts +21 -0
  186. package/lib/utils/attachProject.js +44 -0
  187. package/lib/utils/attachProject.js.map +1 -0
  188. package/lib/utils/createPipeline.d.ts +34 -0
  189. package/lib/utils/createPipeline.js +77 -0
  190. package/lib/utils/createPipeline.js.map +1 -0
  191. package/lib/utils/createProject.d.ts +17 -0
  192. package/lib/utils/createProject.js +39 -0
  193. package/lib/utils/createProject.js.map +1 -0
  194. package/lib/utils/createPullRequest.d.ts +49 -0
  195. package/lib/utils/createPullRequest.js +204 -0
  196. package/lib/utils/createPullRequest.js.map +1 -0
  197. package/lib/utils/createWorkItem.d.ts +19 -0
  198. package/lib/utils/createWorkItem.js +58 -0
  199. package/lib/utils/createWorkItem.js.map +1 -0
  200. package/lib/utils/pipelineUtils.d.ts +8 -0
  201. package/lib/utils/pipelineUtils.js +51 -0
  202. package/lib/utils/pipelineUtils.js.map +1 -0
  203. package/lib/utils/types.d.ts +57 -0
  204. package/lib/utils/types.js +17 -0
  205. package/lib/utils/types.js.map +1 -0
  206. package/lib/utils/updateWorkItemStatus.d.ts +34 -0
  207. package/lib/utils/updateWorkItemStatus.js +71 -0
  208. package/lib/utils/updateWorkItemStatus.js.map +1 -0
  209. package/lib/utils/workItems.d.ts +3 -0
  210. package/lib/utils/workItems.js +181 -0
  211. package/lib/utils/workItems.js.map +1 -0
  212. package/messages/commonErrors.md +5 -1
  213. package/messages/devops.pipeline.activate.md +29 -0
  214. package/messages/devops.pipeline.attach-project.md +29 -0
  215. package/messages/devops.pipeline.create.md +81 -0
  216. package/messages/devops.pipeline.stage.add.md +37 -0
  217. package/messages/devops.project.create.md +29 -0
  218. package/messages/devops.project.list.md +17 -0
  219. package/messages/devops.pull-request.create.md +57 -0
  220. package/messages/devops.stage.add-branch.md +46 -0
  221. package/messages/devops.stage.add-environment.md +61 -0
  222. package/messages/devops.work-item.create.md +29 -0
  223. package/messages/devops.work-item.list.md +21 -0
  224. package/messages/devops.work-item.status.update.md +29 -0
  225. package/npm-shrinkwrap.json +4197 -4471
  226. package/oclif.lock +3380 -3272
  227. package/oclif.manifest.json +1056 -11
  228. package/package.json +53 -23
  229. package/schemas/devops-pipeline-activate.json +28 -0
  230. package/schemas/devops-pipeline-attach__project.json +25 -0
  231. package/schemas/devops-pipeline-create.json +50 -0
  232. package/schemas/devops-pipeline-stage-add.json +31 -0
  233. package/schemas/devops-project-create.json +28 -0
  234. package/schemas/devops-project-list.json +35 -0
  235. package/schemas/devops-pull__request-create.json +34 -0
  236. package/schemas/devops-stage-add__branch.json +34 -0
  237. package/schemas/devops-stage-add__environment.json +47 -0
  238. package/schemas/devops-work__item-create.json +28 -0
  239. package/schemas/devops-work__item-list.json +75 -0
  240. package/schemas/devops-work__item-status-update.json +28 -0
  241. package/schemas/project-deploy-pipeline-report.json +2 -2
@@ -0,0 +1,59 @@
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
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
19
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.project.list');
20
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
21
+ export default class DevopsProjectList extends SfCommand {
22
+ static summary = messages.getMessage('summary');
23
+ static description = messages.getMessage('description');
24
+ static examples = messages.getMessages('examples');
25
+ static flags = {
26
+ 'target-org': Flags.requiredOrg(),
27
+ 'api-version': Flags.orgApiVersion(),
28
+ };
29
+ async run() {
30
+ const { flags } = await this.parse(DevopsProjectList);
31
+ const org = flags['target-org'];
32
+ const connection = org.getConnection(flags['api-version']);
33
+ let projects;
34
+ try {
35
+ const query = 'SELECT Id, Name, Description FROM DevopsProject';
36
+ const result = await connection.query(query);
37
+ projects = result.records ?? [];
38
+ }
39
+ catch (error) {
40
+ const errMsg = error instanceof Error ? error.message : String(error);
41
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
42
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
43
+ }
44
+ throw error;
45
+ }
46
+ if (projects.length === 0) {
47
+ this.log('No DevOps Center projects found in this org.');
48
+ }
49
+ else {
50
+ this.styledHeader('DevOps Center Projects');
51
+ this.table({
52
+ data: projects,
53
+ columns: ['Id', 'Name', 'Description'],
54
+ });
55
+ }
56
+ return { projects };
57
+ }
58
+ }
59
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/devops/project/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK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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,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,YAAY,CAAC,wBAAwB,CAAC,CAAC;YAC5C,IAAI,CAAC,KAAK,CAAC;gBACT,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC;aACvC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,CAAC;IACtB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Org } from '@salesforce/core';
2
+ import { SfCommand } from '@salesforce/sf-plugins-core';
3
+ import { CreatePullRequestResult } from '../../../utils/createPullRequest.js';
4
+ export default class DevopsPullRequestCreate extends SfCommand<CreatePullRequestResult> {
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
+ 'work-item-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
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
+ };
16
+ run(): Promise<CreatePullRequestResult>;
17
+ }
@@ -0,0 +1,104 @@
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 { createPullRequest, fetchWorkItemDetail, resolveGitHubToken, } from '../../../utils/createPullRequest.js';
19
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pull-request.create');
21
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
22
+ export default class DevopsPullRequestCreate 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
+ 'work-item-name': Flags.string({
30
+ summary: messages.getMessage('flags.work-item-name.summary'),
31
+ char: 'n',
32
+ exactlyOne: ['work-item-name', 'work-item-id'],
33
+ }),
34
+ 'work-item-id': Flags.salesforceId({
35
+ summary: messages.getMessage('flags.work-item-id.summary'),
36
+ char: 'w',
37
+ exactlyOne: ['work-item-name', 'work-item-id'],
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
+ };
46
+ async run() {
47
+ const { flags } = await this.parse(DevopsPullRequestCreate);
48
+ const org = flags['target-org'];
49
+ const connection = org.getConnection(flags['api-version']);
50
+ const filter = flags['work-item-name'] ? { name: flags['work-item-name'] } : { id: flags['work-item-id'] };
51
+ let detail;
52
+ try {
53
+ detail = await fetchWorkItemDetail(connection, filter);
54
+ }
55
+ catch (error) {
56
+ const errMsg = error instanceof Error ? error.message : String(error);
57
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
58
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
59
+ }
60
+ throw error;
61
+ }
62
+ if (!detail.branchName) {
63
+ this.error(messages.getMessage('error.NoBranch', [detail.workItemName]));
64
+ }
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
+ });
95
+ if (result.success) {
96
+ 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}`);
100
+ }
101
+ return result;
102
+ }
103
+ }
104
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/devops/pull-request/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,EACnB,kBAAkB,GAEnB,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,4BAA4B,CAAC,CAAC;AACzG,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,SAAkC;IAC9E,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,CAAC,aAAa,EAAE;QACpC,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC;YAC7B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,8BAA8B,CAAC;YAC5D,IAAI,EAAE,GAAG;YACT,UAAU,EAAE,CAAC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AAC,eAAe,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;QAEjD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC;YACrC,KAAK,EAAE,MAAM,CAAC,SAAS;YACvB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,IAAI,EAAE,MAAM,CAAC,UAAU;YACvB,IAAI,EAAE,MAAM,CAAC,YAAY;YACzB,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,KAAK;SACN,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,yCAAyC,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC;YAC1E,IAAI,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,KAAK,IAAI,OAAO,EAAE,CAAC,CAAC;YAChD,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC;YACvC,IAAI,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,YAAY,MAAM,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;QAC/F,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Org } from '@salesforce/core';
2
+ import { SfCommand } from '@salesforce/sf-plugins-core';
3
+ import { AddStageBranchResult } from '../../../utils/addStageBranch.js';
4
+ export default class DevopsStageAddBranch extends SfCommand<AddStageBranchResult> {
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
+ 'stage-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'branch-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'create-vcs-branch': import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ };
16
+ run(): Promise<AddStageBranchResult>;
17
+ }
@@ -0,0 +1,110 @@
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 { addStageBranch } from '../../../utils/addStageBranch.js';
19
+ import { fetchPipelineStages } from '../../../utils/pipelineUtils.js';
20
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
21
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.stage.add-branch');
22
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
23
+ export default class DevopsStageAddBranch extends SfCommand {
24
+ static summary = messages.getMessage('summary');
25
+ static description = messages.getMessage('description');
26
+ static examples = messages.getMessages('examples');
27
+ static flags = {
28
+ 'target-org': Flags.requiredOrg(),
29
+ 'api-version': Flags.orgApiVersion(),
30
+ 'pipeline-id': Flags.salesforceId({
31
+ summary: messages.getMessage('flags.pipeline-id.summary'),
32
+ required: true,
33
+ char: undefined,
34
+ }),
35
+ 'stage-id': Flags.salesforceId({
36
+ summary: messages.getMessage('flags.stage-id.summary'),
37
+ required: true,
38
+ char: undefined,
39
+ }),
40
+ 'branch-name': Flags.string({
41
+ summary: messages.getMessage('flags.branch-name.summary'),
42
+ required: true,
43
+ char: 'b',
44
+ }),
45
+ 'create-vcs-branch': Flags.boolean({
46
+ summary: messages.getMessage('flags.create-vcs-branch.summary'),
47
+ default: false,
48
+ }),
49
+ };
50
+ async run() {
51
+ const { flags } = await this.parse(DevopsStageAddBranch);
52
+ const org = flags['target-org'];
53
+ const connection = org.getConnection(flags['api-version']);
54
+ const pipelineId = flags['pipeline-id'];
55
+ const stageId = flags['stage-id'];
56
+ let stages;
57
+ try {
58
+ stages = await fetchPipelineStages(connection, pipelineId);
59
+ }
60
+ catch (error) {
61
+ const errMsg = error instanceof Error ? error.message : String(error);
62
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
63
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
64
+ }
65
+ throw error;
66
+ }
67
+ const targetStage = stages.find((s) => s.Id === stageId);
68
+ if (!targetStage) {
69
+ this.error(messages.getMessage('error.StageNotFound', [stageId, pipelineId]));
70
+ }
71
+ // Enforce right-to-left branch setup order: the next stage (to the right)
72
+ // must already have a branch before this stage can be configured.
73
+ if (targetStage.NextStageId) {
74
+ const nextStage = stages.find((s) => s.Id === targetStage.NextStageId);
75
+ if (nextStage && !nextStage.SourceCodeRepositoryBranch?.Name) {
76
+ this.error(messages.getMessage('error.NextStageNoBranch', [nextStage.Name ?? nextStage.Id, stageId]));
77
+ }
78
+ }
79
+ let result;
80
+ try {
81
+ result = await addStageBranch({
82
+ connection,
83
+ pipelineId,
84
+ stageId,
85
+ branchName: flags['branch-name'],
86
+ createVcsBranch: flags['create-vcs-branch'],
87
+ });
88
+ }
89
+ catch (error) {
90
+ const errMsg = error instanceof Error ? error.message : String(error);
91
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
92
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
93
+ }
94
+ throw error;
95
+ }
96
+ if (result.success) {
97
+ const action = result.branchCreated ? 'Created branch and associated it' : 'Successfully associated branch';
98
+ this.log(`${action} with the stage.`);
99
+ this.log(` Stage ID: ${stageId}`);
100
+ this.log(` Branch: ${result.branchName ?? ''}${result.branchCreated ? ' (newly created)' : ''}`);
101
+ this.log(` Repo Branch ID: ${result.repoBranchId ?? ''}`);
102
+ this.log(` Pipeline ID: ${pipelineId}`);
103
+ }
104
+ else {
105
+ this.error(messages.getMessage('error.BranchAttachFailed', [result.error ?? '']));
106
+ }
107
+ return result;
108
+ }
109
+ }
110
+ //# sourceMappingURL=add-branch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-branch.js","sourceRoot":"","sources":["../../../../src/commands/devops/stage/add-branch.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,cAAc,EAAwB,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,yBAAyB,CAAC,CAAC;AACtG,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,SAA+B;IACxE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAA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AC,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"}
@@ -0,0 +1,18 @@
1
+ import { Org } from '@salesforce/core';
2
+ import { SfCommand } from '@salesforce/sf-plugins-core';
3
+ import { AddStageEnvironmentResult } from '../../../utils/addStageEnvironment.js';
4
+ export default class DevopsStageAddEnvironment extends SfCommand<AddStageEnvironmentResult> {
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
+ 'stage-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'environment-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'org-type': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'no-browser': import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ };
17
+ run(): Promise<AddStageEnvironmentResult>;
18
+ }
@@ -0,0 +1,136 @@
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 { exec } from 'node:child_process';
17
+ import { Messages } from '@salesforce/core';
18
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
+ import { addStageEnvironment } from '../../../utils/addStageEnvironment.js';
20
+ import { fetchPipelineStages } from '../../../utils/pipelineUtils.js';
21
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.stage.add-environment');
23
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
24
+ function openUrl(url) {
25
+ const platform = process.platform;
26
+ const cmd = platform === 'darwin' ? 'open' : platform === 'win32' ? 'start' : 'xdg-open';
27
+ exec(`${cmd} "${url}"`);
28
+ }
29
+ function decodeRedirectUrl(url) {
30
+ return url.replace(/&amp;/g, '&');
31
+ }
32
+ export default class DevopsStageAddEnvironment extends SfCommand {
33
+ static summary = messages.getMessage('summary');
34
+ static description = messages.getMessage('description');
35
+ static examples = messages.getMessages('examples');
36
+ static flags = {
37
+ 'target-org': Flags.requiredOrg(),
38
+ 'api-version': Flags.orgApiVersion(),
39
+ 'pipeline-id': Flags.salesforceId({
40
+ summary: messages.getMessage('flags.pipeline-id.summary'),
41
+ required: true,
42
+ char: undefined,
43
+ }),
44
+ 'stage-id': Flags.salesforceId({
45
+ summary: messages.getMessage('flags.stage-id.summary'),
46
+ required: true,
47
+ char: undefined,
48
+ }),
49
+ 'environment-name': Flags.string({
50
+ summary: messages.getMessage('flags.environment-name.summary'),
51
+ required: true,
52
+ char: 'e',
53
+ }),
54
+ 'org-type': Flags.string({
55
+ summary: messages.getMessage('flags.org-type.summary'),
56
+ required: true,
57
+ options: ['Production', 'Sandbox'],
58
+ }),
59
+ 'no-browser': Flags.boolean({
60
+ summary: messages.getMessage('flags.no-browser.summary'),
61
+ default: false,
62
+ }),
63
+ };
64
+ async run() {
65
+ const { flags } = await this.parse(DevopsStageAddEnvironment);
66
+ const org = flags['target-org'];
67
+ const connection = org.getConnection(flags['api-version']);
68
+ const pipelineId = flags['pipeline-id'];
69
+ const stageId = flags['stage-id'];
70
+ const environmentName = flags['environment-name'];
71
+ const orgType = flags['org-type'];
72
+ const noBrowser = flags['no-browser'];
73
+ let stages;
74
+ try {
75
+ stages = await fetchPipelineStages(connection, pipelineId);
76
+ }
77
+ catch (error) {
78
+ const errMsg = error instanceof Error ? error.message : String(error);
79
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
80
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
81
+ }
82
+ throw error;
83
+ }
84
+ if (!stages.some((s) => s.Id === stageId)) {
85
+ this.error(messages.getMessage('error.StageNotFound', [stageId, pipelineId]));
86
+ }
87
+ let result;
88
+ try {
89
+ result = await addStageEnvironment({
90
+ connection,
91
+ pipelineId,
92
+ stageId,
93
+ environmentName,
94
+ orgType,
95
+ onCreated: (data) => {
96
+ const url = decodeRedirectUrl(data.redirectUrl);
97
+ if (!noBrowser) {
98
+ openUrl(url);
99
+ this.log(messages.getMessage('info.BrowserOpened'));
100
+ }
101
+ else {
102
+ this.log(messages.getMessage('info.ManualAuth', [url]));
103
+ }
104
+ this.spinner.start(messages.getMessage('info.WaitingForAuth'));
105
+ },
106
+ });
107
+ }
108
+ catch (error) {
109
+ const errMsg = error instanceof Error ? error.message : String(error);
110
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
111
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
112
+ }
113
+ if (errMsg.includes('timed out')) {
114
+ this.error(messages.getMessage('error.AuthTimeout'));
115
+ }
116
+ throw error;
117
+ }
118
+ finally {
119
+ this.spinner.stop();
120
+ }
121
+ if (result.success) {
122
+ this.log(messages.getMessage('info.Success'));
123
+ this.log(` Stage ID: ${stageId}`);
124
+ this.log(` Environment ID: ${result.environmentId ?? ''}`);
125
+ this.log(` Environment Name: ${result.environmentName ?? ''}`);
126
+ this.log(` Org Type: ${orgType}`);
127
+ this.log(` Pipeline ID: ${pipelineId}`);
128
+ this.log(` Organization ID: ${result.organizationId ?? ''}`);
129
+ }
130
+ else {
131
+ this.error(messages.getMessage('error.EnvironmentAttachFailed', [result.error ?? '']));
132
+ }
133
+ return result;
134
+ }
135
+ }
136
+ //# sourceMappingURL=add-environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-environment.js","sourceRoot":"","sources":["../../../../src/commands/devops/stage/add-environment.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,uCAAuC,CAAC;AAChH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,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,MAAM,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IACzF,IAAI,CAAC,GAAG,GAAG,KAAK,GAAG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,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBACjC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC;YACvD,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;YAC3C,IAAI,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,aAAa,IAAI,EAAE,EAAE,CAAC,CAAC;YAC9D,IAAI,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,eAAe,IAAI,EAAE,EAAE,CAAC,CAAC;YAChE,IAAI,CAAC,GAAG,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;YAC3C,IAAI,CAAC,GAAG,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,16 @@
1
+ import { Org } from '@salesforce/core';
2
+ import { SfCommand } from '@salesforce/sf-plugins-core';
3
+ import { CreateWorkItemResult } from '../../../utils/createWorkItem.js';
4
+ export default class DevopsWorkItemCreate extends SfCommand<CreateWorkItemResult> {
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
+ 'project-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ subject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ };
15
+ run(): Promise<CreateWorkItemResult>;
16
+ }
@@ -0,0 +1,76 @@
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 { createWorkItem } from '../../../utils/createWorkItem.js';
19
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
+ const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.work-item.create');
21
+ const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
22
+ export default class DevopsWorkItemCreate 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
+ 'project-id': Flags.salesforceId({
30
+ summary: messages.getMessage('flags.project-id.summary'),
31
+ char: 'p',
32
+ required: true,
33
+ startsWith: '1Qg',
34
+ }),
35
+ subject: Flags.string({
36
+ summary: messages.getMessage('flags.subject.summary'),
37
+ char: 's',
38
+ required: true,
39
+ }),
40
+ description: Flags.string({
41
+ summary: messages.getMessage('flags.description.summary'),
42
+ char: 'd',
43
+ }),
44
+ };
45
+ async run() {
46
+ const { flags } = await this.parse(DevopsWorkItemCreate);
47
+ const org = flags['target-org'];
48
+ const connection = org.getConnection(flags['api-version']);
49
+ let result;
50
+ try {
51
+ result = await createWorkItem({
52
+ connection,
53
+ projectId: flags['project-id'],
54
+ subject: flags['subject'],
55
+ description: flags['description'] ?? '',
56
+ });
57
+ }
58
+ catch (error) {
59
+ const errMsg = error instanceof Error ? error.message : String(error);
60
+ if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
61
+ this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
62
+ }
63
+ throw error;
64
+ }
65
+ if (result.success) {
66
+ this.log(`Successfully created work item: ${result.workItemName ?? result.workItemId ?? ''}`);
67
+ this.log(` ID: ${result.workItemId ?? ''}`);
68
+ this.log(` Subject: ${result.subject ?? ''}`);
69
+ }
70
+ else {
71
+ this.error(`Failed to create work item: ${result.error ?? ''}`);
72
+ }
73
+ return result;
74
+ }
75
+ }
76
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/devops/work-item/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,EAAE,cAAc,EAAwB,MAAM,kCAAkC,CAAC;AAExF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D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from '@salesforce/core';
2
+ import { SfCommand } from '@salesforce/sf-plugins-core';
3
+ import { WorkItem } from '../../../utils/types.js';
4
+ export type DevopsWorkItemListResult = {
5
+ workItems: WorkItem[];
6
+ };
7
+ export default class DevopsWorkItemList extends SfCommand<DevopsWorkItemListResult> {
8
+ static readonly summary: string;
9
+ static readonly description: string;
10
+ static readonly examples: string[];
11
+ static readonly flags: {
12
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'project-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ };
16
+ run(): Promise<DevopsWorkItemListResult>;
17
+ }