@salesforce/afv-skills 1.65.1 → 1.66.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 (31) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-offline-experimentation-run/SKILL.md +16 -15
  3. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +3 -245
  4. package/skills/dx-devops-work-item-manage/SKILL.md +34 -17
  5. package/skills/dx-devops-work-item-manage/examples/common-workflows.md +49 -0
  6. package/skills/dx-devops-work-item-manage/references/commit-api.md +116 -0
  7. package/skills/experience-lwc-widget-assess/SKILL.md +79 -0
  8. package/skills/experience-lwc-widget-migrate/SKILL.md +50 -0
  9. package/skills/platform-role-hierarchy-apply/SKILL.md +177 -0
  10. package/skills/platform-widget-generate/SKILL.md +58 -41
  11. package/skills/platform-widget-generate/references/widget-bundle-validation.md +14 -0
  12. package/skills/service-agentforce-contact-center-coordinate/SKILL.md +1 -1
  13. package/skills/service-agentforce-contact-center-coordinate/references/number_management_api.md +11 -1
  14. package/skills/service-agentforce-contact-center-coordinate/scripts/fetch-numbers.sh +12 -6
  15. package/skills/service-agentforce-contact-center-coordinate/scripts/lib.sh +16 -0
  16. package/skills/service-agentforce-contact-center-coordinate/scripts/procure-number.sh +2 -1
  17. package/skills/service-concierge-portal-generate/references/portal-deploy-runbook.md +24 -11
  18. package/skills/service-digital-engagement-channel-configure/SKILL.md +25 -14
  19. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +143 -0
  20. package/skills/service-digital-engagement-deployment-configure/SKILL.md +61 -12
  21. package/skills/service-digital-engagement-deployment-configure/references/connect_api_creation.md +14 -5
  22. package/skills/service-digital-engagement-deployment-configure/references/onboarding_contract.md +146 -0
  23. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +23 -13
  24. package/skills/service-itsm-agentic-setup-incident-management/references/incident-persona-psg.md +7 -6
  25. package/skills/service-itsm-agentic-setup-incident-management/references/incident-preferences.md +9 -10
  26. package/skills/service-itsm-agentic-setup-incident-management/references/major-incident-management.md +6 -6
  27. package/skills/service-itsm-agentic-setup-incident-management/references/service-mgmt-privilege.md +1 -1
  28. package/skills/service-itsm-agentic-setup-incident-sla-configure/SKILL.md +34 -25
  29. package/skills/service-itsm-agentic-setup-incident-sla-configure/examples/milestone-patterns.md +1 -1
  30. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/mcp-invocation.md +90 -86
  31. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/workflow.md +63 -38
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/afv-skills",
3
- "version": "1.65.1",
3
+ "version": "1.66.0",
4
4
  "description": "Salesforce's curated collection of agent skills for building applications. Optimized for Agentforce Vibes, compatible with all AI tools.",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -58,13 +58,13 @@ Operations grouped by purpose. Use these as the building blocks for the workflow
58
58
  | `find-sessions` | read | implemented | `queryCdpAnsiSqlV2` | `verify-stdm-availability`, `discover-agents` |
59
59
  | `get-conversation-details` | read | proposed | `queryCdpAnsiSqlV2` | `find-sessions` |
60
60
  | `get-llm-step-details` | read | proposed | `queryCdpAnsiSqlV2` | `get-conversation-details` |
61
- | `obtain-sfap-token` | validate | proposed | `obtainSfapJwt` | — |
62
- | `replay-turn-prompts` | read | proposed | `sfapChatGenerations` | `get-llm-step-details`, `obtain-sfap-token` |
63
- | `score-exact-matches` | read | proposed | `computeExactMatchScores` | `replay-turn-prompts` |
64
- | `judge-function-args` | read | proposed | `sfapChatGenerations` | `score-exact-matches`, `obtain-sfap-token` |
65
- | `judge-text-responses` | read | proposed | `sfapChatGenerations` | `replay-turn-prompts`, `obtain-sfap-token` |
66
- | `generate-csv-report` | write | proposed | `generateCsvReport` | `score-exact-matches`, `judge-function-args`, `judge-text-responses` |
67
- | `generate-html-report` | write | proposed | `generateHtmlReport` | `generate-csv-report` |
61
+ | `obtain-sfap-token` | validate | proposed | — | — |
62
+ | `replay-turn-prompts` | read | proposed | — | `get-llm-step-details`, `obtain-sfap-token` |
63
+ | `score-exact-matches` | read | proposed | — | `replay-turn-prompts` |
64
+ | `judge-function-args` | read | proposed | — | `score-exact-matches`, `obtain-sfap-token` |
65
+ | `judge-text-responses` | read | proposed | — | `replay-turn-prompts`, `obtain-sfap-token` |
66
+ | `generate-csv-report` | write | proposed | — | `score-exact-matches`, `judge-function-args`, `judge-text-responses` |
67
+ | `generate-html-report` | write | proposed | — | `generate-csv-report` |
68
68
 
69
69
  ### Dependency graph
70
70
 
@@ -172,9 +172,10 @@ Fetch interaction steps including LLM inputs and outputs for each interaction
172
172
 
173
173
  #### `replay-turn-prompts`
174
174
 
175
- Replay each turn's LLM prompt through the target model via SFAP REST API with structured tool calling
175
+ Extract structured messages (system/assistant/user) from STDM LLM step inputs, convert to OpenAI-format messages array preserving role positions, extract tool definitions dynamically from gen_ai.request.tools, classify each step as router (topic) or action based on tool signatures, and replay via SFAP REST API POST /ai/gpt/v1/chat/generations with tool_choice=required
176
176
 
177
- **Call:** `sfapChatGenerations` — status: `proposed`
177
+
178
+ **Status:** `proposed`
178
179
 
179
180
  **Inputs:**
180
181
 
@@ -186,7 +187,7 @@ Replay each turn's LLM prompt through the target model via SFAP REST API with st
186
187
 
187
188
  Compute exact-match scores for topic agreement and function name accuracy
188
189
 
189
- **Call:** `computeExactMatchScores` — status: `proposed`
190
+ **Status:** `proposed`
190
191
 
191
192
  **Depends on:** `replay-turn-prompts`
192
193
 
@@ -194,7 +195,7 @@ Compute exact-match scores for topic agreement and function name accuracy
194
195
 
195
196
  LLM-as-judge scoring of function arguments when function names match (exact or lenient)
196
197
 
197
- **Call:** `sfapChatGenerations` — status: `proposed`
198
+ **Status:** `proposed`
198
199
 
199
200
  **Depends on:** `score-exact-matches`, `obtain-sfap-token`
200
201
 
@@ -202,7 +203,7 @@ LLM-as-judge scoring of function arguments when function names match (exact or l
202
203
 
203
204
  LLM-as-judge scoring of text responses for turns that end with text output
204
205
 
205
- **Call:** `sfapChatGenerations` — status: `proposed`
206
+ **Status:** `proposed`
206
207
 
207
208
  **Depends on:** `replay-turn-prompts`, `obtain-sfap-token`
208
209
 
@@ -212,7 +213,7 @@ LLM-as-judge scoring of text responses for turns that end with text output
212
213
 
213
214
  Generate CSV report with per-turn replay results and aggregate summary scores
214
215
 
215
- **Call:** `generateCsvReport` — status: `proposed`
216
+ **Status:** `proposed`
216
217
 
217
218
  **Inputs:**
218
219
 
@@ -224,7 +225,7 @@ Generate CSV report with per-turn replay results and aggregate summary scores
224
225
 
225
226
  Build a self-contained HTML analysis report with verdict badges, scorecards, and failure breakdown
226
227
 
227
- **Call:** `generateHtmlReport` — status: `proposed`
228
+ **Status:** `proposed`
228
229
 
229
230
  **Inputs:**
230
231
 
@@ -246,7 +247,7 @@ Verify STDM (Session Trace Data Model) is queryable in Data Cloud
246
247
 
247
248
  Obtain an SFAP JWT token via org session authentication and the /ide/auth endpoint
248
249
 
249
- **Call:** `obtainSfapJwt` — status: `proposed`
250
+ **Status:** `proposed`
250
251
 
251
252
  **Inputs:**
252
253
 
@@ -22,206 +22,10 @@ STDM_DATA_FILE = os.environ.get("STDM_DATA_FILE", "/tmp/details_result.json")
22
22
  LLM_STEPS_FILES = os.environ.get("LLM_STEPS_FILES", "/tmp/llm_steps_1.json,/tmp/llm_steps_2.json").split(",")
23
23
 
24
24
  # ---------------------------------------------------------------------------
25
- # Dynamic tool extraction from STDM data
26
- # ---------------------------------------------------------------------------
27
- # Instead of hardcoded tools, we extract actual tool definitions from the
28
- # original LLM responses in the STDM data. This handles both routing tools
29
- # (go_to_*) and domain action tools (SearchProducts, AddToCart, etc.)
25
+ # Tool extraction is dynamic-only: definitions come from STDM step inputs
26
+ # (gen_ai.request.tools) at runtime. No hardcoded tool schemas.
30
27
  # ---------------------------------------------------------------------------
31
28
 
32
- # Well-known tool schemas observed from agent responses. Keyed by tool name.
33
- # These are built from observed argument patterns in STDM LLM responses.
34
- KNOWN_TOOL_SCHEMAS = {
35
- # --- Routing tools (topic router layer) ---
36
- "go_to_product_discovery": {
37
- "type": "function",
38
- "function": {
39
- "name": "go_to_product_discovery",
40
- "description": "Route to product discovery topic for searching, browsing, product questions, recommendations.",
41
- "parameters": {"type": "object", "properties": {}}
42
- }
43
- },
44
- "go_to_cart_and_checkout": {
45
- "type": "function",
46
- "function": {
47
- "name": "go_to_cart_and_checkout",
48
- "description": "Route to cart and checkout topic for adding items, viewing cart, checkout, payments.",
49
- "parameters": {"type": "object", "properties": {}}
50
- }
51
- },
52
- "go_to_store_help": {
53
- "type": "function",
54
- "function": {
55
- "name": "go_to_store_help",
56
- "description": "Route to store help topic for shipping, returns, store policies, greetings.",
57
- "parameters": {"type": "object", "properties": {}}
58
- }
59
- },
60
- "go_to_off_topic": {
61
- "type": "function",
62
- "function": {
63
- "name": "go_to_off_topic",
64
- "description": "Route to off-topic handler for queries unrelated to shopping.",
65
- "parameters": {"type": "object", "properties": {}}
66
- }
67
- },
68
- # --- Domain action tools (sub-topic agents) ---
69
- "SearchProducts": {
70
- "type": "function",
71
- "function": {
72
- "name": "SearchProducts",
73
- "description": "Search the product catalog with optional filters.",
74
- "parameters": {
75
- "type": "object",
76
- "properties": {
77
- "searchQuery": {"type": "string", "description": "Search terms or keywords"},
78
- "category": {"type": "string", "description": "Product category filter"},
79
- "color": {"type": "string", "description": "Color filter"},
80
- "department": {"type": "string", "description": "Department filter (e.g. Men, Women, Unisex)"},
81
- "maxPrice": {"type": "string", "description": "Maximum price filter"},
82
- "minPrice": {"type": "string", "description": "Minimum price filter"},
83
- "sortBy": {"type": "string", "description": "Sort order (e.g. relevance, price_asc, price_desc, rating)"}
84
- },
85
- "required": []
86
- }
87
- }
88
- },
89
- "GetProductDetails": {
90
- "type": "function",
91
- "function": {
92
- "name": "GetProductDetails",
93
- "description": "Get detailed information about a specific product.",
94
- "parameters": {
95
- "type": "object",
96
- "properties": {
97
- "productCode": {"type": "string", "description": "The product code (e.g. SHOE-M-088)"}
98
- },
99
- "required": ["productCode"]
100
- }
101
- }
102
- },
103
- "GetRecommendations": {
104
- "type": "function",
105
- "function": {
106
- "name": "GetRecommendations",
107
- "description": "Get product recommendations based on a product.",
108
- "parameters": {
109
- "type": "object",
110
- "properties": {
111
- "productCode": {"type": "string", "description": "Product code to base recommendations on"}
112
- },
113
- "required": ["productCode"]
114
- }
115
- }
116
- },
117
- "AddToCart": {
118
- "type": "function",
119
- "function": {
120
- "name": "AddToCart",
121
- "description": "Add a product to the shopping cart.",
122
- "parameters": {
123
- "type": "object",
124
- "properties": {
125
- "productCode": {"type": "string", "description": "Product code to add"},
126
- "quantity": {"type": "string", "description": "Quantity to add"},
127
- "size": {"type": "string", "description": "Size selection"},
128
- "color": {"type": "string", "description": "Color selection"}
129
- },
130
- "required": ["productCode", "quantity"]
131
- }
132
- }
133
- },
134
- "ViewCart": {
135
- "type": "function",
136
- "function": {
137
- "name": "ViewCart",
138
- "description": "View the current shopping cart contents.",
139
- "parameters": {"type": "object", "properties": {}}
140
- }
141
- },
142
- "UpdateCart": {
143
- "type": "function",
144
- "function": {
145
- "name": "UpdateCart",
146
- "description": "Update cart item quantity, size, or color. Set quantity to 0 to remove.",
147
- "parameters": {
148
- "type": "object",
149
- "properties": {
150
- "productCode": {"type": "string", "description": "Product code to update (or 'all' to clear cart)"},
151
- "quantity": {"type": "string", "description": "New quantity (0 to remove)"},
152
- "size": {"type": "string", "description": "New size"},
153
- "color": {"type": "string", "description": "New color"}
154
- },
155
- "required": ["productCode", "quantity"]
156
- }
157
- }
158
- },
159
- "Checkout": {
160
- "type": "function",
161
- "function": {
162
- "name": "Checkout",
163
- "description": "Place an order with the current cart.",
164
- "parameters": {
165
- "type": "object",
166
- "properties": {
167
- "shippingMethod": {"type": "string", "description": "Shipping method (Standard or Express)"},
168
- "shopperName": {"type": "string", "description": "Name for the order"}
169
- },
170
- "required": ["shippingMethod"]
171
- }
172
- }
173
- },
174
- # --- Generic CRM tools (fallback for non-shopper agents) ---
175
- "QueryRecords": {
176
- "type": "function",
177
- "function": {
178
- "name": "QueryRecords",
179
- "description": "Query records using natural language.",
180
- "parameters": {
181
- "type": "object",
182
- "properties": {
183
- "query": {"type": "string", "description": "Natural language query"}
184
- },
185
- "required": ["query"]
186
- }
187
- }
188
- },
189
- "IdentifyRecordByName": {
190
- "type": "function",
191
- "function": {
192
- "name": "IdentifyRecordByName",
193
- "description": "Identify a record by its name to get the record ID.",
194
- "parameters": {
195
- "type": "object",
196
- "properties": {
197
- "name": {"type": "string", "description": "The name of the record"},
198
- "objectType": {"type": "string", "description": "The Salesforce object type"}
199
- },
200
- "required": ["name"]
201
- }
202
- }
203
- },
204
- "GetRecordDetails": {
205
- "type": "function",
206
- "function": {
207
- "name": "GetRecordDetails",
208
- "description": "Get detailed information about a specific record by its ID.",
209
- "parameters": {
210
- "type": "object",
211
- "properties": {
212
- "recordId": {"type": "string", "description": "The Salesforce record ID"}
213
- },
214
- "required": ["recordId"]
215
- }
216
- }
217
- },
218
- }
219
-
220
- ROUTING_TOOLS = ['go_to_product_discovery', 'go_to_cart_and_checkout', 'go_to_store_help', 'go_to_off_topic']
221
- ACTION_TOOLS_SHOPPER = ['SearchProducts', 'GetProductDetails', 'GetRecommendations',
222
- 'AddToCart', 'ViewCart', 'UpdateCart', 'Checkout']
223
- GENERIC_CRM_TOOLS = ['QueryRecords', 'IdentifyRecordByName', 'GetRecordDetails']
224
-
225
29
 
226
30
  def _is_routing_tools(tools):
227
31
  """True when ALL tools in the list are routing functions (go_to_* / __end_session_action__).
@@ -270,27 +74,6 @@ def sanitize_tools_for_sfap(tools):
270
74
  return sanitized
271
75
 
272
76
 
273
- def build_tools_for_step(original_tool_name, prompt_text):
274
- """Select the right tool set based on the original tool call and prompt content."""
275
- # If original called a routing tool, offer routing tools
276
- if original_tool_name and original_tool_name.startswith('go_to_'):
277
- return [KNOWN_TOOL_SCHEMAS[t] for t in ROUTING_TOOLS if t in KNOWN_TOOL_SCHEMAS]
278
-
279
- # If original called a shopper action tool, offer shopper tools
280
- if original_tool_name and original_tool_name in ACTION_TOOLS_SHOPPER:
281
- return [KNOWN_TOOL_SCHEMAS[t] for t in ACTION_TOOLS_SHOPPER if t in KNOWN_TOOL_SCHEMAS]
282
-
283
- # Detect from prompt content
284
- if prompt_text:
285
- if 'go_to_product_discovery' in prompt_text or 'go_to_cart' in prompt_text:
286
- return [KNOWN_TOOL_SCHEMAS[t] for t in ROUTING_TOOLS if t in KNOWN_TOOL_SCHEMAS]
287
- if 'SearchProducts' in prompt_text or 'AddToCart' in prompt_text:
288
- return [KNOWN_TOOL_SCHEMAS[t] for t in ACTION_TOOLS_SHOPPER if t in KNOWN_TOOL_SCHEMAS]
289
-
290
- # Fallback to generic CRM tools
291
- return [KNOWN_TOOL_SCHEMAS[t] for t in GENERIC_CRM_TOOLS if t in KNOWN_TOOL_SCHEMAS]
292
-
293
-
294
77
  def extract_tools_from_llm_responses(llm_step_map):
295
78
  """Scan all LLM responses to discover the actual tool names used by the agent."""
296
79
  seen = set()
@@ -309,10 +92,6 @@ def extract_tools_from_llm_responses(llm_step_map):
309
92
  return seen
310
93
 
311
94
 
312
- # Legacy alias for backward compatibility
313
- AGENT_TOOLS = [KNOWN_TOOL_SCHEMAS[t] for t in GENERIC_CRM_TOOLS if t in KNOWN_TOOL_SCHEMAS]
314
-
315
-
316
95
  def read_token():
317
96
  if SFAP_TOKEN_FILE and os.path.exists(SFAP_TOKEN_FILE):
318
97
  with open(SFAP_TOKEN_FILE) as f:
@@ -415,24 +194,6 @@ def convert_stdm_messages_for_sfap(stdm_messages):
415
194
  return out
416
195
 
417
196
 
418
- def prompt_has_tools(prompt_text):
419
- """Check if this prompt includes tool/function calling instructions."""
420
- indicators = [
421
- 'data retrieval functions',
422
- 'QueryRecords',
423
- 'IdentifyRecordByName',
424
- 'GetRecordDetails',
425
- 'TOOL USAGE PROTOCOL',
426
- 'go_to_product_discovery',
427
- 'go_to_cart_and_checkout',
428
- 'go_to_store_help',
429
- 'SearchProducts',
430
- 'AddToCart',
431
- 'Checkout',
432
- ]
433
- return any(ind in prompt_text for ind in indicators)
434
-
435
-
436
197
  def call_sfap(messages, model, tools=None, max_tokens=2048):
437
198
  """Call SFAP chat generations endpoint."""
438
199
  token = read_token()
@@ -880,13 +641,10 @@ def main():
880
641
  print(f" SKIP: Could not parse prompt into messages")
881
642
  continue
882
643
 
883
- # Use tool definitions from STDM step input if available, else fall back
644
+ # Use tool definitions from STDM step input (dynamic-only, no hardcoded fallback)
884
645
  tools = target.get('step_tools')
885
646
  if tools:
886
647
  tools = sanitize_tools_for_sfap(tools)
887
- else:
888
- has_tools = prompt_has_tools(target['prompt'])
889
- tools = build_tools_for_step(target.get('original_tool_name'), target['prompt']) if has_tools else None
890
648
 
891
649
  print(f" Messages: {len(messages)}, Tools: {'yes' if tools else 'no'}")
892
650
 
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: dx-devops-work-item-manage
3
- description: "Use this skill to manage the full lifecycle of DevOps Center work items — list, create, update, commit changes, perform status transitions, and create pull requests. Update fields like subject, description, and status. Commit and push code changes to work item branches. Create pull requests for work item branches via DevOps Center API. Invoke when the user wants to track, find, create, or update a work item, commit changes to a work item branch, advance a work item's status through the pipeline, or create a pull request for code review. Consolidates sf devops work-item and review operations. DO NOT TRIGGER for promotion or deployment operations, or conflict detection."
3
+ description: "Use this skill to manage the full lifecycle of DevOps Center work items — list, create, update, commit changes, perform status transitions, and create pull requests. Update fields like subject, description, and status. Commit changes to work item branches, through the DevOps Center commit API or git. Create pull requests for work item branches via DevOps Center API. Invoke when the user wants to track, find, create, or update a work item, commit changes to a work item branch, advance a work item's status through the pipeline, or create a pull request for code review. Consolidates sf devops work-item and review operations. DO NOT TRIGGER for promotion or deployment operations, or conflict detection."
4
4
  metadata:
5
5
  relatedSkills:
6
6
  - "dx-devops-promote"
7
- version: "1.0"
7
+ version: "1.1"
8
8
  domains: ["Developer Experience"]
9
9
  minApiVersion: "58.0"
10
10
  cliTools:
@@ -34,7 +34,7 @@ Gather or infer before proceeding:
34
34
  - **Operation type**: list, create, update, commit, or create-review
35
35
  - **For list**: project ID (required) — obtain via `sf devops project list --json` if not provided
36
36
  - **For create**: project ID (required), subject (required), description (optional)
37
- - **For commit**: work item name or ID (required) to retrieve branch name, files to commit, commit message
37
+ - **For commit**: work item name or ID (required), commit message, and either the files to commit (git path) or the components to commit (API path). Optional: **dev org alias** — the org that holds the changes. When provided, try the DevOps Center commit API first (see step 5); otherwise use git
38
38
  - **For update**: work item name (e.g., WI-000001) or work item ID (required), fields to update (subject, description, status)
39
39
  - **For create-review**: work item name (e.g., WI-000001) or work item ID (required)
40
40
 
@@ -48,7 +48,7 @@ If the user provides a clear request ("list work items for Project Alpha", "crea
48
48
 
49
49
  ## Workflow
50
50
 
51
- All operations use `sf devops work-item` CLI commands with `--json` output for structured consumption.
51
+ Operations use `sf devops work-item` CLI commands with `--json` output; the API commit path also uses `sf api request rest` and `sf data query`.
52
52
 
53
53
  ### Phase 1 — Identify Operation
54
54
 
@@ -71,6 +71,7 @@ All operations use `sf devops work-item` CLI commands with `--json` output for s
71
71
  ```
72
72
  - Verify the authenticated org has DevOps Center enabled by attempting to list projects
73
73
  - If the user wants to target a specific org, use `--target-org <alias>` on all subsequent commands
74
+ - For the API commit path, run `sf org display --target-org <alias> --json` for **both** the dev org and the hub org
74
75
 
75
76
  3. **List work items** — when the user wants to see existing work items:
76
77
  ```bash
@@ -102,9 +103,21 @@ All operations use `sf devops work-item` CLI commands with `--json` output for s
102
103
  - Capture the returned work item name (e.g., WI-000001), branch name, and environment from JSON output for future operations
103
104
  - Idempotent: if the user attempts to create a duplicate (same subject + project), check via list first and return the existing work item
104
105
 
105
- 5. **Execute commit operation** — when operation type is commit:
106
- - DevOps Center creates a dedicated feature branch for each work item (returned in the create operation)
107
- - The user must commit and push changes to this branch before transitioning status or creating a PR
106
+ 5. **Execute commit operation** — when operation type is commit. Choose the path first:
107
+ - **API path** — only when the user gave a dev org alias AND the changes are already deployed in that dev org (if unsure, ask: deploy with `sf project deploy start`, or use git). Dev org alias: `commitChanges`, `DevopsRequestInfo`. Hub alias: `sf devops` and `WorkItemComponentList`. DevOps Center retrieves the named components from the dev org and commits them as `DevOps Center <noreply@salesforce.com>`.
108
+ - **Git path** — everything else. If the changes exist only in the dev org, run `sf project retrieve start --target-org <dev-org>` first.
109
+
110
+ **API path** (commands, body, error codes and polling in `references/commit-api.md`):
111
+ 1. Preflight `GET /connect/devops/doceConnectionType` on the dev org; a failed call (non-zero exit or error body) or `isCore` not `true` means use the git path.
112
+ 2. `sf devops project list` → project id, then `sf devops work-item list --project-id <id> --target-org <hub>` → work item id and name. Status must be New, In Progress, In Review or Ready to Promote.
113
+ 3. `POST /connect/devops/commitChanges` on the **dev org**; the body is the inner object (no `commitChanges` wrapper).
114
+ 4. A failed call, or `status: "ERROR"` with `reqId` = `CODE:message`: surface it and stop.
115
+ 5. If the POST `status` is `SUCCESS` (accepted only), poll `DevopsRequestInfo WHERE RequestToken = '<reqId>'` on the dev org every 10 seconds until `Status` is `SUCCESS` or `ERROR` (report `Message`/`ErrorDetails`), 12-minute deadline. Past it the request is stuck; report it and do not retry automatically.
116
+ 6. Confirm a new `WorkItemComponentList` exists on the hub before creating a review.
117
+
118
+ **Git path:**
119
+ - If the work item is New, first set it to In Progress (step 6); the hub ignores pushes made while it is New
120
+ - Use the work item's `branch` field as the branch
108
121
  - Standard git workflow:
109
122
  ```bash
110
123
  git checkout <branch-name>
@@ -112,8 +125,7 @@ All operations use `sf devops work-item` CLI commands with `--json` output for s
112
125
  git commit -m "<commit-message>"
113
126
  git push origin <branch-name>
114
127
  ```
115
- - The branch name is available from the work item's `branch` field (retrieve via list or create operation)
116
- - Changes must be committed before the work item can be marked "Ready to Promote" or before creating a PR
128
+ - The hub registers the push asynchronously; re-check it before creating a PR
117
129
 
118
130
  6. **Update work item** — when the user wants to change subject, description, or status:
119
131
  ```bash
@@ -162,7 +174,8 @@ All operations use `sf devops work-item` CLI commands with `--json` output for s
162
174
  8. **Verify operation success**:
163
175
  - **For list**: confirm the CLI returned status 0, parse the JSON `.result[]` array, and verify it contains work items (or is empty if no matches). If the user specified a project by name, confirm the resolved project ID matches.
164
176
  - **For create**: verify the CLI returned status 0 and the JSON output contains `.result.name` (work item ID like WI-000001), `.result.branch` (branch name), and `.result.environment` fields.
165
- - **For commit**: verify each git command returned exit code 0. If `git push` succeeds, the commit is saved to the work item branch.
177
+ - **For commit (git path)**: verify each git command returned exit code 0. If `git push` succeeds, the commit is saved to the work item branch; the hub registers it asynchronously.
178
+ - **For commit (API path)**: verify the POST `status`, then `DevopsRequestInfo.Status`, are `SUCCESS`, and that a new `WorkItemComponentList` with a `CommitReference` exists on the hub. A new list with an empty `CommitReference` means nothing new was committed; report that, not a clean success.
166
179
  - **For update (general fields)**: verify the CLI returned status 0 and compare the returned JSON fields against the user's requested changes. If updating subject, confirm `.result.subject` matches the new value.
167
180
  - **For update (status transition)**: verify the CLI returned status 0, then **explicitly confirm the status transition** by checking `.result.status` in the JSON response matches the target status (e.g., "Ready to Promote"). If the response doesn't include the status field, re-run `sf devops work-item list` filtered to this work item and verify the status persisted.
168
181
  - **For create-review**: verify the CLI returned status 0 and the JSON output contains `.result.pullRequestUrl` (the PR URL) and `.result.status` (should be "open" or equivalent). If VCS credentials are missing, the CLI returns an error — surface this to the user.
@@ -170,7 +183,7 @@ All operations use `sf devops work-item` CLI commands with `--json` output for s
170
183
  9. **Report results**:
171
184
  - **List**: present work items in a readable format showing work item name, subject, status, branch, and environment. If filtering by status was requested, show only matching work items.
172
185
  - **Create**: return the work item name (e.g., WI-000001), branch name, environment, and confirm "Work item created successfully."
173
- - **Commit**: confirm which files were staged, the commit SHA (from git output), and "Changes committed and pushed to branch <branch-name>."
186
+ - **Commit**: git path — confirm which files were staged, the commit SHA (from git output), and "Changes committed and pushed to branch <branch-name>." API path — confirm the `reqId`, components committed and hub `CommitReference` (author is DevOps Center)
174
187
  - **Update (general)**: confirm which fields changed with before/after values (e.g., "Subject updated from 'X' to 'Y'").
175
188
  - **Status transition**: explicitly state the transition with old → new status (e.g., "Status updated: In Progress → Ready to Promote").
176
189
  - **Create-review**: return the PR URL and confirm "Pull request created successfully. Status: open. URL: <url>"
@@ -187,7 +200,9 @@ All operations use `sf devops work-item` CLI commands with `--json` output for s
187
200
  | At least one update field required | Update command fails if no `--subject`, `--description`, or `--status` flag is provided |
188
201
  | Status values must be exact strings | "In Progress" and "Ready to Promote" (with spaces, proper capitalization); other values fail |
189
202
  | Idempotent create operations | Check for existing work item with same subject + project before creating duplicates |
190
- | Changes must be committed before status transition to Ready to Promote | DevOps Center validates that the work item branch has commits before allowing promotion readiness |
203
+ | Commit before creating a PR | Commit first and confirm a component list exists on the hub before `review create` |
204
+ | API commit only sends components already in the dev org | The API retrieves from the dev org, not from local disk; deploy local-only edits first (`sf project deploy start`) or use the git path |
205
+ | Check `status` in the commit API response | Errors are returned as HTTP 200 with `status: "ERROR"` |
191
206
  | PR creation requires VCS credentials in org | DevOps Center API uses stored VCS credentials; no local git auth needed |
192
207
  | Never use interactive prompts | Skills run in headless environments; all inputs must be via CLI flags |
193
208
 
@@ -205,6 +220,8 @@ All operations use `sf devops work-item` CLI commands with `--json` output for s
205
220
  | **Invalid status value** | Only "In Progress" and "Ready to Promote" are valid (exact strings with spaces); check spelling and capitalization |
206
221
  | **Project not found** | User provided invalid project ID; run `sf devops project list --json` to show available projects |
207
222
  | **Duplicate work item subject** | Idempotent create check should catch this; return existing work item name instead of creating duplicate |
223
+ | **Commit pushed while work item is New** | The hub ignores external pushes for New work items; set In Progress first and, if already pushed, re-check after the status change |
224
+ | **API commit still in progress past the deadline** | Report it as stuck; do not retry automatically (a new request could race it) |
208
225
  | **Git push fails - no commits or branch not found** | Verify files are staged with `git status` and branch name retrieved from work item via list command |
209
226
  | **PR creation fails - VCS credentials** | VCS credentials not configured in DevOps Center UI; instruct user to configure in Setup → DevOps Center → VCS Credentials |
210
227
 
@@ -216,7 +233,7 @@ Deliverables vary by operation:
216
233
 
217
234
  - **List**: JSON array of work items with work item name (WI-######), subject, branch, environment, repository details
218
235
  - **Create**: Work item name (e.g., WI-000001), ID, branch name, and environment of the newly created work item
219
- - **Commit**: Confirmation of git commit and push success, with commit SHA
236
+ - **Commit**: Confirmation of git commit and push success with commit SHA, or for the API path the `reqId`, final request status and `CommitReference`
220
237
  - **Update**: Confirmation of updated fields (old value → new value for subject/description, or status change)
221
238
  - **Create-review**: Pull request URL, PR number, and status
222
239
 
@@ -247,10 +264,9 @@ Before reporting results to the user:
247
264
  - [ ] Was `--project-id` provided (or obtained via project list)?
248
265
 
249
266
  ### Commit Operation Checks
250
- - [ ] Was the work item branch name retrieved successfully?
251
- - [ ] Were files staged with `git add`?
252
- - [ ] Did `git commit` succeed with exit code 0?
253
- - [ ] Did `git push` succeed with exit code 0?
267
+ - [ ] API path: preflight passed, POST `status` checked, `DevopsRequestInfo` polled to `SUCCESS`, new `WorkItemComponentList` with `CommitReference` seen on the hub?
268
+ - [ ] Git path: was the work item In Progress, and the branch name retrieved?
269
+ - [ ] Git path: did `git add`, `git commit` and `git push` all exit 0?
254
270
 
255
271
  ### Update Operation Checks
256
272
  - [ ] Was work item identifier provided (name or ID)?
@@ -269,5 +285,6 @@ Before reporting results to the user:
269
285
 
270
286
  | File | When to read |
271
287
  |------|-------------|
288
+ | `references/commit-api.md` | When committing through the DevOps Center API: request body, response and error codes, polling, preflight |
272
289
  | `references/cli-commands.md` | When you need detailed CLI flag documentation, JSON output schemas, or error handling patterns |
273
290
  | `examples/common-workflows.md` | When the user's request matches a common pattern (bulk updates, reassignment, idempotent creation, sequential transitions) |
@@ -477,3 +477,52 @@ Real-world examples of typical work item operations in DevOps Center autonomous
477
477
  ```
478
478
 
479
479
  > **Note:** The CLI will return a non-zero status with error name `PR_ALREADY_EXISTS` if a PR already exists for that work item.
480
+
481
+ ---
482
+
483
+ ## Workflow 16: Commit Through the DevOps Center API (with git fallback)
484
+
485
+ **User request:** "Commit the HelloWorld class to WI-000001. My changes are in the dev org <dev-org>."
486
+
487
+ **Steps:**
488
+
489
+ 1. **Preflight on the dev org** (both orgs must be authenticated):
490
+ ```bash
491
+ sf api request rest "/services/data/v67.0/connect/devops/doceConnectionType" --target-org <dev-org>
492
+ ```
493
+ `{"isCore": true}` → continue. A failed call or `isCore` not `true` → use the git path (Workflow 3).
494
+
495
+ 2. **Look up the work item on the hub** (status must be New, In Progress, In Review or Ready to Promote):
496
+ ```bash
497
+ sf devops project list --target-org <hub-org> --json
498
+ sf devops work-item list --project-id <project-id> --target-org <hub-org> --json \
499
+ | jq '.result.workItems[] | select(.name == "WI-000001")'
500
+ ```
501
+
502
+ 3. **Commit** (body is the inner object, no wrapper; take `workItemId`/`projectId` from step 2):
503
+ ```bash
504
+ BODY=$(mktemp)
505
+ cat > "$BODY" <<'JSON'
506
+ {"isCommitCore":"true","workItemId":"<work-item-id>","projectId":"<project-id>",
507
+ "workItemName":"WI-000001","workItemLink":"<work item url>","commitMessage":"Update HelloWorld",
508
+ "changes":[{"fullName":"HelloWorld","type":"ApexClass","operation":"modify"}]}
509
+ JSON
510
+ sf api request rest "/services/data/v67.0/connect/devops/commitChanges" --method POST --body @"$BODY" --target-org <dev-org>
511
+ rm "$BODY"
512
+ ```
513
+ Expect `{"reqId":"<uuid>","status":"SUCCESS"}` (accepted). If the call fails or `status` is `ERROR`, report the error (`CODE:message` in `reqId`) and stop.
514
+
515
+ 4. **Poll until `SUCCESS` or `ERROR`** (every 10 s, up to 12 min):
516
+ ```bash
517
+ sf data query --target-org <dev-org> --json \
518
+ -q "SELECT Status, Message, ErrorDetails FROM DevopsRequestInfo WHERE RequestToken = '<reqId>'"
519
+ ```
520
+
521
+ 5. **Confirm on the hub**, then offer to create the review:
522
+ ```bash
523
+ sf data query --target-org <hub-org> --json \
524
+ -q "SELECT Name, CommitReference FROM WorkItemComponentList WHERE WorkItemId = '<work-item-id>' ORDER BY CreatedDate"
525
+ ```
526
+ A new row with a `CommitReference` means the commit was recorded.
527
+
528
+ **Fallback:** if the preflight fails, retrieve the changes with `sf project retrieve start --target-org <dev-org>` if they exist only in the dev org, set the work item to In Progress if it is New, then follow Workflow 3 and re-check the hub before creating the PR.