Skip to content

Commit 9bfbb8f

Browse files
ad-shreyaclaude
andauthored
@W-23154741 - Crud commands for devops entities (#515)
* feat: project update command * chore: upadet command * feat: pipeline list and get commands Add devops pipeline list (all pipelines) and devops pipeline get (single pipeline with stages, repositories, and connected projects). Regenerate schemas for all existing commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: stage and environment delete * feat: pipeline project delete * feat: promotion status * chore: remove promotion status command * chore: update snapshot * fix: add SOQL injection validation to remaining utils Added validateSalesforceId() calls to 5 additional utility functions to prevent SOQL injection vulnerabilities: - prepareWorkItem.ts: validate workItemId in resolveProjectIdFromWorkItem - deleteStageEnvironment.ts: validate environmentId before query - getPipeline.ts: validate pipelineId before query - detachProject.ts: validate both projectId and pipelineId - stage/environment/delete.ts: document existing validation via Flags.salesforceId() All SOQL queries in the codebase now use either validateSalesforceId() for IDs or escapeSOQL() for string values, preventing injection attacks. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5850cba commit 9bfbb8f

36 files changed

Lines changed: 2400 additions & 22 deletions

command-snapshot.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@
2020
],
2121
"plugin": "@salesforce/plugin-devops-center"
2222
},
23+
{
24+
"alias": [],
25+
"command": "devops:pipeline:get",
26+
"flagAliases": [],
27+
"flagChars": ["i", "o"],
28+
"flags": ["api-version", "flags-dir", "json", "pipeline-id", "target-org"],
29+
"plugin": "@salesforce/plugin-devops-center"
30+
},
31+
{
32+
"alias": [],
33+
"command": "devops:pipeline:list",
34+
"flagAliases": [],
35+
"flagChars": ["o"],
36+
"flags": ["api-version", "flags-dir", "json", "target-org"],
37+
"plugin": "@salesforce/plugin-devops-center"
38+
},
2339
{
2440
"alias": [],
2541
"command": "devops:pipeline:project:add",
@@ -28,6 +44,14 @@
2844
"flags": ["api-version", "flags-dir", "json", "pipeline-id", "project-id", "target-org"],
2945
"plugin": "@salesforce/plugin-devops-center"
3046
},
47+
{
48+
"alias": [],
49+
"command": "devops:pipeline:project:delete",
50+
"flagAliases": [],
51+
"flagChars": ["o"],
52+
"flags": ["api-version", "flags-dir", "json", "pipeline-id", "project-id", "target-org"],
53+
"plugin": "@salesforce/plugin-devops-center"
54+
},
3155
{
3256
"alias": [],
3357
"command": "devops:pipeline:stage:add",
@@ -36,6 +60,14 @@
3660
"flags": ["api-version", "flags-dir", "json", "name", "next-stage-id", "pipeline-id", "target-org"],
3761
"plugin": "@salesforce/plugin-devops-center"
3862
},
63+
{
64+
"alias": [],
65+
"command": "devops:pipeline:stage:delete",
66+
"flagAliases": [],
67+
"flagChars": ["o"],
68+
"flags": ["api-version", "flags-dir", "json", "pipeline-id", "stage-id", "target-org"],
69+
"plugin": "@salesforce/plugin-devops-center"
70+
},
3971
{
4072
"alias": [],
4173
"command": "devops:pipeline:update",
@@ -60,6 +92,14 @@
6092
"flags": ["api-version", "flags-dir", "json", "target-org"],
6193
"plugin": "@salesforce/plugin-devops-center"
6294
},
95+
{
96+
"alias": [],
97+
"command": "devops:project:update",
98+
"flagAliases": [],
99+
"flagChars": ["d", "i", "n", "o"],
100+
"flags": ["api-version", "description", "flags-dir", "is-active", "json", "name", "project-id", "target-org"],
101+
"plugin": "@salesforce/plugin-devops-center"
102+
},
63103
{
64104
"alias": [],
65105
"command": "devops:promote",
@@ -148,6 +188,14 @@
148188
],
149189
"plugin": "@salesforce/plugin-devops-center"
150190
},
191+
{
192+
"alias": [],
193+
"command": "devops:stage:environment:delete",
194+
"flagAliases": [],
195+
"flagChars": ["e", "o"],
196+
"flags": ["api-version", "environment-id", "flags-dir", "json", "pipeline-id", "target-org"],
197+
"plugin": "@salesforce/plugin-devops-center"
198+
},
151199
{
152200
"alias": [],
153201
"command": "devops:work-item:combine",

messages/devops.pipeline.get.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# summary
2+
3+
Get details of a DevOps Center pipeline including its stages, repositories, and connected projects.
4+
5+
# description
6+
7+
Returns full details for a single DevOps Center pipeline: its stages in order, the source code repository and branch associated with each stage, and any connected projects.
8+
9+
# flags.pipeline-id.summary
10+
11+
ID of the DevOps Center pipeline.
12+
13+
# examples
14+
15+
- Get details for a specific pipeline:
16+
17+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --pipeline-id 0Do000000000001

messages/devops.pipeline.list.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# summary
2+
3+
List DevOps Center pipelines with their stages, repositories, and connected projects.
4+
5+
# description
6+
7+
Returns all DevOps Center pipelines in the org, including each pipeline's stages (in order), source code repository information per stage, and any connected projects.
8+
9+
# examples
10+
11+
- List all pipelines in the org:
12+
13+
<%= config.bin %> <%= command.id %> --target-org my-devops-org
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# summary
2+
3+
Remove a DevOps Center project's connection to a pipeline.
4+
5+
# description
6+
7+
Deletes the junction record that connects the project to the pipeline. The project itself is not deleted.
8+
9+
# flags.pipeline-id.summary
10+
11+
ID of the pipeline.
12+
13+
# flags.project-id.summary
14+
15+
ID of the DevOps Center project.
16+
17+
# examples
18+
19+
- Remove a project from a pipeline using the project ID and pipeline ID.
20+
21+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --pipeline-id 0XB000000000001 --project-id 0Hn000000000001
22+
23+
# error.ProjectNotAttached
24+
25+
Project %s is not attached to pipeline %s.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# summary
2+
3+
Delete a stage from a DevOps Center pipeline.
4+
5+
# description
6+
7+
Deletes the specified stage from the pipeline. If the stage sits between two other stages, the predecessor stage is automatically re-linked to the successor so the pipeline chain stays intact.
8+
9+
# flags.pipeline-id.summary
10+
11+
ID of the pipeline that contains the stage.
12+
13+
# flags.stage-id.summary
14+
15+
ID of the stage to delete.
16+
17+
# examples
18+
19+
- Delete a stage from a pipeline:
20+
21+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --pipeline-id 0XB000000000001 --stage-id 0Xc000000000002
22+
23+
# error.StageNotFound
24+
25+
Stage %s not found in pipeline %s. Check the stage ID and try again.

messages/devops.project.update.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# summary
2+
3+
Update a DevOps Center project.
4+
5+
# description
6+
7+
Update the name, description, or active status of a DevOps Center project. At least one of --name, --description, or --is-active must be provided.
8+
9+
# flags.project-id.summary
10+
11+
ID of the DevOps Center project to update.
12+
13+
# flags.name.summary
14+
15+
New name for the project.
16+
17+
# flags.description.summary
18+
19+
New description for the project.
20+
21+
# flags.is-active.summary
22+
23+
Set the project active status. Use --is-active to activate or --no-is-active to deactivate.
24+
25+
# examples
26+
27+
- Rename a project:
28+
29+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --project-id 1Qg000000000001 --name "MyApp Release v2"
30+
31+
- Update the description of a project:
32+
33+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --project-id 1Qg000000000001 --description "Updated release description"
34+
35+
- Deactivate a project:
36+
37+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --project-id 1Qg000000000001 --no-is-active
38+
39+
- Update all fields at once:
40+
41+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --project-id 1Qg000000000001 --name "Archived App" --description "Archived" --no-is-active
42+
43+
# error.NoFieldsProvided
44+
45+
Provide at least one of --name, --description, or --is-active/--no-is-active.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# summary
2+
3+
Delete an environment from a DevOps Center pipeline stage.
4+
5+
# description
6+
7+
Removes the specified environment from the pipeline stage. The environment must belong to an inactive pipeline.
8+
9+
# flags.pipeline-id.summary
10+
11+
ID of the pipeline. Used to verify the pipeline is inactive before deleting.
12+
13+
# flags.environment-id.summary
14+
15+
ID of the environment to delete.
16+
17+
# examples
18+
19+
- Delete an environment:
20+
21+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --pipeline-id 0XB000000000001 --environment-id 0Xe000000000001
22+
23+
# error.PipelineAlreadyActive
24+
25+
Pipeline %s is already active. Environments can only be removed from inactive pipelines.
26+
27+
# error.EnvironmentNotFound
28+
29+
Environment %s not found. Check the environment ID and try again.

schemas/devops-pipeline-get.json

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/PipelineGetResult",
4+
"definitions": {
5+
"PipelineGetResult": {
6+
"type": "object",
7+
"properties": {
8+
"id": {
9+
"type": "string"
10+
},
11+
"name": {
12+
"type": "string"
13+
},
14+
"description": {
15+
"type": ["string", "null"]
16+
},
17+
"isActive": {
18+
"type": "boolean"
19+
},
20+
"stages": {
21+
"type": "array",
22+
"items": {
23+
"$ref": "#/definitions/PipelineStageDetail"
24+
}
25+
},
26+
"connectedProjects": {
27+
"type": "array",
28+
"items": {
29+
"$ref": "#/definitions/ConnectedProject"
30+
}
31+
}
32+
},
33+
"required": ["id", "name", "description", "isActive", "stages", "connectedProjects"],
34+
"additionalProperties": false
35+
},
36+
"PipelineStageDetail": {
37+
"type": "object",
38+
"properties": {
39+
"id": {
40+
"type": "string"
41+
},
42+
"name": {
43+
"type": ["string", "null"]
44+
},
45+
"nextStageId": {
46+
"type": ["string", "null"]
47+
},
48+
"branchName": {
49+
"type": ["string", "null"]
50+
},
51+
"repositoryName": {
52+
"type": ["string", "null"]
53+
},
54+
"repositoryOwner": {
55+
"type": ["string", "null"]
56+
},
57+
"environment": {
58+
"anyOf": [
59+
{
60+
"$ref": "#/definitions/StageEnvironment"
61+
},
62+
{
63+
"type": "null"
64+
}
65+
]
66+
}
67+
},
68+
"required": ["id", "name", "nextStageId", "branchName", "repositoryName", "repositoryOwner", "environment"],
69+
"additionalProperties": false
70+
},
71+
"StageEnvironment": {
72+
"type": "object",
73+
"properties": {
74+
"id": {
75+
"type": "string"
76+
},
77+
"name": {
78+
"type": "string"
79+
}
80+
},
81+
"required": ["id", "name"],
82+
"additionalProperties": false
83+
},
84+
"ConnectedProject": {
85+
"type": "object",
86+
"properties": {
87+
"id": {
88+
"type": "string"
89+
},
90+
"name": {
91+
"type": ["string", "null"]
92+
}
93+
},
94+
"required": ["id", "name"],
95+
"additionalProperties": false
96+
}
97+
}
98+
}

schemas/devops-pipeline-list.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/PipelineListResult",
4+
"definitions": {
5+
"PipelineListResult": {
6+
"type": "object",
7+
"properties": {
8+
"pipelines": {
9+
"type": "array",
10+
"items": {
11+
"$ref": "#/definitions/DevopsPipeline"
12+
}
13+
}
14+
},
15+
"required": ["pipelines"],
16+
"additionalProperties": false
17+
},
18+
"DevopsPipeline": {
19+
"type": "object",
20+
"properties": {
21+
"Id": {
22+
"type": "string"
23+
},
24+
"Name": {
25+
"type": "string"
26+
},
27+
"Description": {
28+
"type": ["string", "null"]
29+
},
30+
"IsActive": {
31+
"type": "boolean"
32+
}
33+
},
34+
"required": ["Id", "Name", "Description", "IsActive"],
35+
"additionalProperties": false
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)