@salesforce/afv-skills 1.67.0 → 1.68.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 (118) hide show
  1. package/README.md +55 -5
  2. package/package.json +1 -1
  3. package/skills/agentforce-offline-experimentation-run/SKILL.md +14 -22
  4. package/skills/agentforce-offline-experimentation-run/scripts/bt_compare.py +81 -0
  5. package/skills/agentforce-offline-experimentation-run/scripts/bt_fetch.py +358 -0
  6. package/skills/agentforce-offline-experimentation-run/scripts/bt_patch_agent.py +110 -0
  7. package/skills/agentforce-offline-experimentation-run/scripts/btlib/__init__.py +34 -0
  8. package/skills/agentforce-offline-experimentation-run/scripts/btlib/agentpatch.py +483 -0
  9. package/skills/agentforce-offline-experimentation-run/scripts/btlib/agentsrc.py +565 -0
  10. package/skills/agentforce-offline-experimentation-run/scripts/btlib/cache.py +95 -0
  11. package/skills/agentforce-offline-experimentation-run/scripts/btlib/compare.py +617 -0
  12. package/skills/agentforce-offline-experimentation-run/scripts/btlib/fetch.py +1012 -0
  13. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +148 -0
  14. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +92 -0
  15. package/skills/agentforce-offline-experimentation-run/scripts/btlib/patch.py +327 -0
  16. package/skills/agentforce-offline-experimentation-run/scripts/btlib/redact.py +40 -0
  17. package/skills/agentforce-offline-experimentation-run/scripts/btlib/results.py +288 -0
  18. package/skills/agentforce-offline-experimentation-run/scripts/btlib/scoring.py +340 -0
  19. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +238 -0
  20. package/skills/agentforce-offline-experimentation-run/scripts/btlib/splits.py +136 -0
  21. package/skills/agentforce-offline-experimentation-run/scripts/btlib/stdm.py +98 -0
  22. package/skills/agentforce-offline-experimentation-run/scripts/btlib/tokens.py +173 -0
  23. package/skills/agentforce-offline-experimentation-run/scripts/btlib/units.py +199 -0
  24. package/skills/agentforce-offline-experimentation-run/scripts/btlib/versions.py +194 -0
  25. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +366 -378
  26. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +14 -4
  27. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +472 -796
  28. package/skills/dx-lifecycle-center/SKILL.md +5 -2
  29. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +65 -0
  30. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +32 -0
  31. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +57 -0
  32. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +21 -0
  33. package/skills/dx-lifecycle-center/examples/workflows.md +20 -6
  34. package/skills/dx-lifecycle-center/references/connect-org.md +21 -2
  35. package/skills/dx-lifecycle-center/references/deploy.md +2 -2
  36. package/skills/dx-lifecycle-center/references/list-orgs.md +1 -1
  37. package/skills/dx-lifecycle-center/scripts/card-policy.jq +71 -0
  38. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +29 -0
  39. package/skills/dx-lifecycle-center/scripts/widget.sh +28 -0
  40. package/skills/dx-org-devhub-configure/SKILL.md +85 -84
  41. package/skills/dx-org-devhub-configure/examples/status-output.md +25 -2
  42. package/skills/dx-org-devhub-configure/scripts/devhub.sh +265 -140
  43. package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +100 -15
  44. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +89 -0
  45. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +164 -0
  46. package/skills/dx-scratch-def-configure/SKILL.md +163 -0
  47. package/skills/dx-scratch-def-configure/examples/confirm-card.md +53 -0
  48. package/skills/dx-scratch-def-configure/examples/report-recipes.md +100 -0
  49. package/skills/dx-scratch-def-configure/references/features.json +3270 -0
  50. package/skills/dx-scratch-def-configure/references/project-scratch-def.schema.json +1841 -0
  51. package/skills/dx-scratch-def-configure/references/settings-map.json +682 -0
  52. package/skills/dx-scratch-def-configure/scripts/lib_scratch_def.py +1306 -0
  53. package/skills/dx-scratch-def-configure/scripts/requirements.txt +3 -0
  54. package/skills/dx-scratch-def-configure/scripts/scrape_config_values.py +848 -0
  55. package/skills/education-cloud-domain-configure/SKILL.md +1 -1
  56. package/skills/education-cloud-multi-campus-configure/SKILL.md +1 -1
  57. package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +1 -1
  58. package/skills/experience-design-validate/SKILL.md +1 -1
  59. package/skills/experience-search-coordinate/SKILL.md +18 -12
  60. package/skills/experience-search-coordinate/references/content-route.md +79 -1
  61. package/skills/field-service-data-capture-migrate/SKILL.md +1 -1
  62. package/skills/platform-apex-generate/SKILL.md +14 -11
  63. package/skills/platform-apex-test-generate/SKILL.md +2 -1
  64. package/skills/platform-datamask-run/SKILL.md +52 -71
  65. package/skills/platform-datamask-run/references/api-surface.md +10 -4
  66. package/skills/platform-datamask-run/references/policy-authoring.md +56 -7
  67. package/skills/platform-datamask-run/references/run-and-abort.md +17 -10
  68. package/skills/platform-datamask-run/scripts/poll-job.sh +15 -25
  69. package/skills/platform-dataspace-access-configure/SKILL.md +19 -1
  70. package/skills/platform-metadata-discovery-get/SKILL.md +185 -0
  71. package/skills/platform-metadata-discovery-get/references/api-map.md +25 -0
  72. package/skills/platform-metadata-discovery-get/references/h360-routes.md +30 -0
  73. package/skills/platform-metadata-discovery-get/references/scoped-soql.md +52 -0
  74. package/skills/platform-metadata-grounding-get/SKILL.md +170 -0
  75. package/skills/platform-policy-rule-generate/SKILL.md +84 -232
  76. package/skills/platform-policy-rule-generate/references/condition-model.md +47 -0
  77. package/skills/platform-policy-rule-generate/references/condition-templates.md +89 -0
  78. package/skills/platform-policy-rule-generate/references/conjunction-compiler.md +25 -0
  79. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +22 -0
  80. package/skills/platform-policy-rule-generate/references/consumer-all.md +9 -0
  81. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +91 -0
  82. package/skills/platform-policy-rule-generate/references/deploy-errors.md +24 -36
  83. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/package.xml +12 -0
  84. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +6 -0
  85. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitions/ExistsJoinRLS_Rule_1.policyRuleDefinition +91 -0
  86. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/package.xml +12 -0
  87. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +6 -0
  88. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitions/FieldReadDeny_Rule_1.policyRuleDefinition +72 -0
  89. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/package.xml +12 -0
  90. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +6 -0
  91. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitions/LastCharactersFieldMasking_Rule_1.policyRuleDefinition +77 -0
  92. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/package.xml +12 -0
  93. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +6 -0
  94. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitions/PrincipalFieldMatchRLS_Rule_1.policyRuleDefinition +77 -0
  95. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/package.xml +12 -0
  96. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +4 -0
  97. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitions/TaggedObjectAccess_Rule_1.policyRuleDefinition +65 -0
  98. package/skills/platform-policy-rule-generate/references/headless-transport.md +87 -0
  99. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +17 -10
  100. package/skills/platform-policy-rule-generate/references/policy-shapes.md +74 -0
  101. package/skills/platform-policy-rule-generate/references/principal-expression.md +31 -0
  102. package/skills/platform-policy-rule-generate/references/reference-resolution.md +51 -0
  103. package/skills/platform-policy-rule-generate/references/resource-expression.md +48 -0
  104. package/skills/platform-policy-rule-generate/references/runtime-context.md +9 -0
  105. package/skills/platform-policy-rule-generate/references/templates-access.md +11 -9
  106. package/skills/platform-policy-rule-generate/references/templates-advanced.md +4 -2
  107. package/skills/platform-policy-rule-generate/references/templates-record.md +37 -22
  108. package/skills/platform-policy-rule-generate/references/templates-transform.md +10 -8
  109. package/skills/platform-policy-rule-generate/references/templates.md +2 -2
  110. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +35 -17
  111. package/skills/platform-report-generate/SKILL.md +9 -4
  112. package/skills/platform-report-generate/references/chart-types.md +26 -2
  113. package/skills/platform-report-generate/references/column-names.md +43 -0
  114. package/skills/platform-report-generate/references/errors-and-troubleshooting.md +1 -1
  115. package/skills/platform-report-generate/references/verification-checklist.md +10 -2
  116. package/skills/service-digital-engagement-channel-configure/SKILL.md +7 -5
  117. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +33 -0
  118. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +110 -14
@@ -1,16 +1,15 @@
1
1
  ---
2
2
  name: dx-org-devhub-configure
3
- description: "Enable Dev Hub on a Salesforce org and view its scratch org allocation, using the Salesforce CLI (sf). Use when someone wants to turn on or enable Dev Hub, set up an org to create scratch orgs or second-generation (2GP) and unlocked packages, check whether Dev Hub is already enabled, see how many scratch orgs they can create (Active and Daily scratch org limits, remaining allocation), configure Dev Hub preferences such as packaging, org shape export, or scratch org snapshots, or list the active scratch orgs created from a Dev Hub. Enabling deploys the enableScratchOrgManagementPref setting, 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, for switching the default org (use dx-org-switch), or for trial or org expiration dates (use dx-org-trial-expiration-check)."
4
- allowed-tools: Read, Bash(bash), Bash(sf api request rest), Bash(sf data query), Bash(sf org list), Bash(sf org login web), Bash(sf org login device), Bash(sf project deploy), Bash(sf config get), Bash(sf org display), Bash(sf org open), Bash(jq)
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.0"
6
+ version: "1.1"
7
7
  domains: ["Developer Experience"]
8
8
  # DevHubSettings metadata + the Tooling API DevHubSettings endpoint require
9
- # API 47.0 or later (see scripts/devhub.sh SETTINGS_API_VERSION).
10
- minApiVersion: "47.0"
11
- relatedSkills:
12
- - "dx-org-switch"
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 and how many
31
- remain) — for the default org or a named org. The skill can also configure Dev
32
- Hub sub-preferences (packaging, org shape export, scratch org snapshots) and
33
- list the active scratch orgs created from a Dev Hub.
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 only
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. If the
123
- deploy is rejected for permissions, surface the Setup-UI fallback it prints.
124
-
125
- 3. Relay the script output. When an org can't be queried, surface the
126
- `sf org login web` command the script prints so the user can authenticate.
127
- Pick optional flags based on the request (see below): `--allocation` for
128
- limits only, `--list-scratch` to enumerate scratch orgs, `--packaging` /
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
- - [ ] Relayed the script's own output (status/allocation or the login/Setup-UI guidance it printed), rather than substituting a hand-written answer.
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; enablement returns
175
- `success`, `applied`, and `devHubVerifiedState`. Deterministic, no LLM needed.
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
- If the org isn't authenticated yet, the skill can log in for you with
195
- `--login` (or `--instance-url <url>`), then continue with the requested action
196
- in the same run — this is the preferred path when the user provides an instance
197
- URL:
198
-
199
- Substitute the user's actual instance URL for `<url>` (shown here as the generic
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
- To authenticate against https://my-domain.my.salesforce.com, run:
231
- sf org login web --instance-url "https://my-domain.my.salesforce.com" --alias "my-org"
232
- Or let this script log you in and continue in one step:
233
- devhub.sh "my-org" --instance-url "https://my-domain.my.salesforce.com" --login
234
- Then re-run. List existing logins with: sf org list
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/v47.0/tooling/sobjects/DevHubSettings/DevHub" \
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 (`sf org login web`).
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 0 3 3
16
- Daily scratch orgs 0 6 6
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)