@salesforce/afv-skills 1.67.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.
- package/README.md +55 -5
- package/package.json +1 -1
- package/skills/afcc-setup-coordinate/SKILL.md +348 -0
- package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
- package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
- package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
- package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
- package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
- package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
- package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
- package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
- package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
- package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
- package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
- package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
- package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
- package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
- package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
- package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
- package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
- package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
- package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
- package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
- package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
- package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
- package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
- package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
- package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
- package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
- package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
- package/skills/agentforce-offline-experimentation-run/SKILL.md +14 -22
- package/skills/agentforce-offline-experimentation-run/scripts/bt_compare.py +81 -0
- package/skills/agentforce-offline-experimentation-run/scripts/bt_fetch.py +358 -0
- package/skills/agentforce-offline-experimentation-run/scripts/bt_patch_agent.py +110 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/__init__.py +34 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/agentpatch.py +483 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/agentsrc.py +565 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/cache.py +95 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/compare.py +617 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/fetch.py +1012 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +140 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +93 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/patch.py +327 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/redact.py +40 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/results.py +288 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/scoring.py +340 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +354 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/splits.py +136 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/stdm.py +98 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/tokens.py +173 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/units.py +199 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/versions.py +194 -0
- package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +367 -379
- package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +23 -6
- package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +483 -796
- package/skills/commerce-react-storefront-create/SKILL.md +54 -21
- package/skills/dx-lifecycle-center/SKILL.md +22 -13
- package/skills/dx-lifecycle-center/examples/workflows.md +54 -17
- package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
- package/skills/dx-lifecycle-center/references/connect-org.md +62 -12
- package/skills/dx-lifecycle-center/references/deploy.md +3 -3
- package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
- package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
- package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
- package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
- package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
- package/skills/dx-org-devhub-configure/SKILL.md +85 -84
- package/skills/dx-org-devhub-configure/examples/status-output.md +25 -2
- package/skills/dx-org-devhub-configure/scripts/devhub.sh +265 -140
- package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +100 -15
- package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
- package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
- package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +88 -0
- package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +167 -0
- package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
- package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
- package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
- package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
- package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
- package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
- package/skills/dx-scratch-def-configure/SKILL.md +163 -0
- package/skills/dx-scratch-def-configure/examples/confirm-card.md +53 -0
- package/skills/dx-scratch-def-configure/examples/report-recipes.md +100 -0
- package/skills/dx-scratch-def-configure/references/features.json +3270 -0
- package/skills/dx-scratch-def-configure/references/project-scratch-def.schema.json +1841 -0
- package/skills/dx-scratch-def-configure/references/settings-map.json +682 -0
- package/skills/dx-scratch-def-configure/scripts/lib_scratch_def.py +1306 -0
- package/skills/dx-scratch-def-configure/scripts/requirements.txt +3 -0
- package/skills/dx-scratch-def-configure/scripts/scrape_config_values.py +848 -0
- package/skills/education-cloud-domain-configure/SKILL.md +1 -1
- package/skills/education-cloud-multi-campus-configure/SKILL.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +1 -1
- package/skills/experience-afv-analytics-query/SKILL.md +239 -0
- package/skills/experience-afv-analytics-query/references/references.md +176 -0
- package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
- package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
- package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
- package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
- package/skills/experience-app-mcp-generate/SKILL.md +174 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
- package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
- package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
- package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
- package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
- package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
- package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
- package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
- package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
- package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
- package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
- package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
- package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
- package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
- package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
- package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
- package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
- package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
- package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
- package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
- package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
- package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
- package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
- package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
- package/skills/experience-design-validate/SKILL.md +1 -1
- package/skills/experience-search-coordinate/SKILL.md +18 -12
- package/skills/experience-search-coordinate/references/content-route.md +79 -1
- package/skills/field-service-data-capture-migrate/SKILL.md +1 -1
- package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
- package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
- package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
- package/skills/platform-apex-generate/SKILL.md +14 -11
- package/skills/platform-apex-test-generate/SKILL.md +2 -1
- package/skills/platform-custom-field-generate/SKILL.md +24 -16
- package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
- package/skills/platform-custom-setting-generate/SKILL.md +1 -0
- package/skills/platform-datamask-run/SKILL.md +52 -71
- package/skills/platform-datamask-run/references/api-surface.md +10 -4
- package/skills/platform-datamask-run/references/policy-authoring.md +56 -7
- package/skills/platform-datamask-run/references/run-and-abort.md +17 -10
- package/skills/platform-datamask-run/scripts/poll-job.sh +15 -25
- package/skills/platform-dataspace-access-configure/SKILL.md +43 -10
- package/skills/platform-flexipage-generate/SKILL.md +7 -10
- package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
- package/skills/platform-metadata-discovery-get/SKILL.md +185 -0
- package/skills/platform-metadata-discovery-get/references/api-map.md +25 -0
- package/skills/platform-metadata-discovery-get/references/h360-routes.md +30 -0
- package/skills/platform-metadata-discovery-get/references/scoped-soql.md +52 -0
- package/skills/platform-metadata-grounding-get/SKILL.md +170 -0
- package/skills/platform-policy-rule-generate/SKILL.md +85 -231
- package/skills/platform-policy-rule-generate/references/condition-model.md +47 -0
- package/skills/platform-policy-rule-generate/references/condition-templates.md +89 -0
- package/skills/platform-policy-rule-generate/references/conjunction-compiler.md +25 -0
- package/skills/platform-policy-rule-generate/references/conjunction-expression.md +30 -0
- package/skills/platform-policy-rule-generate/references/consumer-all.md +9 -0
- package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +99 -0
- package/skills/platform-policy-rule-generate/references/deploy-errors.md +24 -36
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitions/ExistsJoinRLS_Rule_1.policyRuleDefinition +91 -0
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitions/FieldReadDeny_Rule_1.policyRuleDefinition +72 -0
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitions/LastCharactersFieldMasking_Rule_1.policyRuleDefinition +77 -0
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitions/PrincipalFieldMatchRLS_Rule_1.policyRuleDefinition +77 -0
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitions/TaggedObjectAccess_Rule_1.policyRuleDefinition +65 -0
- package/skills/platform-policy-rule-generate/references/headless-transport.md +87 -0
- package/skills/platform-policy-rule-generate/references/policy-schema-full.md +18 -11
- package/skills/platform-policy-rule-generate/references/policy-shapes.md +107 -0
- package/skills/platform-policy-rule-generate/references/principal-expression.md +31 -0
- package/skills/platform-policy-rule-generate/references/reference-resolution.md +51 -0
- package/skills/platform-policy-rule-generate/references/resource-expression.md +48 -0
- package/skills/platform-policy-rule-generate/references/runtime-context.md +9 -0
- package/skills/platform-policy-rule-generate/references/templates-access.md +11 -9
- package/skills/platform-policy-rule-generate/references/templates-advanced.md +5 -3
- package/skills/platform-policy-rule-generate/references/templates-record.md +37 -22
- package/skills/platform-policy-rule-generate/references/templates-transform.md +10 -8
- package/skills/platform-policy-rule-generate/references/templates.md +2 -2
- package/skills/platform-policy-rule-generate/references/ui-compatibility.md +36 -18
- package/skills/platform-report-generate/SKILL.md +29 -5
- package/skills/platform-report-generate/references/chart-types.md +26 -2
- package/skills/platform-report-generate/references/column-names.md +43 -0
- package/skills/platform-report-generate/references/errors-and-troubleshooting.md +1 -1
- package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
- package/skills/platform-report-generate/references/verification-checklist.md +22 -2
- package/skills/service-digital-engagement-channel-configure/SKILL.md +49 -110
- package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +35 -0
- package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
- package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
- package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
- package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
- package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +128 -28
- package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
- package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
- package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
- package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
- package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
- package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
- package/skills/service-e911-configure/SKILL.md +242 -0
- package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
- package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
- package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
- package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
- package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
- package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
- package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
- package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
- package/skills/experience-content-media-image-generate/SKILL.md +0 -83
- package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
- package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
- package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
# identifier (alias, username, My Domain URL, 15/18-char org id, or environment name)
|
|
4
4
|
# to one of them. Read-only. Prints one JSON document on stdout.
|
|
5
5
|
#
|
|
6
|
-
# Usage: resolve-environment.sh <source-org-alias> [identifier] [--rows-file <file>]
|
|
7
|
-
# --rows-file
|
|
6
|
+
# Usage: resolve-environment.sh <source-org-alias> [identifier] [--rows-file <file>] [--user-auth-file <file>] [--check-sessions]
|
|
7
|
+
# --rows-file read the DevopsEnvironment query result JSON from a file (tests)
|
|
8
|
+
# --user-auth-file read the per-user sign-in map (named credential -> configured | notConfigured | unknown)
|
|
9
|
+
# from a file instead of calling the org (tests)
|
|
10
|
+
# --check-sessions probe each workspace login that belongs to a listed environment with one
|
|
11
|
+
# cheap query (SELECT Id FROM Organization LIMIT 1) and report .session
|
|
12
|
+
# (valid / expired / unknown). Off by default: one org call per login.
|
|
8
13
|
#
|
|
9
14
|
# Exit codes: 0 ok (check .match / .matchStatus), 1 usage or call error.
|
|
10
15
|
set -uo pipefail
|
|
@@ -13,15 +18,19 @@ command -v jq >/dev/null || { echo "jq required" >&2; exit 1; }
|
|
|
13
18
|
SRC="${1:-}"
|
|
14
19
|
[ -n "$SRC" ] || { echo "usage: resolve-environment.sh <source-org-alias> [identifier] [--rows-file <file>]" >&2; exit 1; }
|
|
15
20
|
shift
|
|
16
|
-
IDENT=""; ROWS_FILE=""
|
|
21
|
+
IDENT=""; ROWS_FILE=""; USER_AUTH_FILE=""; CHECK_SESSIONS=0
|
|
17
22
|
while [ $# -gt 0 ]; do
|
|
18
23
|
case "$1" in
|
|
19
24
|
--rows-file) [ $# -ge 2 ] || { echo "--rows-file needs a value" >&2; exit 1; }; ROWS_FILE="$2"; shift 2 ;;
|
|
20
|
-
|
|
25
|
+
--user-auth-file) [ $# -ge 2 ] || { echo "--user-auth-file needs a value" >&2; exit 1; }; USER_AUTH_FILE="$2"; shift 2 ;;
|
|
26
|
+
--check-sessions) CHECK_SESSIONS=1; shift ;;
|
|
27
|
+
-*) echo "unknown option $1" >&2; exit 1 ;;
|
|
28
|
+
*) [ -z "$IDENT" ] || { echo "one identifier only; quote a name with spaces: \"Dev 12 Org\"" >&2; exit 1; }; IDENT="$1"; shift ;;
|
|
21
29
|
esac
|
|
22
30
|
done
|
|
23
31
|
|
|
24
32
|
sfj() { env FORCE_COLOR=0 SF_CLI_DISABLE_AUTOUPDATE=true "$@" 2>/dev/null; }
|
|
33
|
+
tmpd=$(mktemp -d); trap 'rm -rf "$tmpd"' EXIT
|
|
25
34
|
|
|
26
35
|
# Source org (the org the user built in).
|
|
27
36
|
src_json=$(sfj sf org display --target-org "$SRC" --json) \
|
|
@@ -49,6 +58,115 @@ fi
|
|
|
49
58
|
printf '%s' "$rows_json" | jq -e '.result.records' >/dev/null 2>&1 \
|
|
50
59
|
|| { echo "unexpected query result" >&2; exit 1; }
|
|
51
60
|
|
|
61
|
+
# Workspace logins: the aliases (and the org each one points at) that `sf ... --target-org <alias>` accepts
|
|
62
|
+
# here. Core registers an environment's name as an alias when its connect PATCH runs with
|
|
63
|
+
# registerWorkspaceAlias=true. An environment counts as present when an alias carries its name OR points
|
|
64
|
+
# at its org id (several environments can share one org). Local read, no org call.
|
|
65
|
+
# "null" = could not be read: workspace status is then reported as unknown.
|
|
66
|
+
aliases_json=$(sfj sf org list --skip-connection-status --json | jq -c \
|
|
67
|
+
'[.result | to_entries[] | .value | arrays[] | select(.alias != null) | {alias: .alias, orgId: ((.orgId // "")[0:15]), host: ((.instanceUrl // "") | sub("^https?://"; "") | sub("/.*$"; "") | ascii_downcase)}]' 2>/dev/null) || aliases_json=null
|
|
68
|
+
[ -n "$aliases_json" ] || aliases_json=null
|
|
69
|
+
|
|
70
|
+
# Optional session probe. One cheap query per login that belongs to a listed environment.
|
|
71
|
+
# A mapping alias -> valid | expired | unknown. A probe that times out or fails for any other reason is
|
|
72
|
+
# "unknown", never "expired": only a recognised session/refresh-token error counts as expired.
|
|
73
|
+
sessions_json='{}'
|
|
74
|
+
# Bound each probe to 20s with whatever is available (GNU timeout in the image, perl on macOS, else none).
|
|
75
|
+
if command -v timeout >/dev/null; then tmo="timeout 20"
|
|
76
|
+
elif command -v perl >/dev/null; then tmo="perl -e alarm(20);exec(@ARGV) --"
|
|
77
|
+
else tmo=""; fi
|
|
78
|
+
if [ "$CHECK_SESSIONS" = 1 ] && [ "$aliases_json" != null ]; then
|
|
79
|
+
want=$(printf '%s' "$rows_json" | jq -r '[.result.records[]? | (.OrgIdentifier // "")[0:15] | select(. != "")] | unique | .[]')
|
|
80
|
+
# Probes are independent, so run them side by side. Read line by line: an alias may contain spaces ("Dev 12 Org").
|
|
81
|
+
i=0
|
|
82
|
+
while IFS= read -r a; do
|
|
83
|
+
[ -n "$a" ] || continue
|
|
84
|
+
i=$((i+1)); printf '%s' "$a" > "$tmpd/s$i.k"
|
|
85
|
+
(
|
|
86
|
+
out=$(SF_TARGET_ORG="$a" SF_DISABLE_TELEMETRY=true sfj $tmo \
|
|
87
|
+
sf data query --target-org "$a" --json --query "SELECT Id FROM Organization LIMIT 1" </dev/null)
|
|
88
|
+
if printf '%s' "$out" | jq -e '.status == 0' >/dev/null 2>&1; then st=valid
|
|
89
|
+
elif printf '%s' "$out" | grep -Eiq 'INVALID_SESSION_ID|invalid_grant|RefreshTokenAuthError|Bad_OAuth_Token|expired access/refresh|Session expired or invalid'; then st=expired
|
|
90
|
+
else st=unknown; fi
|
|
91
|
+
printf '%s' "$st" > "$tmpd/s$i.v"
|
|
92
|
+
) &
|
|
93
|
+
done < <(printf '%s' "$aliases_json" | jq -r --arg want "$want" \
|
|
94
|
+
'($want | split("\n")) as $w | .[] | select(.orgId as $o | $w | index($o)) | .alias')
|
|
95
|
+
wait
|
|
96
|
+
for k in "$tmpd"/s*.k; do
|
|
97
|
+
[ -f "$k" ] || continue
|
|
98
|
+
sessions_json=$(printf '%s' "$sessions_json" | jq -c --arg a "$(cat "$k")" --arg s "$(cat "${k%.k}.v" 2>/dev/null || echo unknown)" '. + {($a): $s}')
|
|
99
|
+
done
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
# Hub credential read starts now and runs alongside the checks below (consumed at the hub step).
|
|
103
|
+
hub_ver="${DLC_API_VERSION:-68.0}"
|
|
104
|
+
if [ -z "$USER_AUTH_FILE" ]; then
|
|
105
|
+
( sfj $tmo sf api request rest "/services/data/v${hub_ver}/named-credentials/named-credential-setup/ALMDevOpsCenterHub" --target-org "$SRC" </dev/null > "$tmpd/hub.nc"
|
|
106
|
+
sfj $tmo sf api request rest "/services/data/v${hub_ver}/named-credentials/external-credentials/ALMDevOpsCenterHub" --target-org "$SRC" </dev/null > "$tmpd/hub.ec" ) &
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# Per-user sign-in. DevopsEnvironment rows are shared by everyone with access to the dev org, but the OAuth
|
|
110
|
+
# token behind each one belongs to a single user (the external credential's PerUserPrincipal). Ask, for the
|
|
111
|
+
# user running this, whether each connected environment's principal is Configured. The external credential
|
|
112
|
+
# carries the same developer name as the row's named credential. A failed or unreadable check is "unknown",
|
|
113
|
+
# never "notConfigured": only an explicit NotConfigured counts.
|
|
114
|
+
user_auth_json='{}'
|
|
115
|
+
if [ -n "$USER_AUTH_FILE" ]; then
|
|
116
|
+
user_auth_json=$(cat "$USER_AUTH_FILE")
|
|
117
|
+
else
|
|
118
|
+
api_ver="${DLC_API_VERSION:-68.0}"
|
|
119
|
+
# One independent call per credential: run them side by side.
|
|
120
|
+
i=0
|
|
121
|
+
for nc in $(printf '%s' "$rows_json" | jq -r '.result.records[]? | select((.IsExpired // false) == false and (.OrgUrl // "") != "" and (.OrgIdentifier // "") != "")
|
|
122
|
+
| (.NamedCredential // "") | gsub("<[^>]*>"; "") | gsub("^\\s+|\\s+$"; "") | select(. != "" and . != "ALMDevOpsCenterHub")' | sort -u); do
|
|
123
|
+
i=$((i+1)); printf '%s' "$nc" > "$tmpd/u$i.k"
|
|
124
|
+
(
|
|
125
|
+
out=$(sfj $tmo sf api request rest "/services/data/v${api_ver}/named-credentials/external-credentials/${nc}" --target-org "$SRC" </dev/null)
|
|
126
|
+
st=$(printf '%s' "$out" | jq -r '[.principals[]? | select(.principalType == "PerUserPrincipal") | .authenticationStatus][0]
|
|
127
|
+
| if . == "Configured" then "configured" elif . == "NotConfigured" then "notConfigured" else "unknown" end' 2>/dev/null)
|
|
128
|
+
printf '%s' "${st:-unknown}" > "$tmpd/u$i.v"
|
|
129
|
+
) &
|
|
130
|
+
done
|
|
131
|
+
wait
|
|
132
|
+
for k in "$tmpd"/u*.k; do
|
|
133
|
+
[ -f "$k" ] || continue
|
|
134
|
+
user_auth_json=$(printf '%s' "$user_auth_json" | jq -c --arg k "$(cat "$k")" --arg s "$(cat "${k%.k}.v" 2>/dev/null || echo unknown)" '. + {($k): $s}')
|
|
135
|
+
done
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
# Lifecycle Center hub. Its row is dropped from environments[] (it is never a deploy target) but is reported
|
|
139
|
+
# separately as .hub so a list can show it, labelled. The hub counts as connected when its DevopsEnvironment row
|
|
140
|
+
# exists (made in DX Inspector) or its credential is readable (made by hub mode, which creates no row). The URL and
|
|
141
|
+
# this user's sign-in come from the credential. Unreadable pieces are null / "unknown".
|
|
142
|
+
hub_json=null
|
|
143
|
+
hub_name=$(printf '%s' "$rows_json" | jq -r '[.result.records[]? | select(((.NamedCredential // "") | gsub("<[^>]*>"; "") | gsub("^\\s+|\\s+$"; "")) == "ALMDevOpsCenterHub") | .Name][0] // ""')
|
|
144
|
+
hub_present=0; [ -n "$hub_name" ] && hub_present=1
|
|
145
|
+
hub_url=""; hub_auth=unknown
|
|
146
|
+
if [ -n "$USER_AUTH_FILE" ]; then
|
|
147
|
+
[ "$hub_present" = 1 ] && hub_auth=$(printf '%s' "$user_auth_json" | jq -r '.ALMDevOpsCenterHub // "unknown"')
|
|
148
|
+
else
|
|
149
|
+
wait
|
|
150
|
+
hub_url=$(jq -r '.calloutUrl // empty' "$tmpd/hub.nc" 2>/dev/null)
|
|
151
|
+
[ -n "$hub_url" ] && hub_present=1
|
|
152
|
+
if [ "$hub_present" = 1 ]; then
|
|
153
|
+
hub_auth=$(jq -r '[.principals[]? | select(.principalType == "PerUserPrincipal") | .authenticationStatus][0]
|
|
154
|
+
| if . == "Configured" then "configured" elif . == "NotConfigured" then "notConfigured" else "unknown" end' "$tmpd/hub.ec" 2>/dev/null)
|
|
155
|
+
fi
|
|
156
|
+
fi
|
|
157
|
+
if [ "$hub_present" = 1 ]; then
|
|
158
|
+
# CLI access by alias exists only if something registered the row's name as an alias here (Core skips names
|
|
159
|
+
# with spaces today). "conflict" = an alias of that name points at a different org than the hub.
|
|
160
|
+
hub_host=$(printf '%s' "$hub_url" | sed -E 's#^https?://##; s#[/?].*$##' | tr 'A-Z' 'a-z')
|
|
161
|
+
hub_alias=unknown
|
|
162
|
+
if [ "$aliases_json" != null ] && [ -n "$hub_name" ]; then
|
|
163
|
+
hub_alias=$(printf '%s' "$aliases_json" | jq -r --arg n "$hub_name" --arg h "$hub_host" \
|
|
164
|
+
'[.[] | select(.alias == $n)][0] as $x | if $x == null then "missing" elif ($h != "" and ($x.host // "") != "" and $x.host != $h) then "conflict" else "registered" end')
|
|
165
|
+
fi
|
|
166
|
+
hub_json=$(jq -nc --arg u "$hub_url" --arg a "${hub_auth:-unknown}" --arg w "$hub_alias" --arg n "$hub_name" \
|
|
167
|
+
'{label: "Lifecycle Center (Production Org)", url: (if $u == "" then null else $u end), userAuth: $a, workspaceAlias: $w, cliAlias: (if $n == "" then null else $n end), isDeployTarget: false}')
|
|
168
|
+
fi
|
|
169
|
+
|
|
52
170
|
# Identifier -> comparable keys: org id (first 15), host, and a lowercase name.
|
|
53
171
|
# Local alias or username: expand through `sf org display` to its org id and host.
|
|
54
172
|
id15=""; host=""; name=""
|
|
@@ -73,6 +191,10 @@ fi
|
|
|
73
191
|
jq -n \
|
|
74
192
|
--argjson source "$source_obj" \
|
|
75
193
|
--argjson rows "$rows_json" \
|
|
194
|
+
--argjson aliases "$aliases_json" \
|
|
195
|
+
--argjson sessions "$sessions_json" \
|
|
196
|
+
--argjson userauth "$user_auth_json" \
|
|
197
|
+
--argjson hub "$hub_json" \
|
|
76
198
|
--arg ident "$IDENT" --arg id15 "$id15" --arg host "$host" --arg name "$name" '
|
|
77
199
|
# setup and lightning hosts point at the same org as the My Domain host
|
|
78
200
|
def norm: ascii_downcase | sub("^https?://"; "") | sub("[/?].*$"; "")
|
|
@@ -88,6 +210,15 @@ jq -n \
|
|
|
88
210
|
def state: if (.IsExpired == true) then "expired"
|
|
89
211
|
elif ((ncname == "") or (.OrgUrl // "") == "" or (.OrgIdentifier // "") == "") then "unauthenticated"
|
|
90
212
|
else "selectable" end;
|
|
213
|
+
# The alias that gives this workspace a login for the environment: one named like it, else any alias on its org.
|
|
214
|
+
# A name match only counts when it points at the same org; an alias carrying the environment name, but on
|
|
215
|
+
# another org, is a collision (aliasConflict), never a login for this environment.
|
|
216
|
+
def namedAlias: (.Name // "") as $n | ([ $aliases[]? | select(.alias == $n) ][0]);
|
|
217
|
+
def aliasConflict: (namedAlias) as $a | ((.OrgIdentifier // "")[0:15]) as $o
|
|
218
|
+
| ($a != null and $o != "" and ($a.orgId // "") != "" and $a.orgId != $o);
|
|
219
|
+
def workspaceLogin: (.Name // "") as $n | ((.OrgIdentifier // "")[0:15]) as $o
|
|
220
|
+
| ( if aliasConflict then null else (namedAlias | if . == null then null else .alias end) end
|
|
221
|
+
// (if $o == "" then null else [ $aliases[]? | select(.orgId == $o) | .alias ][0] end) );
|
|
91
222
|
[ ($rows.result.records // [])[] | select(ncname != "ALMDevOpsCenterHub" and ((.Name // "") != "Doce Hub Environment" or (.OrgUrl // "") != "")) ] as $recs
|
|
92
223
|
| ($host | if . == "" then "" else norm end) as $h
|
|
93
224
|
| [ $recs[] | {
|
|
@@ -96,6 +227,21 @@ jq -n \
|
|
|
96
227
|
orgId: (.OrgIdentifier // null),
|
|
97
228
|
namedCredential: (ncname | if . == "" then null else . end),
|
|
98
229
|
state: state,
|
|
230
|
+
workspaceAlias: ( if $aliases == null then "unknown"
|
|
231
|
+
elif (workspaceLogin != null) then "registered"
|
|
232
|
+
else "missing" end ),
|
|
233
|
+
workspaceAliasName: (if $aliases == null then null else workspaceLogin end),
|
|
234
|
+
aliasConflict: (if $aliases == null then false else aliasConflict end),
|
|
235
|
+
userAuth: (if state == "selectable" then ($userauth[ncname] // "unknown") else null end),
|
|
236
|
+
session: ( (workspaceLogin) as $a | if $a == null then null else ($sessions[$a] // "unknown") end ),
|
|
237
|
+
readiness: ( if state == "expired" then "retired"
|
|
238
|
+
elif state == "unauthenticated" then "needs-signin"
|
|
239
|
+
elif ($userauth[ncname] // "unknown") == "notConfigured" then "needs-my-signin"
|
|
240
|
+
elif $aliases == null then "unverified"
|
|
241
|
+
elif aliasConflict and workspaceLogin == null then "alias-conflict"
|
|
242
|
+
elif workspaceLogin == null then "needs-sync"
|
|
243
|
+
elif $sessions[workspaceLogin] == "expired" then "needs-refresh"
|
|
244
|
+
else "ready" end ),
|
|
99
245
|
isSource: ((.OrgIdentifier // "")[0:15] == ($source.orgId // "")[0:15] and (.OrgIdentifier // "") != "")
|
|
100
246
|
} ] as $envs
|
|
101
247
|
| ( if $ident == "" then []
|
|
@@ -106,6 +252,7 @@ jq -n \
|
|
|
106
252
|
end ) as $m
|
|
107
253
|
| { source: $source,
|
|
108
254
|
environments: $envs,
|
|
255
|
+
hub: $hub,
|
|
109
256
|
identifier: $ident,
|
|
110
257
|
matchStatus: ( if $ident == "" then "none-requested"
|
|
111
258
|
elif ($m | length) == 0 then "not-connected"
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dx-org-devhub-configure
|
|
3
|
-
description: "Enable Dev Hub on a Salesforce org
|
|
4
|
-
allowed-tools: Read, Bash(bash), Bash(sf api request rest), Bash(sf data query), Bash(sf org list), Bash(sf
|
|
3
|
+
description: "Enable Dev Hub on a Salesforce org, view its status and scratch org allocation, or read its current DevHubSettings preferences, using the Salesforce CLI (sf). Use when someone wants to turn on or enable Dev Hub, set up an org for scratch orgs or 2GP/unlocked packages, check whether Dev Hub is already enabled, see scratch org allocation (Active/Daily limits, remaining, and a pre-flight warning near the limit), see which Dev Hub preferences (packaging, org shape export, scratch org snapshots) are on or off, configure those preferences, list active scratch orgs, or list authenticated orgs when none is specified. Enabling deploys enableScratchOrgManagementPref, is irreversible, needs a System Administrator (ModifyAllData or ModifyMetadata), and does not work in sandboxes. DO NOT TRIGGER for creating or deleting individual scratch orgs."
|
|
4
|
+
allowed-tools: Read, Bash(bash), Bash(sf api request rest), Bash(sf data query), Bash(sf org list), Bash(sf project deploy), Bash(sf config get), Bash(sf org display), Bash(sf org open), Bash(jq)
|
|
5
5
|
metadata:
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.1"
|
|
7
7
|
domains: ["Developer Experience"]
|
|
8
8
|
# DevHubSettings metadata + the Tooling API DevHubSettings endpoint require
|
|
9
|
-
# API 47.0
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- "dx-org-trial-expiration-check"
|
|
9
|
+
# DevHubSettings base fields need API 47.0+, but enableShapeExportPref needs
|
|
10
|
+
# 55.0+ and enableScratchOrgSnapshotPref needs 61.0+, so the script reads and
|
|
11
|
+
# deploys at 62.0 (see scripts/devhub.sh SETTINGS_API_VERSION).
|
|
12
|
+
minApiVersion: "62.0"
|
|
14
13
|
# Enabling needs ModifyAllData OR ModifyMetadata (either suffices). accessCheck
|
|
15
14
|
# is a flat array with no OR operator, so declaring both would read as AND and
|
|
16
15
|
# could falsely gate an admin holding only one. Declare the canonical
|
|
@@ -27,10 +26,12 @@ metadata:
|
|
|
27
26
|
# Enable Dev Hub & View Scratch Org Allocation
|
|
28
27
|
|
|
29
28
|
Enable **Dev Hub** on a Salesforce org, verify whether it is already on, and see
|
|
30
|
-
the org's **scratch org allocation** (Active and Daily limits
|
|
31
|
-
remain
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
the org's **scratch org allocation** (Active and Daily limits, how many
|
|
30
|
+
remain, and a pre-flight warning when close to the limit) — for the default
|
|
31
|
+
org or a named org. The skill can also read the org's current **DevHubSettings
|
|
32
|
+
preferences**, configure Dev Hub sub-preferences (packaging, org shape export,
|
|
33
|
+
scratch org snapshots), list the active scratch orgs created from a Dev Hub,
|
|
34
|
+
and list which orgs are authenticated when none is specified.
|
|
34
35
|
|
|
35
36
|
Dev Hub is the org feature that lets you **create and manage scratch orgs** and
|
|
36
37
|
**second-generation (2GP) / unlocked packages**.
|
|
@@ -45,7 +46,9 @@ Trigger on requests like:
|
|
|
45
46
|
limit?" / "How many scratch orgs do I have left?"
|
|
46
47
|
- "Turn on packaging / 2GP / unlocked packages" / "Enable org shape export" /
|
|
47
48
|
"Enable scratch org snapshots" (Dev Hub sub-preferences).
|
|
49
|
+
- "Which Dev Hub preferences are turned on?" / "Show my current DevHubSettings."
|
|
48
50
|
- "List the scratch orgs on my Dev Hub."
|
|
51
|
+
- "What orgs do I have authenticated?" / "I didn't pass an org — what's available?"
|
|
49
52
|
|
|
50
53
|
## When NOT to use
|
|
51
54
|
|
|
@@ -55,9 +58,6 @@ Do **not** trigger this skill for:
|
|
|
55
58
|
`sf org create scratch` / `sf org delete scratch`, a different workflow. This
|
|
56
59
|
skill enables the *Dev Hub feature* and reports *allocation*; it does not
|
|
57
60
|
create scratch orgs.
|
|
58
|
-
- **Switching the default/active org** — use `dx-org-switch`.
|
|
59
|
-
- **Trial or org expiration dates** ("when does my org expire") — use
|
|
60
|
-
`dx-org-trial-expiration-check`.
|
|
61
61
|
|
|
62
62
|
## How Dev Hub enablement is determined
|
|
63
63
|
|
|
@@ -80,9 +80,12 @@ ScratchOrgInfo` means Dev Hub is **ON**; an `INVALID_TYPE` error means it is
|
|
|
80
80
|
- **Requires** a user with **ModifyAllData** or **ModifyMetadata** (a **System
|
|
81
81
|
Administrator** has these). A user without them gets `INSUFFICIENT_ACCESS`.
|
|
82
82
|
- **Cannot** be enabled in a **sandbox**, or in an org that has a **registered
|
|
83
|
-
namespace**.
|
|
83
|
+
namespace**. The script checks the org's edition/sandbox facts before an
|
|
84
|
+
`--enable --apply` and refuses (no deploy attempted) if the target is a
|
|
85
|
+
sandbox; there's no reliable CLI signal for a registered namespace, so that
|
|
86
|
+
stays a documented caveat rather than an enforced check.
|
|
84
87
|
- Available in **Developer, Enterprise, Performance, Unlimited**, and **trial**
|
|
85
|
-
editions.
|
|
88
|
+
editions — `status` and `--allocation` show the org's edition when known.
|
|
86
89
|
|
|
87
90
|
## Steps
|
|
88
91
|
|
|
@@ -96,36 +99,45 @@ ScratchOrgInfo` means Dev Hub is **ON**; an `INVALID_TYPE` error means it is
|
|
|
96
99
|
containing this SKILL.md).
|
|
97
100
|
|
|
98
101
|
```bash
|
|
99
|
-
bash "<skill_dir>/scripts/devhub.sh" <alias-or-username> # status: on? + allocation
|
|
102
|
+
bash "<skill_dir>/scripts/devhub.sh" <alias-or-username> # status: on? + edition + allocation
|
|
100
103
|
bash "<skill_dir>/scripts/devhub.sh" # default org (target-org)
|
|
101
|
-
bash "<skill_dir>/scripts/devhub.sh" <org> --allocation # allocation
|
|
104
|
+
bash "<skill_dir>/scripts/devhub.sh" <org> --allocation # allocation + pre-flight warnings
|
|
105
|
+
bash "<skill_dir>/scripts/devhub.sh" <org> --show-settings # current DevHubSettings preferences
|
|
106
|
+
bash "<skill_dir>/scripts/devhub.sh" --list-orgs # authenticated orgs (no org needed)
|
|
102
107
|
bash "<skill_dir>/scripts/devhub.sh" <org> --enable # validate enabling (dry run)
|
|
103
108
|
bash "<skill_dir>/scripts/devhub.sh" <org> --enable --apply # actually enable (irreversible)
|
|
104
109
|
bash "<skill_dir>/scripts/devhub.sh" <org> --list-scratch # list active scratch orgs
|
|
105
|
-
bash "<skill_dir>/scripts/devhub.sh" <alias> --instance-url <url> --enable --apply # log in first, then enable
|
|
106
|
-
bash "<skill_dir>/scripts/devhub.sh" <url> # bare instance URL: log in to it
|
|
107
110
|
```
|
|
108
111
|
|
|
109
|
-
When the user supplies an instance URL (their My Domain, sandbox, or
|
|
110
|
-
pre-release/scratch login URL — e.g.
|
|
111
|
-
`https://my-domain.my.salesforce.com`), pass that exact URL with
|
|
112
|
-
`--instance-url <url>` — the script accepts Salesforce-owned hostnames and logs in with
|
|
113
|
-
`sf org login web --instance-url <url>` and then continues. A bare URL
|
|
114
|
-
positional is accepted as shorthand for the same thing.
|
|
115
|
-
|
|
116
112
|
`<skill_dir>` is the absolute path to the directory containing this SKILL.md.
|
|
117
113
|
|
|
118
114
|
2. **For enablement, default to a dry run first.** Run `--enable` (no `--apply`)
|
|
119
115
|
to validate the deploy, then relay the result. Because enabling is
|
|
120
116
|
**irreversible**, only run `--enable --apply` when the user has clearly asked
|
|
121
117
|
to actually enable Dev Hub. Applied operations require an explicit org alias
|
|
122
|
-
or username; the script refuses to mutate an implicit default org.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
118
|
+
or username; the script refuses to mutate an implicit default org. The
|
|
119
|
+
script also refuses to enable on a **sandbox** — it checks the org's edition
|
|
120
|
+
facts first and returns an eligibility explanation instead of deploying, and
|
|
121
|
+
`status` on a sandbox reports the same ineligibility. When the target is
|
|
122
|
+
ineligible (a sandbox, or an org with a registered namespace), **declining to
|
|
123
|
+
enable is the correct, complete outcome even if the user explicitly asked to
|
|
124
|
+
apply it** — do not deploy. Give a full answer that (1) states Dev Hub
|
|
125
|
+
**cannot** be enabled on this org, (2) says **why** (a sandbox cannot host a
|
|
126
|
+
Dev Hub; a registered namespace also blocks it), and (3) gives the
|
|
127
|
+
**alternative** — enable Dev Hub on the source **production** org, or a
|
|
128
|
+
**Developer Edition / trial** org, with a **System Administrator**, and use
|
|
129
|
+
that as the Dev Hub. Do not report a scratch-org allocation for an ineligible
|
|
130
|
+
org. If the deploy is rejected for permissions, surface the Setup-UI fallback
|
|
131
|
+
it prints.
|
|
132
|
+
|
|
133
|
+
3. Relay the script output. When an org can't be authenticated, the script
|
|
134
|
+
never logs in on its own — it prints the exact `sf org login web` command as
|
|
135
|
+
guidance; surface that command to the user so they can run it themselves,
|
|
136
|
+
then re-run the skill. When no org and no default are configured, it also
|
|
137
|
+
lists the authenticated orgs it found so the user can pick one. Pick
|
|
138
|
+
optional flags based on the request (see below): `--allocation` for limits
|
|
139
|
+
only, `--show-settings` for current preference values, `--list-orgs` for
|
|
140
|
+
discovery, `--list-scratch` to enumerate scratch orgs, `--packaging` /
|
|
129
141
|
`--snapshots` / `--shape` to turn on sub-preferences, `--json` for automation.
|
|
130
142
|
|
|
131
143
|
## Before you finish
|
|
@@ -134,15 +146,18 @@ Verify these before returning your answer:
|
|
|
134
146
|
|
|
135
147
|
- [ ] **CRITICAL:** Invoked the helper via its **absolute path** (`bash "<skill_dir>/scripts/devhub.sh" …`), never `./scripts/` (the script rejects a non-absolute `$0`).
|
|
136
148
|
- [ ] Did **not** run `--apply` unless the user clearly asked to actually enable Dev Hub or deploy a preference — enabling is **irreversible**.
|
|
137
|
-
- [ ]
|
|
149
|
+
- [ ] Did **not** attempt to log in on the user's behalf — if the org isn't authenticated, relayed the `sf org login web` guidance the script printed instead of running it.
|
|
150
|
+
- [ ] Relayed the script's own output (status/allocation/settings, the pre-flight warnings, the discovered orgs, the sandbox-eligibility refusal, or the login/Setup-UI guidance it printed), rather than substituting a hand-written answer.
|
|
138
151
|
|
|
139
152
|
## Options
|
|
140
153
|
|
|
141
154
|
| Flag | Purpose |
|
|
142
155
|
|------|---------|
|
|
143
|
-
| `--allocation`, `-A` | Show only the scratch org allocation (Active/Daily). |
|
|
156
|
+
| `--allocation`, `-A` | Show only the scratch org allocation (Active/Daily), including pre-flight `WARN`/`NOTE` lines when close to the limit. |
|
|
157
|
+
| `--show-settings`, `-s` | Show the org's current `DevHubSettings` preference values (packaging, snapshots, shape, etc.), ON/OFF. Requires Dev Hub to already be enabled. |
|
|
158
|
+
| `--list-orgs` | List authenticated orgs (alias, username, connected status, default marker). No target org required. |
|
|
144
159
|
| `--list-scratch`, `-l` | List active scratch orgs created from this Dev Hub. |
|
|
145
|
-
| `--enable`, `-e` | Enable Dev Hub (deploys `enableScratchOrgManagementPref=true`). Dry run unless `--apply
|
|
160
|
+
| `--enable`, `-e` | Enable Dev Hub (deploys `enableScratchOrgManagementPref=true`). Dry run unless `--apply`; refuses on a sandbox. |
|
|
146
161
|
| `--configure`, `-c` | Configure sub-preferences without (re)enabling the master switch. Pair with a pref flag. |
|
|
147
162
|
| `--packaging` | `enablePackaging2=true` (Unlocked + 2GP packages). |
|
|
148
163
|
| `--snapshots` | `enableScratchOrgSnapshotPref=true`. |
|
|
@@ -150,8 +165,6 @@ Verify these before returning your answer:
|
|
|
150
165
|
| `--scratch-management` | `enableScratchOrgManagementPref=true` (the Dev Hub switch). |
|
|
151
166
|
| `--pref KEY=VALUE` | Any `DevHubSettings` sub-pref (KEY starts with `enable`, VALUE `true`/`false`). Repeatable. |
|
|
152
167
|
| `--apply` | Actually deploy to the explicit org argument. Default for `--enable`/`--configure` is a validate-only dry run. |
|
|
153
|
-
| `--login` | Authenticate an org first via `sf org login web` (opens a browser), then run the action. |
|
|
154
|
-
| `--instance-url <url>` | Log in to a specific instance (My Domain, sandbox, or pre-release/scratch instance) with `sf org login web --instance-url <url>`. Implies `--login`. |
|
|
155
168
|
| `--json` | Emit machine-readable JSON. |
|
|
156
169
|
| `--fail-if-disabled` | Exit `3` if Dev Hub is not enabled (CI/cron gate). |
|
|
157
170
|
| `--help`, `-h` | Show usage. |
|
|
@@ -171,8 +184,12 @@ keep this workflow lean.
|
|
|
171
184
|
## Structured output for automation (`--json`)
|
|
172
185
|
|
|
173
186
|
Use `--json` in any mode for machine-readable output (no prose). Status returns
|
|
174
|
-
`devHubEnabled`, `status`, and an `allocation` object
|
|
175
|
-
|
|
187
|
+
`devHubEnabled`, `status`, `edition`, `isSandbox`, and an `allocation` object
|
|
188
|
+
(with `usedPct` per limit and a `warnings` array); `--show-settings` returns
|
|
189
|
+
`org` and a `settings` map of preference key → boolean; `--list-orgs` returns
|
|
190
|
+
a normalized array of `{alias, username, connectedStatus, isDefault}`;
|
|
191
|
+
enablement returns `success`, `applied`, and `devHubVerifiedState`.
|
|
192
|
+
Deterministic, no LLM needed.
|
|
176
193
|
|
|
177
194
|
```bash
|
|
178
195
|
bash "<skill_dir>/scripts/devhub.sh" my-devhub --json
|
|
@@ -189,59 +206,41 @@ Hub is not enabled, so a scheduled job can gate on it.
|
|
|
189
206
|
- `2` bad usage or a missing dependency (`sf` or `jq`)
|
|
190
207
|
- `3` Dev Hub is not enabled (only when `--fail-if-disabled` is set)
|
|
191
208
|
|
|
192
|
-
## Authentication
|
|
209
|
+
## Authentication (guidance only)
|
|
193
210
|
|
|
194
|
-
|
|
195
|
-
`--
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
`https://my-domain.my.salesforce.com` placeholder):
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
# Log in to a specific instance (My Domain / pre-release / sandbox), then enable:
|
|
204
|
-
bash "<skill_dir>/scripts/devhub.sh" my-alias \
|
|
205
|
-
--instance-url https://my-domain.my.salesforce.com --enable --apply
|
|
206
|
-
|
|
207
|
-
# Bare instance URL as shorthand — logs in to it, then reports status:
|
|
208
|
-
bash "<skill_dir>/scripts/devhub.sh" https://my-domain.my.salesforce.com
|
|
209
|
-
|
|
210
|
-
# Just authenticate an org (no other action):
|
|
211
|
-
bash "<skill_dir>/scripts/devhub.sh" my-alias --login
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
`sf org login web` opens a browser for the OAuth flow; complete it promptly (the
|
|
215
|
-
session times out). A supplied positional (`my-alias`) becomes the CLI alias; a
|
|
216
|
-
positional that looks like a URL (contains `://`) is taken as the
|
|
217
|
-
`--instance-url` to log in to. The script accepts only HTTPS Salesforce-owned
|
|
218
|
-
hostnames for this option. Omit `--instance-url` for standard
|
|
219
|
-
production/DE/trial logins (`login.salesforce.com`). If the browser flow keeps
|
|
220
|
-
timing out, the script prints the `sf org login device` fallback for a
|
|
221
|
-
code-based login.
|
|
222
|
-
|
|
223
|
-
If an org isn't authenticated and no login flag was passed, the script instead
|
|
224
|
-
prints the exact command to log in and re-run — using the instance URL you
|
|
225
|
-
supplied when there is one:
|
|
211
|
+
This skill **never runs an interactive login itself** — it has no `--login` or
|
|
212
|
+
`--instance-url` flag, and it never invokes `sf org login web` or
|
|
213
|
+
`sf org login device`. If the target org can't be queried (not authenticated,
|
|
214
|
+
expired session, wrong instance), the script prints the exact login command as
|
|
215
|
+
copy-paste **guidance** and stops; relay that command to the user and let them
|
|
216
|
+
run it, then re-run the skill:
|
|
226
217
|
|
|
227
218
|
```text
|
|
228
219
|
my-org could not query org (...)
|
|
229
220
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
221
|
+
This org is not authenticated (or the session expired). Authentication is
|
|
222
|
+
a precondition for this skill — run one of these yourself, then re-run:
|
|
223
|
+
sf org login web --alias 'my-org' # prod / DE / trial
|
|
224
|
+
sf org login web --alias <my-alias> --instance-url https://MYDOMAIN.my.salesforce.com # sandbox / My Domain
|
|
225
|
+
List existing logins with: sf org list
|
|
235
226
|
```
|
|
236
227
|
|
|
228
|
+
When no org and no default is configured at all, the script also runs org
|
|
229
|
+
discovery (`--list-orgs`) and lists the authenticated orgs it found, so the
|
|
230
|
+
user can pick one instead of guessing an alias.
|
|
231
|
+
|
|
237
232
|
## Manual fallback (if the script is unavailable)
|
|
238
233
|
|
|
239
234
|
```bash
|
|
240
235
|
# Detect Dev Hub (INVALID_TYPE error means OFF; a count means ON):
|
|
241
236
|
sf data query --query "SELECT COUNT() FROM ScratchOrgInfo" --target-org <org> --json
|
|
242
237
|
|
|
238
|
+
# Read current DevHubSettings preferences (requires Dev Hub already ON):
|
|
239
|
+
sf api request rest "/services/data/v62.0/tooling/sobjects/DevHubSettings/DevHub" \
|
|
240
|
+
--target-org <org> --json
|
|
241
|
+
|
|
243
242
|
# Enable Dev Hub via the Tooling API (what the Setup toggle does; irreversible):
|
|
244
|
-
sf api request rest "/services/data/
|
|
243
|
+
sf api request rest "/services/data/v62.0/tooling/sobjects/DevHubSettings/DevHub" \
|
|
245
244
|
--method PATCH \
|
|
246
245
|
--body '{"FullName":"DevHub","Metadata":{"enableScratchOrgManagementPref":true}}' \
|
|
247
246
|
--target-org <org>
|
|
@@ -250,12 +249,16 @@ sf api request rest "/services/data/v47.0/tooling/sobjects/DevHubSettings/DevHub
|
|
|
250
249
|
|
|
251
250
|
# View scratch org allocation:
|
|
252
251
|
sf org list limits --target-org <org> --json | jq '.result[] | select(.name|test("ScratchOrg"))'
|
|
252
|
+
|
|
253
|
+
# List authenticated orgs:
|
|
254
|
+
sf org list --json
|
|
253
255
|
```
|
|
254
256
|
|
|
255
257
|
## Notes
|
|
256
258
|
|
|
257
259
|
- Requires the Salesforce CLI (`sf`) and `jq` on the PATH, plus at least one
|
|
258
|
-
authenticated org
|
|
260
|
+
authenticated org. This skill only ever prints the `sf org login web`
|
|
261
|
+
command as guidance — it never runs it.
|
|
259
262
|
- After enabling, set the org as your default Dev Hub:
|
|
260
263
|
`sf config set target-dev-hub <org>`.
|
|
261
264
|
- Enabling **packaging** (`enablePackaging2`) requires Dev Hub to be on first —
|
|
@@ -263,5 +266,3 @@ sf org list limits --target-org <org> --json | jq '.result[] | select(.name|test
|
|
|
263
266
|
- Non-admin users still need object access (Read/Create on `ScratchOrgInfo` and
|
|
264
267
|
`ActiveScratchOrg`) to create/view scratch orgs, and the "Create and Update
|
|
265
268
|
Second-Generation Packages" permission to build 2GP/unlocked packages.
|
|
266
|
-
- To *switch* the default org use `dx-org-switch`; to check *expiration* use
|
|
267
|
-
`dx-org-trial-expiration-check`.
|
|
@@ -5,26 +5,49 @@ These are reference only — the script prints the authoritative output at runti
|
|
|
5
5
|
|
|
6
6
|
## Dev Hub is ON (status + allocation)
|
|
7
7
|
|
|
8
|
+
`status` mode prints the enablement line, the org edition, the signup-record
|
|
9
|
+
count, a one-line summary of which preferences are on, and the allocation table.
|
|
10
|
+
|
|
8
11
|
```text
|
|
9
12
|
Dev Hub status for 'MyDevHub':
|
|
10
13
|
Dev Hub: ENABLED (ScratchOrgInfo is queryable)
|
|
14
|
+
Edition: Developer Edition
|
|
11
15
|
Scratch org signup records: 3
|
|
16
|
+
Enabled preferences: enableScratchOrgManagementPref enableScratchOrgSnapshotPref
|
|
12
17
|
|
|
13
18
|
Scratch org allocation for 'MyDevHub':
|
|
14
19
|
Limit Used Remaining Max
|
|
15
|
-
Active scratch orgs
|
|
16
|
-
Daily scratch orgs
|
|
20
|
+
Active scratch orgs 2 1 3
|
|
21
|
+
Daily scratch orgs 5 1 6
|
|
22
|
+
WARN: only 1 active scratch org(s) remaining.
|
|
23
|
+
NOTE: Daily scratch org usage at 83% (5/6).
|
|
17
24
|
|
|
18
25
|
Active = orgs alive right now; Daily = successful creations in a rolling 24h window.
|
|
19
26
|
Allocation is set by the Dev Hub's edition (e.g. Developer/trial 3 & 6;
|
|
20
27
|
Enterprise 40 & 80; Unlimited/Performance 100 & 200) plus any purchased add-on.
|
|
21
28
|
```
|
|
22
29
|
|
|
30
|
+
## Current preferences (`--show-settings`)
|
|
31
|
+
|
|
32
|
+
`--show-settings` prints every `DevHubSettings` preference with an explicit
|
|
33
|
+
ON/OFF, one per line (requires Dev Hub to already be enabled).
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
DevHub preferences for 'MyDevHub':
|
|
37
|
+
enableScratchOrgManagementPref ON
|
|
38
|
+
enablePackaging2 OFF
|
|
39
|
+
enableScratchOrgSnapshotPref ON
|
|
40
|
+
enableShapeExportPref OFF
|
|
41
|
+
```
|
|
42
|
+
|
|
23
43
|
## Dev Hub is OFF (prints how to enable it)
|
|
24
44
|
|
|
25
45
|
```text
|
|
26
46
|
Dev Hub status for 'my-org':
|
|
27
47
|
Dev Hub: NOT ENABLED
|
|
48
|
+
Detection: ScratchOrgInfo is queryable only when Dev Hub is on. A successful count means ENABLED. An INVALID_TYPE error means NOT ENABLED. Scratch org limits are not used, because they are reported even when Dev Hub is off.
|
|
49
|
+
|
|
50
|
+
Scratch org allocation, Dev Hub preferences, and the scratch org list are not available until Dev Hub is enabled. An empty allocation or a failed exit from those modes means Dev Hub is off, not that the org is unauthenticated.
|
|
28
51
|
|
|
29
52
|
Enable it (deploys enableScratchOrgManagementPref=true; irreversible):
|
|
30
53
|
devhub.sh "my-org" --enable # validate first (dry run)
|