@salesforce/afv-skills 1.68.0 → 1.69.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 (188) hide show
  1. package/package.json +1 -1
  2. package/skills/afcc-setup-coordinate/SKILL.md +348 -0
  3. package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
  4. package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
  5. package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
  6. package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
  7. package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
  8. package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
  9. package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
  10. package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
  11. package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
  12. package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
  13. package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
  14. package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
  15. package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
  16. package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
  17. package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
  18. package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
  19. package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
  20. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
  21. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
  22. package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
  23. package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
  24. package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
  25. package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
  26. package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
  27. package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
  28. package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
  29. package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
  30. package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
  31. package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
  32. package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
  33. package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
  34. package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
  35. package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
  36. package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
  37. package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
  38. package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
  39. package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
  40. package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
  41. package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
  42. package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
  43. package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
  44. package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
  45. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
  46. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
  47. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
  48. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
  49. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
  50. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
  51. package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
  52. package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
  53. package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
  54. package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
  55. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
  56. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
  57. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
  58. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
  59. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
  60. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
  61. package/skills/commerce-react-storefront-create/SKILL.md +54 -21
  62. package/skills/dx-lifecycle-center/SKILL.md +24 -18
  63. package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
  64. package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
  65. package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
  66. package/skills/dx-lifecycle-center/references/deploy.md +3 -3
  67. package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
  68. package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
  69. package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
  70. package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
  71. package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
  72. package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
  73. package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
  74. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
  75. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
  76. package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
  77. package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
  78. package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
  79. package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
  80. package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
  81. package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
  82. package/skills/experience-afv-analytics-query/SKILL.md +239 -0
  83. package/skills/experience-afv-analytics-query/references/references.md +176 -0
  84. package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
  85. package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
  86. package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
  87. package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
  88. package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
  89. package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
  90. package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
  91. package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
  92. package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
  93. package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
  94. package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
  95. package/skills/experience-app-mcp-generate/SKILL.md +174 -0
  96. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
  97. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
  98. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
  99. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
  100. package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
  101. package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
  102. package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
  103. package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
  104. package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
  105. package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
  106. package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
  107. package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
  108. package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
  109. package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
  110. package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
  111. package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
  112. package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
  113. package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
  114. package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
  115. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
  116. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
  117. package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
  118. package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
  119. package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
  120. package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
  121. package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
  122. package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
  123. package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
  124. package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
  125. package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
  126. package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
  127. package/skills/platform-custom-field-generate/SKILL.md +24 -16
  128. package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
  129. package/skills/platform-custom-setting-generate/SKILL.md +1 -0
  130. package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
  131. package/skills/platform-flexipage-generate/SKILL.md +7 -10
  132. package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
  133. package/skills/platform-policy-rule-generate/SKILL.md +9 -7
  134. package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
  135. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
  136. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
  137. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
  138. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
  139. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
  140. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
  141. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
  142. package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
  143. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
  144. package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
  145. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  146. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
  147. package/skills/platform-report-generate/SKILL.md +20 -1
  148. package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
  149. package/skills/platform-report-generate/references/verification-checklist.md +12 -0
  150. package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
  151. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
  152. package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
  153. package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
  154. package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
  155. package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
  156. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
  157. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
  158. package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
  159. package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
  160. package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
  161. package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
  162. package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
  163. package/skills/service-e911-configure/SKILL.md +242 -0
  164. package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
  165. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
  166. package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
  167. package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
  168. package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
  169. package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
  170. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
  171. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
  172. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
  173. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
  174. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
  175. package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
  176. package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
  177. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
  178. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
  179. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
  180. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
  181. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
  182. package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
  183. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
  184. package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
  185. package/skills/experience-content-media-image-generate/SKILL.md +0 -83
  186. package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
  187. package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
  188. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
@@ -9,10 +9,10 @@ Worked prompts, grouped by operation (`SKILL.md`, Operations). Listing, status c
9
9
  **A1. "Show the list of connected orgs I can deploy to."**
10
10
 
11
11
  ```bash
12
- bash <skill_dir>/scripts/resolve-environment.sh my-dev-org
12
+ bash scripts/resolve-environment.sh my-dev-org
13
13
  ```
14
14
 
15
- Reply with only the table and the closing sentence (`references/list-orgs.md`, section 4). The Lifecycle Center org is not in it and is not mentioned.
15
+ Run the resolver with `--check-sessions`. Reply with the table of usable orgs, the action buttons (Sync / Re-sync / Refresh, and **Sync all N** when two or more rows need it), the one left-out line when some rows are `needs-signin` or `retired`, and the closing sentence (`references/list-orgs.md`, section 4). There is no status column. The Lifecycle Center org is not part of the deploy targets. The list never syncs by itself.
16
16
 
17
17
  **A2. "What org am I in?"**
18
18
 
@@ -20,7 +20,7 @@ Answer from the `source` block: alias, username, URL, and org id. Nothing else.
20
20
 
21
21
  **A3. The query fails because the session expired.**
22
22
 
23
- The script reports "query failed, not an enablement problem". Say the error plainly and tell them to reconnect the source org (Reconnect prompt in Builder Central, or `sf org login web --alias <alias>` on a local CLI), then try again. Never say DX Inspector is disabled.
23
+ The script reports "query failed, not an enablement problem". Say the error plainly and tell them to reconnect the source org (Reconnect prompt in Builder Central, or `sf org login web --alias "<alias>"` on a local CLI), then try again. Never say DX Inspector is disabled.
24
24
 
25
25
  **A4. The query fails because DX Inspector is off.**
26
26
 
@@ -28,7 +28,23 @@ The script reports "DevOps Center not enabled or no access". Reply only: "DX Ins
28
28
 
29
29
  **A5. "Show my DevOps Center orgs."**
30
30
 
31
- The phrase is plural, so it is not the Lifecycle Center org. List the environments (A1) and do not mention the hub.
31
+ The phrase is plural, so it is not the Lifecycle Center org. List the environments (A1). The hub appears only as its labelled row, when connected.
32
+
33
+ **A6. Org connected in DX Inspector, not in Builder Central.**
34
+
35
+ The row is listed (the list reads DX Inspector environments) but the resolver says `needs-sync`: no workspace CLI alias exists. The row gets a **Sync `<name>`** button. A click sends `Sync workspace access for <name>`, which runs the sync procedure (`references/connect-org.md`, *Sync workspace access*): one PATCH with `?registerWorkspaceAlias=true`, no sign-in, a check after about 5 seconds, then the list again.
36
+
37
+ **A7. "Sync all" with a mix of states.**
38
+
39
+ Three rows: `QA` needs-sync, `UAT` needs-refresh, `Prod` ready. Buttons: **Sync all 2**, **Refresh UAT**, **Sync QA**, **Re-sync Prod**. Sync all runs QA then UAT, one PATCH each and never in parallel, and reports one line each. A failure on one does not stop the other.
40
+
41
+ **A8. Name clash.**
42
+
43
+ An alias named `UAT` already points at a different org, so the row is `alias-conflict` and gets **Fix name UAT**. Do not PATCH: it would overwrite the other org's alias. Offer `sf alias unset UAT` then a sync, or connecting under another name.
44
+
45
+ **A9. The user replies with an action.**
46
+
47
+ The actions under the table are plain text. A reply such as `Sync DevSand` or `Sync all 3` is the confirmation: run the sync procedure for those rows, then show the list again.
32
48
 
33
49
  ---
34
50
 
@@ -36,11 +52,11 @@ The phrase is plural, so it is not the Lifecycle Center org. List the environmen
36
52
 
37
53
  **B1. "Connect a new sandbox."**
38
54
 
39
- 1. Ask for the environment name (letters only). The type is `SANDBOX`; confirm it.
55
+ 1. Ask for the environment name. The type is `SANDBOX`; confirm it.
40
56
  2. Check the org is not already connected (`references/connect-org.md`, Step 0).
41
57
  3. After the user confirms, `POST /connect/devops/environment`.
42
- 4. Give the `redirectUrl` as a clickable link and wait for **done**. Never say a browser was opened.
43
- 5. `PATCH /connect/devops/environment/<id>`, then list again and confirm the new row shows its URL and org id.
58
+ 4. Show the sign-in as in `connect-org.md` Step 2 and wait for **done**. Never say a browser was opened.
59
+ 5. `PATCH /connect/devops/environment/<id>?registerWorkspaceAlias=true --body '{}'` (the CLI rejects a PATCH with no body), then list again and confirm the new row shows its URL and org id (if the resolver reports `needs-sync`, wait about 5 seconds once and check again; if it still does, say the org is connected and deployable but has no CLI alias here).
44
60
 
45
61
  **B2. "Connect https://mydomain--qa.sandbox.my.salesforce.com."**
46
62
 
@@ -60,16 +76,15 @@ The row shows as not authenticated. Do not POST again. Get a fresh link with `GE
60
76
 
61
77
  **B6. What the user sees while connecting.**
62
78
 
63
- Sign-in (Step 2):
79
+ Sign-in (Step 2), a heading, one line of instructions, and a single **Sign in to `QA`** link that opens the login page:
64
80
 
65
81
  > **Connect `QA`**
66
82
  >
67
- > **[Sign in to `QA` →](https://mydomain--qa.sandbox.my.salesforce.com/services/oauth2/authorize?...)**
68
- >
69
- > 1. Sign in with the user DX Inspector should act as, and approve access.
70
- > 2. Come back here and reply **done**.
83
+ > Sign in with the user DX Inspector should act as, and approve access. Then come back here and reply **done**.
71
84
  >
72
- > Link not working? Copy it: `https://mydomain--qa.sandbox.my.salesforce.com/services/oauth2/authorize?...`
85
+ > `[ Sign in to QA ]`
86
+
87
+ The link is the full `redirectUrl`, also repeated once as "Link not working? Copy it".
73
88
 
74
89
  Connected (Step 5):
75
90
 
@@ -79,7 +94,23 @@ Connected (Step 5):
79
94
  > |---|---|---|
80
95
  > | `mydomain--qa.sandbox.my.salesforce.com` | Sandbox | Ready to deploy to |
81
96
 
82
- The Lifecycle Center org uses the same two layouts with its own heading, button text, and a Hub type column. When the `render_widget` tool is available, it shows them as cards instead (C7).
97
+ The Lifecycle Center org uses the same two layouts with its own heading, button text, and a Hub type column.
98
+
99
+ **B7. "sf command failed: Session expired or invalid" on `--target-org "QA"`.**
100
+
101
+ Run the sync procedure for `QA`: resolve the row from the alias, PATCH once with `?registerWorkspaceAlias=true`, check after about 5 seconds, then retry the command once. If the PATCH fails with 401 or 403, the stored sign-in is stale: show a fresh sign-in link, wait for **done**, PATCH once. If the alias is not a DX Inspector environment, offer to connect it; do not PATCH anything. Never retry with another alias or `default-org`.
102
+
103
+ **B8. The PATCH times out.**
104
+
105
+ `TARGET_ORG_AUTHENTICATION_TIMEOUT` (408/504) is transient. Wait about 10 seconds and PATCH once more. If it times out again, say "`QA` didn't respond in time. Try again in a few minutes." Do not show a sign-in button and do not call the credential stale.
106
+
107
+ **B9. Sync succeeds but the alias never appears.**
108
+
109
+ The PATCH returns success, yet the resolver still says `needs-sync` after one repeat. Registration is best effort on the server: the feature may be off for the org, no workspace may be running, or the name has spaces (Core may still skip those) or is `default-org`. Say the org is connected and deploys work, but its CLI alias isn't available here. Stop; do not loop.
110
+
111
+ **B10. Environment name with a space.**
112
+
113
+ "Connect `My UAT`." Accept `My UAT` as is. If the sync leaves it `needs-sync`, Core skipped the spaced name: say the org is connected but has no CLI alias, and offer `MyUAT` only as an optional rename. Every command uses `--target-org "My UAT"`.
83
114
 
84
115
  ---
85
116
 
@@ -97,7 +128,7 @@ These are spelling variants of the same name. Normalize (lowercase, drop spaces
97
128
 
98
129
  **C6. Wording variants of the other operations.**
99
130
 
100
- After normalizing, these route the same way as the plain phrase: "Pls push AccountService into my QA-sandbox", "ship my flows to prod", "deployment to org-farm env", "dry run to my sandbox" → **D**. "Hook up a new scratch-org", "add sandbx", "sign in to prod", "set up an orgfarm env" → **B** (scratch and `sandbx` are `SANDBOX`, prod is `PRODUCTION`). "which envs can I use", "show linked orgs", "where can I deploy" → **A**.
131
+ After normalizing, these route the same way as the plain phrase: "Pls push AccountService into my QA-sandbox", "ship my flows to prod", "publish AccountService to my QA sandbox", "deployment to org-farm env", "dry run to my sandbox" → **D**. "Hook up a new scratch-org", "add sandbx", "sign in to prod", "set up an orgfarm env" → **B** (scratch and `sandbx` are `SANDBOX`, prod is `PRODUCTION`). "which envs can I use", "show linked orgs", "where can I deploy" → **A**.
101
132
 
102
133
  **C2. "Is the Lifecycle Center org connected?"**
103
134
 
@@ -109,21 +140,7 @@ Make no API call. Ask: "Do you mean the Lifecycle Center org, or a different org
109
140
 
110
141
  **C4. "Why isn't the Lifecycle Center org in my list?"**
111
142
 
112
- Say it is the Lifecycle Center hub, kept separate from deploy targets, and is never part of the deploy list.
113
-
114
- **C7. "Connect the Lifecycle Center org", in a chat that has the `render_widget` tool.**
115
-
116
- 1. Check the credential and, after confirming, create it as in C1. With the `redirectUrl` from the POST after the `&amp;` fix, run:
117
-
118
- ```bash
119
- bash <skill_dir>/scripts/widget.sh connect-sign-in '{"signInUrl":"https://<dev-org-host>/services/oauth2/authorize?..."}'
120
- ```
121
-
122
- It prints `CARD_JSON {"nodes":{"definition":"tile/widget","children":[...]}}`.
123
- 2. Call `render_widget` once with the JSON after `CARD_JSON`, exactly as printed, and write no other text about the sign-in. The chat shows a **Sign in to Lifecycle Center** card with the steps and a **Connect to Lifecycle Center org** button.
124
- 3. After **done**, run Steps 3 to 5. The status check passes and the type call answers Core, so run `bash <skill_dir>/scripts/widget.sh connect-connected '{"hubHost":"<hub-host>","hasHubType":true,"hubTypeLabel":"Core"}'` and call `render_widget` once with its JSON. The card reads "Connected to Lifecycle Center", the org host, and "Hub type: Core".
125
-
126
- If `widget.sh` prints `CARD_UNAVAILABLE <reason>` or fails, or `render_widget` answers `{rendered: false, reason}`, use the Markdown layouts of B6 in hub form instead.
143
+ Say it is the Lifecycle Center hub, kept separate from deploy targets, and is never a deploy target.
127
144
 
128
145
  ---
129
146
 
@@ -132,7 +149,7 @@ If `widget.sh` prints `CARD_UNAVAILABLE <reason>` or fails, or `render_widget` a
132
149
  **D1. "Deploy AccountService to https://mydomain--mysandbox.sandbox.my.salesforce.com."**
133
150
 
134
151
  ```bash
135
- bash <skill_dir>/scripts/resolve-environment.sh my-dev-org https://mydomain--mysandbox.sandbox.my.salesforce.com
152
+ bash scripts/resolve-environment.sh my-dev-org https://mydomain--mysandbox.sandbox.my.salesforce.com
136
153
  ```
137
154
 
138
155
  - `matched` and `selectable`: confirm the row back with name, URL, and org id, build the request, show the Step 4 confirmation, then submit.
@@ -157,7 +174,7 @@ Make no API call. Ask one question: which components to deploy. Then ask for the
157
174
  State what you will validate, then submit with `"isCheckDeploy": true` (`references/request-body.md`), then:
158
175
 
159
176
  ```bash
160
- bash <skill_dir>/scripts/poll-deploy-status.sh <requestId> my-dev-org 10 100
177
+ bash scripts/poll-deploy-status.sh <requestId> "my-dev-org" 10 100
161
178
  # Exit codes: 0 succeeded, 2 failed or not found, 3 timeout, 1 usage or call error (4 only with --once)
162
179
  ```
163
180
 
@@ -168,13 +185,13 @@ On success, report the validation id from `metadata.deployId` and offer a quick
168
185
  Skip the component and target steps. Poll once:
169
186
 
170
187
  ```bash
171
- bash <skill_dir>/scripts/poll-deploy-status.sh --once <requestId> my-dev-org
188
+ bash scripts/poll-deploy-status.sh --once <requestId> "my-dev-org"
172
189
  # Exit 4 means still processing: report the status and step
173
190
  ```
174
191
 
175
192
  **D9. The deploy takes more than 2 minutes.**
176
193
 
177
- The poll exits `3`. Reply: "Your deploy is still running. Request id: `<requestId>`. Send me this id and I'll check its status." Stop polling. When the user sends the id, run `bash <skill_dir>/scripts/poll-deploy-status.sh --once <requestId> my-dev-org` and report the status in plain language.
194
+ The poll exits `3`. Reply: "Your deploy is still running. Request id: `<requestId>`. Send me this id and I'll check its status." Stop polling. When the user sends the id, run `bash scripts/poll-deploy-status.sh --once <requestId> "my-dev-org"` and report the status in plain language.
178
195
 
179
196
  **D8. The user gives only an id starting `0Af`.**
180
197
 
@@ -187,3 +204,9 @@ Deploy to the first, report, then ask before starting the second. Each target ge
187
204
  **D7. The target answers `Bad_OAuth_Token` or `TARGET_ORG_SESSION_EXPIRED`.**
188
205
 
189
206
  The stored login for that environment is stale. Say so, reconnect that environment (`references/connect-org.md`, repair path), and ask before trying the deploy again.
207
+
208
+ ### A10. Org connected by another user
209
+
210
+ User: "list my orgs". The resolver returns `UatOrg` with `userAuth: notConfigured` (`needs-my-signin`) and `DevSand` as `needs-sync`.
211
+
212
+ Reply: the table, then buttons **Sign in as me: UatOrg** and **Sync DevSand**, and the line "1 org was connected by someone else; sign in to use it." No Sync button for UatOrg, and it is not in Sync all. On the sign-in click, run the repair path (fresh link, login as this user, PATCH once), then rebuild the list.
@@ -15,7 +15,7 @@ Part of the DevOps Center Connect API (v67.0).
15
15
  | Method | Path | Body | Result |
16
16
  |---|---|---|---|
17
17
  | POST | `/connect/devops/environment` | `{envName, orgType, isDevEnv?, replaceEnvironmentId?}` | `{id, name, namedCredential, externalCredential, redirectUrl, orgType, isDevEnv}` |
18
- | PATCH | `/connect/devops/environment/{id}` | none | `{id, organizationId, orgUrl, status, message}` after the login. `name` and `namedCredential` are not returned; keep them from the POST |
18
+ | PATCH | `/connect/devops/environment/{id}` | optional query `registerWorkspaceAlias=true` (connect only) | `{id, organizationId, orgUrl, status, message}` after the login. `name` and `namedCredential` are not returned; keep them from the POST |
19
19
  | GET | `/connect/devops/environment/{id}` | none | The environment, with a fresh `redirectUrl` pinned to the row's org URL: use it for the repair link |
20
20
  | DELETE | `/connect/devops/environment/{id}` | none | Removes the NC/EC and the row |
21
21
 
@@ -66,8 +66,37 @@ The POST is **idempotent**: existing NCs and ECs are reused. Errors inside steps
66
66
 
67
67
  Error wrapping: `DOCE_AUTHENTICATION_FAILED:<msg>` or `DOCE_AUTH_UNKNOWN_ERROR:<msg>` (500), and `INVALID_INPUT` (400).
68
68
 
69
+ ### Workspace alias registration (`registerWorkspaceAlias=true`)
70
+
71
+ After the PATCH commits, Core resolves the running workspace (the local container when the local-workspace gate is open, else the user's remote workspace and its proxy token), gets a fresh access token and instance URL from the Named Credential, and posts them from a background thread:
72
+
73
+ ```text
74
+ POST {workspaceUrl}/auth-service/v1/auths/
75
+ { "alias": "<envName>", "accessToken": "...", "instanceUrl": "...", "setDefault": false }
76
+ ```
77
+
78
+ It retries up to 10 times on 502, 503, or 504 while the workspace boots and stops at once on any other error. Failures are logged and swallowed, so the PATCH response never shows them. The auth service validates the token against the org, stores the login in `~/.sfdx/<username>.json`, and maps the alias; an existing username just gets its token updated. To check from inside the workspace (never print the token):
79
+
80
+ ```bash
81
+ sf alias list
82
+ sf org list --json # the environment name appears as an alias
83
+ ```
84
+
85
+ Builder Central itself registers only the signed-in org, as `default`. It does not create aliases for DevOps environments, so this PATCH is the only way a connected environment gets one. A token that has expired shows as `Session expired or invalid` on `sf`: repeat the PATCH once to overwrite it.
86
+
87
+ Two logins can go stale, and they are fixed differently:
88
+
89
+ | Login | Held by | Stale shows as | Fix |
90
+ |---|---|---|---|
91
+ | Workspace alias token | The workspace auth-service (`~/.sfdx`) | `sf` says `Session expired or invalid`; `resolve-environment.sh --check-sessions` reports `needs-refresh` | Repeat the PATCH once (no browser) |
92
+ | DX Inspector credential | The Named Credential and External Credential in the source org | Only at deploy time (`Bad_OAuth_Token`, `TARGET_ORG_SESSION_EXPIRED`), or the PATCH itself fails on auth | Repair path: sign-in button, login, PATCH |
93
+
94
+ The PATCH reads its token from the Named Credential, so a stale DX Inspector credential can never be fixed by repeating it; that is why a PATCH that fails on auth moves to the repair path.
95
+
69
96
  ### PATCH: finalize after the OAuth login
70
97
 
98
+ `/connect/devops/environment/{id}` also accepts the optional query `registerWorkspaceAlias=true`. When set, after the steps below Core registers the environment name as an org alias in the caller's running Builder Central workspace (same auth store as `default-org`). It is best effort and never changes the response or fails the PATCH.
99
+
71
100
  Server behavior (`updateNamedCredentialsForDevops`):
72
101
 
73
102
  1. Returns `404 Named credential does not exist: <name>` if the NC is missing.
@@ -88,18 +117,18 @@ Use the standard Named Credentials Connect API in the dev org:
88
117
  ```bash
89
118
  # External credential and its per-user principal status
90
119
  sf api request rest "/services/data/v<ver>/named-credentials/external-credentials/<name>" \
91
- --target-org <dev-org-alias>
120
+ --target-org "<dev-org-alias>"
92
121
  # → principals[].principalType == "PerUserPrincipal", principals[].authenticationStatus == "Configured" | "NotConfigured"
93
122
 
94
123
  # Named credential callout URL
95
124
  sf api request rest "/services/data/v<ver>/named-credentials/named-credential-setup/<name>" \
96
- --target-org <dev-org-alias>
125
+ --target-org "<dev-org-alias>"
97
126
  # → calloutUrl (placeholder login host before PATCH, org My Domain after); calloutStatus "Enabled"
98
127
 
99
128
  # List named credentials (diagnostics only; deploy targets come from DevopsEnvironment)
100
129
  sf data query --use-tooling-api \
101
130
  --query "SELECT DeveloperName FROM NamedCredential ORDER BY CreatedDate DESC" \
102
- --target-org <dev-org-alias> --json
131
+ --target-org "<dev-org-alias>" --json
103
132
  ```
104
133
 
105
134
  Tooling `NamedCredential.Endpoint` is `null` for these `SecuredEndpoint` credentials, so always read `calloutUrl` from the `named-credential-setup` GET. DevOps-created target credentials match `<letters>_<millis>`. Never build the deploy-target list from this query.
@@ -37,8 +37,8 @@ If the type is still ambiguous (for example only an environment name like "MySan
37
37
 
38
38
  ## Step 0 — Resolve inputs and check for an existing credential
39
39
 
40
- 1. Resolve `<dev-org-alias>`: the alias the user named, else the default org from `sf org display --json`. Read `result.apiVersion` as `<ver>`; it must be at least `67.0`.
41
- 2. Determine the mode. Hub mode only when reached from `hub-org.md`; every other connect is deploy mode. In deploy mode also determine the target org type and a short environment name.
40
+ 1. Resolve `<dev-org-alias>`: the alias the user named, else the default org from `sf org display --json`. Read `result.apiVersion` as `<ver>`; it must be at least `67.0`; the alias registration below needs `68.0`, and on `67.0` the connect works but no alias is registered, so do not add the flag.
41
+ 2. Determine the mode. Hub mode only when reached from `hub-org.md`; every other connect is deploy mode. In deploy mode also determine the target org type and a short environment name. The name is also the workspace alias. Spaces are allowed (`Dev 12 Org`), but never `default-org`, and never a name an existing alias already uses for another org: check `bash scripts/resolve-environment.sh "<dev-org-alias>"` for `aliasConflict: true` and `sf alias list` for the name. If it is taken, ask for a different one.
42
42
  3. Check whether a usable credential already exists (`connect-api.md`, *Check credential status*).
43
43
  - **Hub mode:** check `ALMDevOpsCenterHub`.
44
44
  - **Deploy mode:** run the environment lookup (`list-orgs.md`) using the org's **URL, org id, or local alias only**, never the environment name the user wants to give it. If `sourceMatched` is `true`, say it cannot be connected as its own deploy target and ask for another org. If a row matches, check its `NamedCredential`. A row that matches only by name belongs to another org: that name is taken, so ask for a different one. If the user gave no URL, org id, or alias, there is nothing to match: create.
@@ -65,7 +65,7 @@ If the type is still ambiguous (for example only an environment name like "MySan
65
65
  sf api request rest "/services/data/v<ver>/connect/devops/environment" \
66
66
  --method POST \
67
67
  --body '{"envName":"<name>","orgType":"<PRODUCTION|SANDBOX|ORGFARM>","isDevEnv":false}' \
68
- --target-org <dev-org-alias>
68
+ --target-org "<dev-org-alias>"
69
69
  ```
70
70
 
71
71
  Response: `{id, name, namedCredential, redirectUrl, orgType, ...}`. Keep `id` (the `DevopsEnvironment` Id) and `namedCredential`. Send only `envName`, `orgType`, and `isDevEnv`. A `BAD_REQUEST` naming `Invalid org type` means the value above was wrong.
@@ -76,7 +76,7 @@ Response: `{id, name, namedCredential, redirectUrl, orgType, ...}`. Keep `id` (t
76
76
  sf api request rest "/services/data/v<ver>/connect/devops/setupNamedCredential" \
77
77
  --method POST \
78
78
  --body '{"namedCredentialName":"ALMDevOpsCenterHub","namedCredentialType":"ORG_TO_ORG"}' \
79
- --target-org <dev-org-alias>
79
+ --target-org "<dev-org-alias>"
80
80
  ```
81
81
 
82
82
  Response: `{"redirectUrl": "..."}`. In both modes replace every `&amp;` in `redirectUrl` with `&`.
@@ -96,21 +96,10 @@ This step **requires a human** (authorization code with PKCE, stored per user).
96
96
  >
97
97
  > Link not working? Copy it: `<redirectUrl>`
98
98
 
99
- Hub mode uses the same layout with the heading **Connect the Lifecycle Center org** and the button text **Connect to Lifecycle Center org →**.
100
-
101
- **Hub mode, as a card.** Only when the `render_widget` tool is available. Without it, use the layout above and skip this. Run, with the `redirectUrl` after the `&amp;` fix, unmodified:
102
-
103
- ```bash
104
- bash <skill_dir>/scripts/widget.sh connect-sign-in '{"signInUrl":"<redirectUrl>"}'
105
- ```
106
-
107
- It prints one line. The card has the heading **Sign in to Lifecycle Center**, the steps (sign in as a user with the **DevOps Center User** permission set, allow access, confirm access in the working org, then reply **done**), and a **Connect to Lifecycle Center org** button that opens the URL in a new tab.
108
-
109
- - `CARD_JSON <json>`: call `render_widget` once with `<json>` as its arguments, exactly as printed. The card holds the heading, the steps, and the link, so write no other text about the sign-in. Never put the card JSON or the URL in your message.
110
- - `CARD_UNAVAILABLE <reason>`, any other output or an error, or `render_widget` answers `{rendered: false, reason}`: use the layout above. Never edit the URL or the card JSON to make a card fit.
99
+ Hub mode uses the heading **Connect the Lifecycle Center org** and the link text **Connect to Lifecycle Center org**.
111
100
 
112
101
  Rules for the link:
113
- - Use the full `redirectUrl` after the `&amp;` fix, unmodified, as the Markdown link, and again in the "Link not working?" line. Show the sign-in once, as the layout or as the card; do not repeat it in other words.
102
+ - Use the full `redirectUrl` after the `&amp;` fix, unmodified, as the Markdown link, and again in the "Link not working?" line. Show the sign-in once; do not repeat it in other words.
114
103
  - Only the newest link works. Each new Step 1 run (hub) or `GET /connect/devops/environment/<id>` (deploy) replaces the previous one, so never run one while the user is still signing in, and never show an older link again. If the user reports it expired or failed, get a fresh one the same way.
115
104
  - The user should open it in a browser that is signed in to the dev org as the same user the CLI uses (the final confirmation happens on the dev org). Otherwise the browser lands on that org's login page: tell them to sign in there, then use the link again.
116
105
  - Right after showing the layout, wait for the user to reply **done**. Do not run other steps in between.
@@ -133,33 +122,40 @@ The NC is created pointing at a placeholder login host. The PATCH calls `/servic
133
122
  **Deploy mode:**
134
123
 
135
124
  ```bash
136
- sf api request rest "/services/data/v<ver>/connect/devops/environment/<id>" \
137
- --method PATCH --target-org <dev-org-alias>
125
+ sf api request rest "/services/data/v<ver>/connect/devops/environment/<id>?registerWorkspaceAlias=true" \
126
+ --method PATCH --body '{}' --target-org "<dev-org-alias>"
138
127
  ```
139
128
 
129
+ `registerWorkspaceAlias=true` makes Core also register the environment name (the name the user chose) as an org alias in this workspace, next to `default-org`, so `sf ... --target-org "<name>"` works here. Core reads the token itself; the token never comes back in the response. This is best effort: if no workspace is running or the registration fails, the PATCH still succeeds and the response is unchanged. The CLI rejects a PATCH with no body, so keep `--body '{}'`. On an org below API `68.0` drop the query string (and still send `--body '{}'`); the connect completes without an alias. Send the flag only on this connect PATCH, never in hub mode.
130
+
140
131
  Success returns `id`, `organizationId`, `orgUrl`, `status`, and `message`. Keep `namedCredential` from the POST. Verify `orgUrl` is a My Domain URL and **not** `login.salesforce.com` or `test.salesforce.com`.
141
132
 
133
+ Core names the alias after the environment (trimmed). It skips a blank name and `default-org`, and, in the Core build checked so far, a name with spaces (the environment itself still connects; only the alias is skipped until Core accepts spaced names); Core has no other rule for the alias: digits and hyphens are allowed. Only the credential name keeps just the letters of the environment name. If the local workspace gate is closed, Core registers through the remote workspace instead; the result is the same alias.
134
+
135
+ The alias is for the user's convenience in the workspace. It does not change how targets are chosen (see the rules in `SKILL.md`). The workspace token expires after about an hour. If an `sf` command with the alias fails on auth, repeat this same PATCH once to refresh it.
136
+
142
137
  **Hub mode:**
143
138
 
144
139
  ```bash
145
140
  sf api request rest "/services/data/v<ver>/connect/devops/setupNamedCredential" \
146
141
  --method PATCH \
147
142
  --body '{"namedCredentialName":"ALMDevOpsCenterHub","namedCredentialType":"ORG_TO_ORG"}' \
148
- --target-org <dev-org-alias>
143
+ --target-org "<dev-org-alias>"
149
144
  ```
150
145
 
151
146
  Success returns `{"namedCredentialName": "...", "calloutUrl": "https://<org>.my.salesforce.com", "redirectUrl": null}`. Verify `calloutUrl` the same way.
152
147
 
153
- - On failure (`DOCE_CONNECTION_UPDATE_FAILED`, a 404, a userinfo failure, or `TARGET_ORG_*` codes) see `troubleshooting.md`.
148
+ - On failure (`DOCE_CONNECTION_UPDATE_FAILED`, a 404, a userinfo failure, or `TARGET_ORG_*` codes) see `troubleshooting.md`. A `TARGET_ORG_AUTHENTICATION_TIMEOUT` is transient: wait about 10 seconds and PATCH once more, and do not give a new sign-in link for it.
154
149
  - **Never retry the PATCH in a loop.** **Hub mode only:** a failed PATCH also **clears the user's saved DX Inspector selections**. Tell the user.
155
150
 
156
151
  ## Step 5 — Verify and hand off
157
152
 
158
153
  1. Re-run the status check. Expect principal `Configured` and a callout URL equal to the PATCH `calloutUrl`.
154
+ **Deploy mode:** also check the alias with `bash scripts/resolve-environment.sh "<dev-org-alias>" "<name>"` and read `match.readiness` (never `sf org display`, which prints the token). Registration runs in the background after the PATCH returns, so if it is `needs-sync` wait about 5 seconds and check once more. If it is still `needs-sync`, tell the user the org is connected but the workspace alias is not available yet, and offer to repeat the PATCH once. `ready` or `unverified`: say nothing about the alias.
159
155
  2. **Hub mode only:** optionally record the hub type the way DX Inspector does. A `CORE` or `MANAGED_PACKAGE` response proves the NC works end to end.
160
156
 
161
157
  ```bash
162
- sf api request rest "/services/data/v<ver>/connect/devops/doceConnectionType" --target-org <dev-org-alias>
158
+ sf api request rest "/services/data/v<ver>/connect/devops/doceConnectionType" --target-org "<dev-org-alias>"
163
159
  ```
164
160
 
165
161
  3. Show the result with exactly this layout, no raw JSON, and never the credential name.
@@ -181,16 +177,51 @@ Success returns `{"namedCredentialName": "...", "calloutUrl": "https://<org>.my.
181
177
  > | `<host of calloutUrl>` | Core or Managed package | Connected |
182
178
 
183
179
  Say "Sandbox" for a scratch org too. If the status check in item 1 did not return `Configured`, do not show this layout: say the sign-in is not complete and offer a fresh link.
180
+ 4. **Deploy mode:** re-run the environment lookup (`list-orgs.md`) and confirm the row with the `id` from Step 1 is listed, `selectable`, with its `NamedCredential`. Carry that `id` and `namedCredential` forward. If it is missing, do not deploy and do not invent an id; report that the credential is connected but the row was not found.
181
+ 5. **If this connect started from a deploy request** (`deploy.md`, Step 2): tell the user in one sentence that `<name>` is connected and that you are continuing the deploy of the components they gave. Then go to `deploy.md`, Step 3 and Step 4. The deploy confirmation is theirs to give; do not submit anything before it. If the connect did not start from a deploy, end here and do not offer anything beyond the result.
184
182
 
185
- **Hub mode, as a card.** Only when item 1 passed and the `render_widget` tool is available. Without it, use the layout above and skip this. Run, with the `calloutUrl` host and the hub type from item 2:
183
+ ---
184
+
185
+ ## Sync workspace access (alias only)
186
+
187
+ Registers or refreshes the environment's workspace CLI alias without a sign-in. Use it when the user clicks a **Sync**, **Refresh**, or **Re-sync** button (`list-orgs.md`), asks for CLI access to a connected org, or an `sf ... --target-org "<alias>"` command fails with `Session expired or invalid`. It is the same PATCH as Step 4 and never creates an environment.
188
+
189
+ **Why it is needed.** Core registers the alias only when the connect PATCH runs with `registerWorkspaceAlias=true` against a **running** workspace. So an org connected in **DX Inspector** (the Lifecycle Center UI) has a row and a credential but no alias here; an org connected in Builder Central chat has both. Alias tokens also expire after about an hour.
190
+
191
+ 1. **Find the row.** Run `bash scripts/resolve-environment.sh "<dev-org-alias>" "<name-or-alias>"`. For a failed command, pass the alias from the command. Use `match` only when `matchStatus` is `matched`.
192
+ - No match (`not-connected`): the alias is not a DX Inspector environment. Do **not** PATCH anything. Offer to connect it (`connect-org.md`, Step 0).
193
+ - `state` is `expired`: retired, not repairable. `unauthenticated`: repair path (fresh sign-in link), not a sync.
194
+ - `readiness` is `needs-my-signin` (`userAuth: notConfigured`): another user connected this environment and this user has not signed in. Do not sync. Use the repair path (fresh link from `GET /connect/devops/environment/<id>` `redirectUrl`, login **as this user**, PATCH once with `registerWorkspaceAlias=true`), then rebuild the list.
195
+ - `readiness` is `alias-conflict`: stop; the name belongs to another org (`troubleshooting.md`).
196
+ - Otherwise take `match.id`. A button click or the user's explicit ask is the confirmation, so do not ask again.
197
+ 2. **PATCH once.**
186
198
 
187
199
  ```bash
188
- bash <skill_dir>/scripts/widget.sh connect-connected '{"hubHost":"<host of calloutUrl>","hasHubType":true,"hubTypeLabel":"<Core or Managed package>"}'
200
+ sf api request rest "/services/data/v<ver>/connect/devops/environment/<id>?registerWorkspaceAlias=true" \
201
+ --method PATCH --body '{}' --target-org "<dev-org-alias>"
189
202
  ```
190
203
 
191
- When the type call was skipped or unknown, send `"hasHubType":false,"hubTypeLabel":""`. On `CARD_JSON <json>`, call `render_widget` once with `<json>` as its arguments, exactly as printed, in place of the layout above; the card shows the org host and the hub type, so do not repeat them in text. On `CARD_UNAVAILABLE <reason>`, any other output or an error, or `{rendered: false, reason}`, use the layout above.
192
- 4. **Deploy mode:** re-run the environment lookup (`list-orgs.md`) and confirm the row with the `id` from Step 1 is listed, `selectable`, with its `NamedCredential`. Carry that `id` and `namedCredential` forward. If it is missing, do not deploy and do not invent an id; report that the credential is connected but the row was not found.
193
- 5. **If this connect started from a deploy request** (`deploy.md`, Step 2): tell the user in one sentence that `<name>` is connected and that you are continuing the deploy of the components they gave. Then go to `deploy.md`, Step 3 and Step 4. The deploy confirmation is theirs to give; do not submit anything before it. If the connect did not start from a deploy, end here and do not offer anything beyond the result.
204
+ On an org below API `68.0` drop the query string; the alias cannot be registered there, so say so and stop.
205
+ 3. **Read the outcome.**
206
+
207
+ | Result | Do |
208
+ |---|---|
209
+ | Success | Go to step 4. |
210
+ | `TARGET_ORG_AUTHENTICATION_TIMEOUT` (408/504) | Transient: the org did not answer in time. Wait about 10 seconds and PATCH **once more**. If it times out again, stop: "`<name>` didn't respond in time. Try again in a few minutes." Do **not** show a sign-in link and do not call the credential stale. |
211
+ | `TARGET_ORG_AUTHENTICATION_STATUS_CHECK_FAILED` (401/403) | The DX Inspector credential is stale or revoked. Repair path: fresh sign-in link, login, then PATCH once. |
212
+ | `TARGET_ORG_UNKNOWN_ERROR` | Report the plain-language cause (for example "Environment record not found" means the id is wrong; "does not have a named credential" means the connect never finished and needs repair). Stop. |
213
+ 4. **Verify.** The alias is registered in the background after the PATCH returns, and a failure there is swallowed, so the response proves nothing about it. Wait about 5 seconds, run the resolver again, and read `readiness` for that row.
214
+
215
+ | `readiness` | Say |
216
+ |---|---|
217
+ | `ready` or `unverified` | Nothing about the alias beyond "`<name>` is ready in this workspace." |
218
+ | `needs-sync` | Repeat step 2 **once**. If still `needs-sync`: "`<name>` is connected and deploys work, but its CLI alias isn't available in this workspace. Registration needs a running workspace and the feature enabled for this org." Stop; never loop. |
219
+ | `alias-conflict` | Stop; explain the name clash. |
220
+
221
+ Registration targets the user's **already running** workspace only; it never starts one. If the CLI runs in a different workspace from the running one, the alias lands in the running one: tell the user which if they report it missing.
222
+ 5. **Retry the command** that triggered a failed-command sync, once, **without asking**. The same applies when a task needs CLI access to an org whose `readiness` is `needs-sync` or `needs-refresh`: run steps 1 to 4 first, then the task. Listing alone still does not sync. If it fails the same way, report it and stop. Never retry with another org's alias or `default-org`.
223
+ 6. **Batch** (`Sync all N`): run steps 1 to 4 for each row, one at a time, then report one line each (synced, timed out, sign-in needed, name clash, not available). Stop a row's retries independently; one failure does not stop the others.
224
+ 7. **Show the list again** (`list-orgs.md`, section 4) so the user sees the result.
194
225
 
195
226
  ## Rules
196
227
 
@@ -198,6 +229,6 @@ Success returns `{"namedCredentialName": "...", "calloutUrl": "https://<org>.my.
198
229
  - Never print access tokens, and never pass `headerTargetAccessToken` in place of a stored connection.
199
230
  - One environment per target org. Do not reuse a deploy NC for a different org; create a new environment.
200
231
  - Deploy-target connections always use the Environment API so the `DevopsEnvironment` row exists. Never use `setupNamedCredential` alone for a deploy target.
201
- - Never tell the user a browser was opened. Give the link.
232
+ - Never tell the user a browser was opened. Show the sign-in as in Step 2.
202
233
  - Do not rename `ALMDevOpsCenterHub`. DX Inspector looks it up by that exact name.
203
234
  - Only the org-to-org types (`ORG_TO_ORG`, `ORG_TO_SANDBOX_ORG`, `ORG_TO_ORGFARM_ORG`) are used here.
@@ -83,7 +83,7 @@ sf api request rest \
83
83
  "/services/data/v67.0/connect/devops/simple-deploy/deploy" \
84
84
  --method POST \
85
85
  --body @"$BODY" \
86
- --target-org <source-org-alias>
86
+ --target-org "<source-org-alias>"
87
87
  ```
88
88
 
89
89
  Read `response.requestId`. If it is absent, the call failed: use `references/error-handling.md`. Make **one** attempt. Never retry in a loop, never resubmit after a timeout, and never invent a `requestId`.
@@ -93,7 +93,7 @@ Read `response.requestId`. If it is absent, the call failed: use `references/err
93
93
  Polling is automatic and read-only. Every check reads **two sources**, and a terminal state from **either** one ends it: the Simple Deploy status endpoint (live `step`, `metadata.deployId`) and the `DevopsRequestInfo` record for the `requestId` (`Status` is `SUCCESS` or `ERROR`; it is the same record commit polling uses).
94
94
 
95
95
  ```bash
96
- bash <skill_dir>/scripts/poll-deploy-status.sh <requestId> <source-org-alias> 10 100
96
+ bash scripts/poll-deploy-status.sh <requestId> "<source-org-alias>" 10 100
97
97
  ```
98
98
 
99
99
  Checks come at 3 s, then 5 s, then every 10 s, for at most **100 seconds**, about 2 minutes in all. Set the shell tool timeout to at least 180 seconds so the run is not killed before it exits. Progress lines (`status=… step=… request-info=…`) go to stderr; relay the current step to the user while waiting. Never say the deploy is "still waiting" after the script has printed a result.
@@ -127,7 +127,7 @@ On timeout (exit `3`, `outcome` `TIMEOUT`, about 2 minutes), stop polling and te
127
127
 
128
128
  Example: "Your deploy to `<target>` hasn't reported a final status after 2 minutes. It was at `DEPLOY_METADATA` and may still be running. Request token: `<requestId>`. Deployment id: `<deployId>`. Send me the request token any time and I'll check it, or look up the deployment id in `<target>` under Setup → Deployment Status." Never resubmit, and do not keep polling.
129
129
 
130
- For a one-off check, put `--once` **first**: `bash <skill_dir>/scripts/poll-deploy-status.sh --once <requestId> <source-org-alias>`. It exits `4` while the request is still processing: report the current `step` and do not poll again unless the user asks. With `--once` there is no grace period, so `NOT_FOUND` right after a submit may be transient: say the request is not visible yet and check again shortly, not that it failed.
130
+ For a one-off check, put `--once` **first**: `bash scripts/poll-deploy-status.sh --once <requestId> "<source-org-alias>"`. It exits `4` while the request is still processing: report the current `step` and do not poll again unless the user asks. With `--once` there is no grace period, so `NOT_FOUND` right after a submit may be transient: say the request is not visible yet and check again shortly, not that it failed.
131
131
 
132
132
  If the user gives a `requestId` to check (also when they come back with the id from a timeout), skip Steps 1 to 5 and check it once with `--once`, using the source org alias. If the user asks for the status without an id, use the `requestId` from earlier in this conversation; if there is none, ask for it. Then report as in Step 7.
133
133
 
@@ -5,7 +5,7 @@ The **Lifecycle Center org** is the Lifecycle Center hub that DX Inspector conne
5
5
  Three rules always hold:
6
6
 
7
7
  1. It is **never a deploy target**.
8
- 2. It **never appears in a list** and is not mentioned while listing, whether or not it is connected. It is discussed only when the user asks about it by name.
8
+ 2. It appears in a list **only when it is connected** (`hub.userAuth` is `configured`), as one clearly labelled row, **Lifecycle Center (Production Org)**, with no action button and never counted in Sync all. When it is not connected, the list does not mention it.
9
9
  3. Its credential is **never used to deploy**.
10
10
 
11
11
  ## Hub names
@@ -25,10 +25,26 @@ Run this check **before** the other routing rules.
25
25
  | Connect, reconnect, repair, log in to, or authorize the Lifecycle Center org | 1. If the name is in the ambiguous group, ask: "Do you mean the Lifecycle Center org (the Lifecycle Center hub)?" On no, ask which org they mean and treat it as a normal org (Operation B). 2. On yes, or for a certain name, check the credential (`connect-org.md`, Step 0, hub mode). 3. **Configured:** reply only "The Lifecycle Center org is already configured." and stop. No reconnect offer, org details, or login link. 4. **Not configured, or half-created:** run `connect-org.md` Steps 1 to 5 in hub mode, using its sign-in layout (Step 2) and connected layout (Step 5). |
26
26
  | Ask whether the Lifecycle Center org is connected or configured | Check the credential the same way. Configured: reply only "The Lifecycle Center org is already configured." Not configured: reply "The Lifecycle Center org is not configured. Want me to connect it?" |
27
27
  | Deploy, validate, or quick deploy to the Lifecycle Center org | Make no API call. Ask: "Do you mean the Lifecycle Center org, or a different org?" A different org: ask which and continue at `deploy.md`, Step 2. The Lifecycle Center org: say a deploy cannot go there because it is the Lifecycle Center hub, not a deploy target, and offer to connect that org, or another one, as a regular deploy target (Operation B). Never deploy with the hub credential. |
28
- | List connected orgs or environments | Never mention the Lifecycle Center org. Follow `list-orgs.md`. |
29
- | Show the Lifecycle Center org in the list, or asks why it is not listed | Say it is the Lifecycle Center hub, kept separate from deploy targets, and is never part of the deploy list. If they want its status, check the credential and answer as above. |
28
+ | List connected orgs or environments | Follow `list-orgs.md`. Add the labelled hub row only when it is connected; otherwise say nothing about it. |
29
+ | Show the Lifecycle Center org in the list, or asks why it is not listed | If it is connected it is listed, labelled Lifecycle Center (Production Org). If not, say it is not connected, so it is not shown. Either way it is the Lifecycle Center hub, never a deploy target. If they want its status, check the credential and answer as above. |
30
30
  | Remove or disconnect it | Say to use **Remove DevOps Center Connection** in DX Inspector. |
31
31
 
32
+ ## Reading from the Lifecycle Center org
33
+
34
+ Lifecycle Center tasks (and only those) can read from the hub, for example projects and work items. **Never deploy, validate or quick-deploy with it.**
35
+
36
+ Use the credential the connection already has. It needs no workspace alias and changes no record:
37
+
38
+ ```bash
39
+ bash scripts/hub-get.sh "<dev-org-alias>" "/services/data/v<ver>/query?q=SELECT%20Id,Name%20FROM%20<Object>"
40
+ ```
41
+
42
+ - The script is read-only (GET). It calls the hub through `ALMDevOpsCenterHub` as the signed-in user, from the source org, and prints the JSON body. Encode spaces as `%20` and quotes as `%27`. Keep results small (add `LIMIT`): a response that is cut off is reported as a failure.
43
+ - Run it only after the credential check says the hub is configured (`hub.userAuth` is `configured`). For `notConfigured`, offer to connect it (Operation C); for `unknown`, try once and report the error.
44
+ - A non-2xx answer is reported as is: 401/403 means this user has not signed in to the hub or lacks the **DevOps Center User** permission set; say so and offer to repair the connection.
45
+ - **Do not** PATCH or rename the hub row from this skill; DX Inspector owns that record, and a PATCH also rewrites its callout URL and org fields.
46
+ - The CLI alias is the row's own name, `hub.cliAlias` (for example `Doce Hub Environment`), always double-quoted: `sf ... --target-org "<hub.cliAlias>"`. Use it only when `hub.workspaceAlias` is `registered`. When it is `missing` or `conflict` (a same-named alias points at another org), use `hub-get.sh`; do not create the alias or invent a different one. Reads only: never deploy, validate or change data with it.
47
+
32
48
  ## Notes for the connect flow
33
49
 
34
50
  - Hub mode has no `DevopsEnvironment` row: it uses `setupNamedCredential` with the fixed name `ALMDevOpsCenterHub`.