@salesforce/afv-skills 1.18.0 → 1.20.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.
- package/package.json +1 -1
- package/skills/analyzing-test-failures/SKILL.md +159 -0
- package/skills/checking-devops-prerequisites/SKILL.md +141 -0
- package/skills/configuring-quality-gate/SKILL.md +120 -0
- package/skills/configuring-test-provider/SKILL.md +113 -0
- package/skills/creating-fix-work-item/SKILL.md +66 -0
- package/skills/managing-suite-assignments/SKILL.md +161 -0
- package/skills/platform-agentexchange-partner-offers-enable/SKILL.md +111 -0
- package/skills/platform-agentexchange-partner-offers-enable/assets/org-pref-template.md +27 -0
- package/skills/platform-agentexchange-partner-offers-enable/examples/org-preference-settings.xml +4 -0
- package/skills/polling-test-results/SKILL.md +72 -0
- package/skills/recommending-devops-tests/SKILL.md +137 -0
- package/skills/running-devops-test-suite/SKILL.md +144 -0
- package/skills/syncing-test-providers/SKILL.md +108 -0
package/package.json
CHANGED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: analyzing-test-failures
|
|
3
|
+
description: "Parses a DevOps Center test-failure or Code Analyzer violation payload and explains it in plain language — failure category, offending file/class/method/line, rule violated, and fix direction — then gives prioritized test-improvement suggestions (distinguishing test-code from production-code fixes). Pure reasoning: no system calls or code authoring. TRIGGER when: a test run failed and the user wants root cause; a quality gate failure needs explaining; Code Analyzer violations need translating to plain language; the user shares a failure payload and asks how to address it; tests keep failing and the user wants suggestions; or the user wants to close coverage gaps, strengthen assertions, or fix flaky/weak tests. DO NOT TRIGGER when: the user wants fix code written (use generating-apex) or new test classes authored (use generating-apex-test)."
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0"
|
|
6
|
+
minApiVersion: "67.0"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# analyzing-test-failures
|
|
10
|
+
|
|
11
|
+
**Type:** Pure reasoning — no system calls, no code authoring.
|
|
12
|
+
|
|
13
|
+
**What it does:** Parses a test failure or Code Analyzer violation payload and produces a plain-language explanation, then follows up with concrete, prioritized improvement suggestions per failed test — including whether each fix belongs in the test or in production code. Never exposes raw JSON, stack traces, or API error bodies to the user.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
If you need to fetch the failure payload yourself rather than receiving it, load `checking-devops-prerequisites` first, then use `polling-test-results` to obtain the execution result. If the payload is already in context, no prerequisites are needed — this is pure reasoning.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Inputs
|
|
24
|
+
|
|
25
|
+
- JSON failure payload provided by the `polling-test-results` skill, or pasted directly into context from a test run or Code Analyzer execution. Specifically required per failed test:
|
|
26
|
+
- Test method name
|
|
27
|
+
- Failure message (the assertion error or exception text)
|
|
28
|
+
- Failure category (assertion failure, unhandled exception, timeout, compile error)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Empty-org / no-data case
|
|
33
|
+
|
|
34
|
+
If the payload contains no failures or violations, report that clearly (e.g. "No failures found in the provided execution results.") and stop. Do NOT fabricate failures, violations, or improvement suggestions when none are present.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Reasoning steps
|
|
39
|
+
|
|
40
|
+
1. Determine the failure category:
|
|
41
|
+
|
|
42
|
+
| Category | Description |
|
|
43
|
+
|---|---|
|
|
44
|
+
| **Assertion failure** | A test assertion failed (expected vs actual mismatch) |
|
|
45
|
+
| **Exception** | An unhandled exception was thrown |
|
|
46
|
+
| **Code Analyzer violation** | A static analysis rule was violated (e.g. `ApexCRUDViolation`, `ApexSharingViolations`) |
|
|
47
|
+
| **Timeout** | Test exceeded execution time limit |
|
|
48
|
+
| **Compile error** | Class failed to compile |
|
|
49
|
+
|
|
50
|
+
2. For each failure, extract and translate to plain language:
|
|
51
|
+
- Offending file and class name
|
|
52
|
+
- Method name
|
|
53
|
+
- Line number
|
|
54
|
+
- What rule or assertion was violated, in plain language
|
|
55
|
+
- Suggested fix direction (without writing code)
|
|
56
|
+
|
|
57
|
+
3. Group failures by category if more than one.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Output format
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
Test failure summary:
|
|
65
|
+
|
|
66
|
+
<N> failure(s) found:
|
|
67
|
+
|
|
68
|
+
1. [<Category>] `<ClassName>.cls` — `<methodName>()` at line <N>
|
|
69
|
+
What happened: <plain-language description>
|
|
70
|
+
Rule violated: <ruleName or assertion description>
|
|
71
|
+
Fix direction: <plain-language suggestion>
|
|
72
|
+
|
|
73
|
+
2. [<Category>] `<ClassName2>.cls` — `<methodName2>()` at line <N>
|
|
74
|
+
...
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Code Analyzer violations
|
|
80
|
+
|
|
81
|
+
For violations, always include:
|
|
82
|
+
- The rule name translated to plain English (e.g. "ApexCRUDViolation" → "A SOQL query was made without checking object-level permissions first")
|
|
83
|
+
- The exact line number
|
|
84
|
+
- The fix direction (e.g. "Add a `Schema.sObjectType.Account.isAccessible()` check before the query")
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Plain-language rule
|
|
89
|
+
|
|
90
|
+
Never paste raw stack traces, JSON payloads, or internal Salesforce error codes into the output. Always translate to file name, method, line, and plain description.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Suggesting improvements
|
|
95
|
+
|
|
96
|
+
Invoke this section **after test execution completes with failures**, not on static source code. The failure message is the primary signal — it describes what the test expected vs. what actually happened, which directly informs what the test needs to handle better.
|
|
97
|
+
|
|
98
|
+
### 1 — Read each failure message
|
|
99
|
+
|
|
100
|
+
For each failed test in the execution result, extract:
|
|
101
|
+
- Test method name
|
|
102
|
+
- Failure message (the assertion error or exception message)
|
|
103
|
+
- Failure category (assertion failure, unhandled exception, timeout, compile error)
|
|
104
|
+
|
|
105
|
+
### 2 — Infer what the test is not handling
|
|
106
|
+
|
|
107
|
+
Reason over the failure message to identify the root cause pattern:
|
|
108
|
+
|
|
109
|
+
| Failure pattern | Improvement suggestion |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `NullPointerException` | The test is not handling null input — add a null check or a test setup that ensures the data exists |
|
|
112
|
+
| `Assertion failed: expected X but was Y` | The expected value in the assertion is wrong or the test data setup does not produce the right state |
|
|
113
|
+
| `List has no rows for assignment` | The test is querying for data that doesn't exist — test setup is incomplete |
|
|
114
|
+
| `System.LimitException: Too many SOQL queries` | The test is hitting governor limits — the code under test or test setup is making too many queries |
|
|
115
|
+
| `Insufficient access rights on cross-reference id` | The test user lacks the required permissions — the test needs to run as a user with appropriate profile/permission set |
|
|
116
|
+
| `DML currently not allowed` | The test is performing DML inside a method called from a context that doesn't allow it |
|
|
117
|
+
| Code Analyzer violation message | The production code violates a specific rule — the test exposed it but the fix is in the production code, not the test |
|
|
118
|
+
|
|
119
|
+
### 3 — Produce actionable suggestions
|
|
120
|
+
|
|
121
|
+
For each failure, describe in plain language:
|
|
122
|
+
- What the failure reveals about what the test is not handling
|
|
123
|
+
- What specifically should be added or changed to make the test robust
|
|
124
|
+
- Whether the fix is in the **test** (assertion, setup, permissions) or in the **production code** (the test is correct but the code under test is broken)
|
|
125
|
+
|
|
126
|
+
Do not rewrite the test. Only describe what needs to change and why.
|
|
127
|
+
|
|
128
|
+
### Output format for improvements
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
Test improvement suggestions based on execution results:
|
|
132
|
+
|
|
133
|
+
`<testMethodName>()` — [Assertion Failure / Exception / etc.]
|
|
134
|
+
Failure: "<failure message>"
|
|
135
|
+
What this reveals: <plain-language explanation>
|
|
136
|
+
Suggestion: <specific, actionable recommendation>
|
|
137
|
+
Fix location: Test | Production code
|
|
138
|
+
|
|
139
|
+
`<testMethodName2>()` — [NullPointerException]
|
|
140
|
+
Failure: "Attempt to de-reference a null object"
|
|
141
|
+
What this reveals: The test is calling the method without setting up the required input data
|
|
142
|
+
Suggestion: Add test data setup for <object/field> before calling the method
|
|
143
|
+
Fix location: Test
|
|
144
|
+
|
|
145
|
+
Overall: <N> improvement(s) across <M> failed test(s).
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Test fix vs. production-code fix
|
|
149
|
+
|
|
150
|
+
Suggestions flagged as **Fix location: Production code** indicate a code defect exposed by the test — the test logic itself is sound. These should not block suite promotion on the grounds of test quality; they should be tracked separately as production defects.
|
|
151
|
+
|
|
152
|
+
Suggestions flagged as **Fix location: Test** indicate the test needs to be hardened — missing setup, wrong assertions, inadequate coverage of edge cases (null inputs, bulk record volumes, mixed permission contexts, governor-limit boundaries).
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Related skills
|
|
157
|
+
|
|
158
|
+
- **`polling-test-results`** — obtains the failure payload that feeds into this skill.
|
|
159
|
+
- **`creating-fix-work-item`** — use to create a tracked fix item from the analysis output or to track an approved improvement suggestion as a work item once the user decides to act on it.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: checking-devops-prerequisites
|
|
3
|
+
description: "Validate the environment before any DevOps Center pipeline testing action: confirms an authenticated Salesforce org, the Agentforce DX plugin, an authenticated DevOps Center org, and an identified pipeline (and optionally a pipeline stage). Use this FIRST, internally, from any DevOps testing skill (running a test suite, polling results, syncing tests, configuring or retriggering a quality gate, assigning/mapping suites, creating fix work items, recommending tests, explaining coverage, analyzing failures). TRIGGER when another DevOps testing skill needs to confirm org/pipeline context before a query or system call. DO NOT TRIGGER for non-DevOps-Center work."
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0"
|
|
6
|
+
minApiVersion: "67.0"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Checking DevOps Prerequisites
|
|
10
|
+
|
|
11
|
+
Shared gate for every DevOps Center testing skill. Run these checks **before** any query or system call. On any failure, surface the plain-language message and stop until the user resolves it — never proceed to a write with an unverified environment.
|
|
12
|
+
|
|
13
|
+
> **API version:** All DevOps testing system calls target Salesforce API **v67.0** (minimum required).
|
|
14
|
+
|
|
15
|
+
**Important:** All DevOps Center data (pipelines, stages, test suites, executions) lives in the Salesforce org — NOT in the local repository. Never search the filesystem for pipeline configuration. Always query the org using `sf data query` or `sf api request rest`.
|
|
16
|
+
|
|
17
|
+
## How other skills use this
|
|
18
|
+
|
|
19
|
+
Every DevOps testing skill loads this skill first and runs Prerequisites 1–4 in order. Prerequisite 5 (stage) is run **only** when the calling skill operates on a specific pipeline stage (running/retriggering a suite, syncing, configuring a gate, mapping a suite). The calling skill passes back the resolved `doce-org-alias`, `pipelineId`, and (when applicable) `stageId` to use in its own commands.
|
|
20
|
+
|
|
21
|
+
Resolve the **DevOps Center org alias** without asking the user unless genuinely ambiguous:
|
|
22
|
+
1. If the user named an org alias in their message, use it.
|
|
23
|
+
2. Otherwise, use the default org (`sf org display --json`, no `--target-org`).
|
|
24
|
+
3. Only if the default org has no `DevopsPipeline` records (Prereq 4 fails), ask: "Which org alias is your DevOps Center org?"
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Prerequisite 1 — Salesforce org: active login
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
sf org list --json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Look for at least one entry in `result.nonScratchOrgs`, `result.scratchOrgs`, or `result.sandboxes` with `"connectedStatus": "Connected"`.
|
|
35
|
+
|
|
36
|
+
- **Pass:** at least one org is Connected
|
|
37
|
+
- **Fail:** no orgs listed, or all show a non-connected status
|
|
38
|
+
|
|
39
|
+
**On fail:** "No authenticated Salesforce org found. Run `sf org login web --alias <your-alias>` in your terminal, then come back."
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Prerequisite 2 — Agentforce DX plugin installed
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
sf plugins --json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Look for a plugin entry whose `name` contains `plugin-agent`, `agentforce`, or `einstein` (case-insensitive).
|
|
50
|
+
|
|
51
|
+
- **Pass:** plugin found
|
|
52
|
+
- **Fail:** no matching entry
|
|
53
|
+
|
|
54
|
+
**On fail:** "The Agentforce DX Plugin is not installed. Run `sf plugins install @salesforce/plugin-agent`, then restart the IDE and try again."
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Prerequisite 3 — DevOps Center org authenticated
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
sf org display --target-org <doce-org-alias> --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Check that `"connectedStatus"` is `"Connected"`.
|
|
65
|
+
|
|
66
|
+
- **Pass:** Connected
|
|
67
|
+
- **Fail:** expired session or error
|
|
68
|
+
|
|
69
|
+
**On fail:** "Your DevOps Center org session has expired. Run `sf org login web --alias <doce-org-alias>` to re-authenticate."
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Prerequisite 4 — Pipeline identified
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
sf data query \
|
|
77
|
+
--query "SELECT Id, Name, CreatedDate FROM DevopsPipeline ORDER BY Name ASC" \
|
|
78
|
+
--target-org <doce-org-alias> \
|
|
79
|
+
--json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- **Pass (exactly one):** use it automatically — do NOT ask.
|
|
83
|
+
- **Pass (multiple):** if the user already named a pipeline, match by name. Otherwise display a numbered list and ask:
|
|
84
|
+
```text
|
|
85
|
+
Found <N> pipelines:
|
|
86
|
+
1. <Name>
|
|
87
|
+
2. <Name>
|
|
88
|
+
Which pipeline would you like to work with?
|
|
89
|
+
```
|
|
90
|
+
- **Fail (no records):** "No DevOps Center pipeline found. Create a project and pipeline in DevOps Center before using the DevOps Testing Skills."
|
|
91
|
+
- **Fail (unsupported object):** "DevOps Center does not appear to be installed on `<doce-org-alias>`. Check that you're pointing at the correct org."
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Prerequisite 5 — Pipeline stage identified (conditional)
|
|
96
|
+
|
|
97
|
+
Run **only** when the calling skill operates on a specific stage.
|
|
98
|
+
|
|
99
|
+
If the user's message already names a stage (e.g. "Integration", "Staging", "Production"), use that name directly — do NOT ask again. Look up its Id:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
sf data query \
|
|
103
|
+
--query "SELECT Id, Name FROM DevopsPipelineStage WHERE DevopsPipelineId = '<pipelineId>' AND Name = '<stageName>'" \
|
|
104
|
+
--target-org <doce-org-alias> --json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Only if no stage is mentioned, fetch the full list and ask which one:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
sf data query \
|
|
111
|
+
--query "SELECT Id, Name FROM DevopsPipelineStage WHERE DevopsPipelineId = '<pipelineId>' ORDER BY Name ASC" \
|
|
112
|
+
--target-org <doce-org-alias> --json
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then ask: "Which pipeline stage are we working with?" — do NOT ask for an org alias; stages are resolved by name from the pipeline.
|
|
116
|
+
|
|
117
|
+
- **Pass:** stage Id and Name confirmed
|
|
118
|
+
- **Deferred:** not required until a calling skill needs it
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Error Handling
|
|
123
|
+
|
|
124
|
+
| Error condition | Response |
|
|
125
|
+
|---|---|
|
|
126
|
+
| `sf org list` fails entirely | "Could not reach the Salesforce CLI. Make sure `sf` is installed and on your PATH." |
|
|
127
|
+
| `sf org display` returns auth error | Surface plain-language re-auth instructions. Do not expose the raw error. |
|
|
128
|
+
| `DevopsPipeline` query fails with 5xx | "The DevOps Center org is returning a server error. Try again in a few minutes." |
|
|
129
|
+
| Any check throws unexpectedly | "Something went wrong checking prerequisites. Error: [plain summary]. Let's try again — or resolve it manually and let me know when ready." |
|
|
130
|
+
|
|
131
|
+
Never expose raw API errors, stack traces, or JSON error payloads to the user.
|
|
132
|
+
|
|
133
|
+
## Gotchas
|
|
134
|
+
|
|
135
|
+
| Issue | Resolution |
|
|
136
|
+
|---|---|
|
|
137
|
+
| `DevopsPipeline` query returns empty | DevOps Center not installed on the target org, or wrong org alias — ask the user to verify |
|
|
138
|
+
| `DevopsWorkItem` sObject not supported | Use `WorkItem` (no namespace) — the correct API name for this org version |
|
|
139
|
+
| Review trigger is pipeline-level, not stage-level | Query `DevopsPipelineStageTrigger` where `TriggerType = 'Review'` and `RelatedRecordId = <pipelineId>` |
|
|
140
|
+
| Connect API `testSuites` returns empty with `?stageId=` | Use `?triggerId=<reviewTriggerId>` — `stageId` only works for stage-level triggers |
|
|
141
|
+
| `sf plugins` doesn't match `agentforce` | The installed plugin is `@salesforce/plugin-agent` — match on `plugin-agent` too |
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: configuring-quality-gate
|
|
3
|
+
description: "Creates a DevOps Center quality gate with associated rules (PASS_PERCENTAGE, SEVERITY, ESSENTIAL) and links it to a pipeline-stage suite assignment, after showing a mandatory impact preview and obtaining explicit confirmation. Use this skill when a user wants to set or configure a quality gate, change a coverage threshold, or establish testing benchmarks on a pipeline stage. TRIGGER when: the user wants to set/configure a quality gate, change a coverage threshold, or set testing benchmarks on a stage. DO NOT TRIGGER when: only re-running an existing gate (use running-devops-test-suite in retrigger mode)."
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0"
|
|
6
|
+
minApiVersion: "67.0"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
Load `checking-devops-prerequisites` first — Prerequisites 1–4 AND Prerequisite 5 (stage). You need `doce-org-alias`, `pipelineId`, `stageId`, and the target `DevopsTestSuiteStage` record Id.
|
|
12
|
+
|
|
13
|
+
## Inputs required
|
|
14
|
+
|
|
15
|
+
| Input | Source |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `name` | User-provided name for the quality gate |
|
|
18
|
+
| `rules` | List of `{type, threshold?}` — see rule types below |
|
|
19
|
+
| `doce-org-alias` | Established in Prereq 1 |
|
|
20
|
+
| `testSuiteStageId` | Target `DevopsTestSuiteStage` record Id (Prereq 5) |
|
|
21
|
+
|
|
22
|
+
## Rule types
|
|
23
|
+
|
|
24
|
+
| Type | Description | Threshold |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `PASS_PERCENTAGE` | Minimum % of tests that must pass | Required (0–100) |
|
|
27
|
+
| `SEVERITY` | Maximum allowed severity level of failures | Required (numeric, e.g. 1–5) |
|
|
28
|
+
| `ESSENTIAL` | All essential tests must pass | Not required |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## MANDATORY IMPACT PREVIEW
|
|
33
|
+
|
|
34
|
+
**Before executing any commands**, show the user this preview and wait for explicit confirmation:
|
|
35
|
+
|
|
36
|
+
> "Here's what this quality gate will enforce on `<stageName>`:
|
|
37
|
+
> - Rule: `<type>` — `<description>`
|
|
38
|
+
> - Threshold: `<value>`
|
|
39
|
+
> - Affected pipelines: `<list>`
|
|
40
|
+
>
|
|
41
|
+
> Confirm to apply?"
|
|
42
|
+
|
|
43
|
+
**Never proceed past this point without showing the impact preview first and receiving explicit confirmation.**
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Confirmation gate
|
|
48
|
+
|
|
49
|
+
Only proceed with the steps below after the user has explicitly confirmed (e.g., "yes", "confirm", "go ahead"). If the user declines or does not confirm, stop and do not execute any commands.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Step 1 — Create the gate record
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
sf api request rest \
|
|
57
|
+
"/services/data/v67.0/connect/devopstesting/qualityGate" \
|
|
58
|
+
--method POST \
|
|
59
|
+
--body '{"name": "<gateName>"}' \
|
|
60
|
+
--target-org <doce-org-alias>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Extract `qualityGateId` from the response.
|
|
64
|
+
|
|
65
|
+
## Step 2 — Create each rule as a sObject record
|
|
66
|
+
|
|
67
|
+
Rules are not accepted in the Connect API payload — create them as `DevopsQualityGateRule` records directly. Only create rules the user has requested. `ESSENTIAL` has no threshold.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
sf data create record \
|
|
71
|
+
--sobject DevopsQualityGateRule \
|
|
72
|
+
--values "DevopsQualityGateId='<qualityGateId>' Rule='PASS_PERCENTAGE' Threshold=<value>" \
|
|
73
|
+
--target-org <doce-org-alias> --json
|
|
74
|
+
|
|
75
|
+
sf data create record \
|
|
76
|
+
--sobject DevopsQualityGateRule \
|
|
77
|
+
--values "DevopsQualityGateId='<qualityGateId>' Rule='ESSENTIAL'" \
|
|
78
|
+
--target-org <doce-org-alias> --json
|
|
79
|
+
|
|
80
|
+
sf data create record \
|
|
81
|
+
--sobject DevopsQualityGateRule \
|
|
82
|
+
--values "DevopsQualityGateId='<qualityGateId>' Rule='SEVERITY' Threshold=<value>" \
|
|
83
|
+
--target-org <doce-org-alias> --json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Step 3 — Link the gate to the suite stage
|
|
87
|
+
|
|
88
|
+
Update the `DevopsTestSuiteStage` record to link the new gate:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
sf data update record \
|
|
92
|
+
--sobject DevopsTestSuiteStage \
|
|
93
|
+
--record-id <testSuiteStageId> \
|
|
94
|
+
--values "IsQualityGateEnabled=true DevopsQualityGateId='<qualityGateId>'" \
|
|
95
|
+
--target-org <doce-org-alias> --json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## On success
|
|
101
|
+
|
|
102
|
+
Confirm to the user:
|
|
103
|
+
> "Quality gate `<gateName>` created with `<N>` rule(s) and assigned to `<suiteName>` on `<stageName>`."
|
|
104
|
+
|
|
105
|
+
## Error handling
|
|
106
|
+
|
|
107
|
+
Never expose raw API errors. Use the following responses:
|
|
108
|
+
|
|
109
|
+
| Status | Response |
|
|
110
|
+
|---|---|
|
|
111
|
+
| 400 | "The quality gate configuration is invalid. Check that all rule types and thresholds are correct." |
|
|
112
|
+
| 403 | "You don't have permission to configure quality gates on this org." |
|
|
113
|
+
| 500 | "A server error occurred. Try again in a few minutes." |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Related skills
|
|
118
|
+
|
|
119
|
+
- To re-run a gate after meeting threshold, use `running-devops-test-suite` (retrigger mode).
|
|
120
|
+
- To assign or map suites to stages, use `managing-suite-assignments`.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: configuring-test-provider
|
|
3
|
+
description: "Configures an available test provider (e.g. Apex Unit Tests, Code Analyzer, Flow Tests, Provar) on a DevOps Center pipeline via the Connect API, after explicit user confirmation, so the provider's test suites become available for assignment to pipeline stages. Takes a pipelineId and a testProviderId. Use this skill when a provider is available on the pipeline but not yet configured and the user wants to enable it. TRIGGER when: the user wants to configure, enable, set up, or add a test provider on a pipeline, or wants a not-yet-configured provider's suites to become available. DO NOT TRIGGER when: re-syncing an already-configured provider to pick up new suites (use syncing-test-providers), or assigning existing suites to a stage (use managing-suite-assignments)."
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0"
|
|
6
|
+
minApiVersion: "67.0"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Configuring a Test Provider
|
|
10
|
+
|
|
11
|
+
Configures an available test provider on a DevOps Center pipeline, making its test suites available for assignment to pipeline stages.
|
|
12
|
+
|
|
13
|
+
**Confirmation required:** Yes — explicit confirmation before the provider is configured.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
Load `checking-devops-prerequisites` first — Prerequisites 1–4 (org login, Agentforce DX plugin, DevOps Center org auth, pipeline identified). Prerequisite 5 (stage) is **not** required: providers are configured at the pipeline level, not the stage level.
|
|
18
|
+
|
|
19
|
+
| Variable | Source |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `doce-org-alias` | Established in Prerequisite 1 |
|
|
22
|
+
| `pipelineId` | Identified in Prerequisite 4 (pipeline selection) |
|
|
23
|
+
| `testProviderId` | Resolved by fetching the pipeline's test providers (below) |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Step 1 — Fetch test providers to resolve the provider ID
|
|
28
|
+
|
|
29
|
+
Get all test providers for the pipeline so you can resolve the `testProviderId` and confirm which providers are still available to configure:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
sf api request rest \
|
|
33
|
+
"/services/data/v67.0/connect/devopstesting/pipeline/<pipelineId>/testProviders?status=all" \
|
|
34
|
+
--target-org <doce-org-alias>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Each provider entry includes `testProviderId`, `testProviderName`, and a status (Configured vs. Available). Present a short summary grouped by status:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
Test providers for <pipelineName>:
|
|
41
|
+
|
|
42
|
+
✓ Configured:
|
|
43
|
+
- Code Analyzer (63 suites)
|
|
44
|
+
- Apex Unit Tests (5 suites)
|
|
45
|
+
|
|
46
|
+
Available (not yet configured):
|
|
47
|
+
- Flow Tests
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- **Only an Available provider can be configured.** If the pipeline has no available providers, report that and stop — do NOT fabricate a provider or ID.
|
|
51
|
+
|
|
52
|
+
### If the named provider is already Configured
|
|
53
|
+
|
|
54
|
+
Do **not** present the confirmation gate and do **not** POST to the configure endpoint (Steps 2–3) — that would create a duplicate `DevopsPipelineTestProvider`. Instead:
|
|
55
|
+
|
|
56
|
+
1. State plainly that the provider is already configured, including its synced suite count and last-sync time if returned (e.g. *"Flow Tests is already configured on `<pipelineName>` with 3 suites synced (last sync 2026-06-23)."*).
|
|
57
|
+
2. Diagnose the user's actual goal and redirect **by name**:
|
|
58
|
+
- If the user says the provider's **suites don't appear when assigning tests to a stage**, this is a **stage-assignment gap, not a provider-configuration gap** — the suites already exist at the pipeline level; they just need to be linked to the stage. Redirect to **`managing-suite-assignments`**.
|
|
59
|
+
- If the user expects **newly created suites** that aren't yet synced, redirect to **`syncing-test-providers`** (re-sync via `POST /connect/devops/sync`) to pull them in.
|
|
60
|
+
3. Do not loop back to configuring — finish cleanly after the explanation and redirect.
|
|
61
|
+
|
|
62
|
+
## Step 2 — Confirmation gate
|
|
63
|
+
|
|
64
|
+
**Required — do not call the API before the user confirms.**
|
|
65
|
+
|
|
66
|
+
> "I'll configure `<testProviderName>` on the `<pipelineName>` pipeline. This will make its suites available for assignment to stages. Confirm?"
|
|
67
|
+
|
|
68
|
+
Do not proceed until the user gives an affirmative response.
|
|
69
|
+
|
|
70
|
+
## Step 3 — Configure the provider
|
|
71
|
+
|
|
72
|
+
On confirmation, call the configure endpoint with the provider ID:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
sf api request rest \
|
|
76
|
+
"/services/data/v67.0/connect/devops/pipeline/<pipelineId>/testProvider" \
|
|
77
|
+
--method POST \
|
|
78
|
+
--body '{"testProviderId": "<testProviderId>"}' \
|
|
79
|
+
--target-org <doce-org-alias>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## On success
|
|
83
|
+
|
|
84
|
+
> "Provider `<testProviderName>` is now configured on the `<pipelineName>` pipeline. Its suites are available for assignment to stages."
|
|
85
|
+
|
|
86
|
+
Newly configured suites can then be assigned to stages with `managing-suite-assignments`.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Critical gotcha
|
|
91
|
+
|
|
92
|
+
This `POST .../pipeline/<pipelineId>/testProvider` endpoint **creates a new provider configuration record** (`DevopsPipelineTestProvider`). Use it ONLY to configure a provider for the first time. To re-sync an already-configured provider for new suites, use `syncing-test-providers` (`POST /connect/devops/sync`) — calling this configure endpoint on an already-configured provider produces **duplicate** `DevopsPipelineTestProvider` records.
|
|
93
|
+
|
|
94
|
+
## Error Handling
|
|
95
|
+
|
|
96
|
+
Never expose raw API error messages, stack traces, or JSON payloads to the user. Map response status codes to plain-language messages:
|
|
97
|
+
|
|
98
|
+
| Status | User-facing message |
|
|
99
|
+
|---|---|
|
|
100
|
+
| 400 | "The request was invalid. Check that the provider ID and pipeline ID are correct." |
|
|
101
|
+
| 403 | "You don't have permission to configure test providers on this pipeline." |
|
|
102
|
+
| 404 | "The pipeline or test provider was not found." |
|
|
103
|
+
| 409 | "That provider appears to already be configured on this pipeline. To pick up new suites, re-sync it instead." |
|
|
104
|
+
| 500 | "A server error occurred. Try again in a few minutes." |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Related skills
|
|
109
|
+
|
|
110
|
+
- **`checking-devops-prerequisites`** — loaded first to establish org and pipeline context.
|
|
111
|
+
- **`syncing-test-providers`** — once a provider is configured, use this to re-sync it later and pull in newly added suites.
|
|
112
|
+
- **`managing-suite-assignments`** — after configuring a provider, use this to assign or map its suites to a pipeline stage.
|
|
113
|
+
- **`recommending-devops-tests`** — to recommend which of the newly available suites to run.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: creating-fix-work-item
|
|
3
|
+
description: "Creates a DevOps Center WorkItem to track a fix for a test failure or Code Analyzer violation. Before creating anything, it shows a subject/assignee/project preview and requires explicit confirmation. Use this skill when you want to create a fix work item, track a remediation task, or assign a test or analysis failure to a developer. TRIGGER when: the user wants to create a fix work item, log a remediation, or assign a failure to a developer for resolution. DO NOT TRIGGER when: writing the fix code itself (use generating-apex)."
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0"
|
|
6
|
+
minApiVersion: "67.0"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
Load `checking-devops-prerequisites` first — Prerequisites 1–4. You need `doce-org-alias`, the `DevopsProjectId` to file under, and an `OwnerId` (assignee). If no DevopsProject exists, surface that the work item cannot be created until a project exists.
|
|
12
|
+
|
|
13
|
+
## Inputs required before creating
|
|
14
|
+
|
|
15
|
+
| Input | How to obtain |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `DevopsProjectId` | From the pipeline's associated project — query `DevopsProject WHERE Name = '<projectName>'` on the doce org if not already known |
|
|
18
|
+
| `Subject` | Derived from failure analysis — e.g. "Fix: Missing code-analyzer-v5.yml workflow in blitz-10-06 repository" |
|
|
19
|
+
| `OwnerId` | User ID of the developer to assign to — query `SELECT Id, Name FROM User WHERE Username = '<username>'` on the doce org if not known. Ask the user if the username is unknown. |
|
|
20
|
+
| `doce-org-alias` | Established in Prerequisites |
|
|
21
|
+
|
|
22
|
+
## Confirmation gate
|
|
23
|
+
|
|
24
|
+
Before creating the work item, show a summary and wait for explicit confirmation:
|
|
25
|
+
|
|
26
|
+
> "I'll create a fix work item with the following details:
|
|
27
|
+
> - **Subject:** `<subject>`
|
|
28
|
+
> - **Assigned to:** `<assigneeName>`
|
|
29
|
+
> - **Project:** `<projectName>`
|
|
30
|
+
>
|
|
31
|
+
> Shall I create it?"
|
|
32
|
+
|
|
33
|
+
Do not proceed until the user confirms.
|
|
34
|
+
|
|
35
|
+
## Creating the work item
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
sf data create record \
|
|
39
|
+
--sobject WorkItem \
|
|
40
|
+
--values "Subject='<subject>' DevopsProjectId='<DevopsProjectId>' OwnerId='<OwnerId>'" \
|
|
41
|
+
--target-org <doce-org-alias> \
|
|
42
|
+
--json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> **Important:** Use `WorkItem` (no namespace) — `DevopsWorkItem` is not a supported sObject in this org version.
|
|
46
|
+
|
|
47
|
+
## On success
|
|
48
|
+
|
|
49
|
+
Parse the returned `id` from the result and confirm:
|
|
50
|
+
|
|
51
|
+
> "Fix work item created (`<id>`): `<subject>`. Assigned to `<assigneeName>` in the `<projectName>` project."
|
|
52
|
+
|
|
53
|
+
## Error handling
|
|
54
|
+
|
|
55
|
+
Never expose raw API error messages. Map errors to plain-language responses:
|
|
56
|
+
|
|
57
|
+
| Error | Response |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `FIELD_INTEGRITY_EXCEPTION` | "The assignee ID is invalid. Let me look up the correct user ID — what's the developer's username?" |
|
|
60
|
+
| `REQUIRED_FIELD_MISSING` | "A required field is missing. Check that `Subject` and `DevopsProjectId` are both provided." |
|
|
61
|
+
| `INSUFFICIENT_ACCESS` | "Your user doesn't have permission to create work items in this project." |
|
|
62
|
+
| Any other error | "The work item could not be created. Error: `<plain summary>`. Try again or create it manually in DevOps Center." |
|
|
63
|
+
|
|
64
|
+
## Related skills
|
|
65
|
+
|
|
66
|
+
- `analyzing-test-failures` — provides the failure analysis and improvement suggestions that motivate creating a fix work item
|