@salesforce/afv-skills 1.31.0 → 1.32.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 (98) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-bot-upgrade/SKILL.md +217 -0
  3. package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +242 -0
  4. package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +128 -0
  5. package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +208 -0
  6. package/skills/agentforce-bot-upgrade/references/input-contract.md +101 -0
  7. package/skills/agentforce-bot-upgrade/references/mapping-rules.md +113 -0
  8. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +78 -0
  9. package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +67 -0
  10. package/skills/agentforce-bot-upgrade/references/quality-checklist.md +33 -0
  11. package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +116 -0
  12. package/skills/dx-devops-work-item-manage/SKILL.md +270 -0
  13. package/skills/dx-devops-work-item-manage/examples/common-workflows.md +479 -0
  14. package/skills/dx-devops-work-item-manage/references/cli-commands.md +476 -0
  15. package/skills/dx-org-manage/SKILL.md +8 -5
  16. package/skills/dx-org-trial-expiration-check/SKILL.md +239 -0
  17. package/skills/dx-org-trial-expiration-check/scripts/check_expiration.sh +588 -0
  18. package/skills/experience-ui-bundle-app-coordinate/SKILL.md +12 -9
  19. package/skills/experience-ui-bundle-custom-app-generate/SKILL.md +29 -5
  20. package/skills/experience-ui-bundle-custom-app-generate/references/configure-metadata-custom-application.md +1 -1
  21. package/skills/experience-ui-bundle-custom-app-generate/scripts/resolve-uibundle-path.sh +30 -0
  22. package/skills/experience-ui-bundle-features-generate/SKILL.md +86 -11
  23. package/skills/experience-ui-bundle-features-generate/references/conflict-resolution-schema.json +20 -0
  24. package/skills/experience-ui-bundle-features-generate/scripts/verify-react-bundle.sh +14 -0
  25. package/skills/experience-ui-bundle-frontend-generate/SKILL.md +6 -1
  26. package/skills/experience-ui-bundle-frontend-generate/references/component.md +34 -1
  27. package/skills/experience-ui-bundle-frontend-generate/references/page.md +1 -1
  28. package/skills/experience-ui-bundle-project-generate/SKILL.md +111 -0
  29. package/skills/experience-ui-bundle-project-generate/scripts/flatten-project.mjs +33 -0
  30. package/skills/platform-custom-lightning-type-generate/SKILL.md +9 -14
  31. package/skills/platform-custom-lightning-type-generate/references/widget-rendition.md +27 -111
  32. package/skills/platform-lightning-type-widget-coordinate/SKILL.md +214 -0
  33. package/skills/platform-lightning-type-widget-coordinate/examples/existing-lightning-type-with-widget-prompt.md +80 -0
  34. package/skills/platform-lightning-type-widget-coordinate/examples/new-lightning-type-with-widget-prompt.md +75 -0
  35. package/skills/platform-lightning-type-widget-coordinate/references/build-plan-format.md +67 -0
  36. package/skills/platform-lightning-type-widget-coordinate/references/lightning-type-discovery.md +124 -0
  37. package/skills/platform-lightning-type-widget-coordinate/references/validation-gates.md +130 -0
  38. package/skills/platform-sharing-owd-configure/SKILL.md +142 -0
  39. package/skills/platform-sharing-owd-configure/examples/get_owd_output.md +38 -0
  40. package/skills/platform-sharing-owd-configure/examples/update_owd_output.md +44 -0
  41. package/skills/platform-sharing-owd-configure/references/access_levels.md +49 -0
  42. package/skills/platform-sharing-owd-configure/references/metadata_api_approach.md +69 -0
  43. package/skills/platform-sharing-rules-generate/SKILL.md +89 -19
  44. package/skills/platform-sharing-rules-generate/examples/test-cases.md +381 -0
  45. package/skills/platform-widget-generate/SKILL.md +241 -0
  46. package/skills/platform-widget-generate/examples/conditional.json +73 -0
  47. package/skills/platform-widget-generate/examples/list-with-foreach.json +66 -0
  48. package/skills/platform-widget-generate/examples/single-object.json +64 -0
  49. package/skills/platform-widget-generate/references/schema-from-lightning-type.md +76 -0
  50. package/skills/platform-widget-generate/references/widget-bundle-layout.md +116 -0
  51. package/skills/platform-widget-generate/references/widget-meta-directives.md +130 -0
  52. package/skills/sales-agentforce-pipeline-management-configure/SKILL.md +268 -0
  53. package/skills/sales-agentforce-pipeline-management-configure/assets/field-completion-template.genAiPromptTemplate-meta.xml +141 -0
  54. package/skills/sales-agentforce-pipeline-management-configure/assets/pipeline_management_flow.flow-meta.xml +548 -0
  55. package/skills/sales-agentforce-pipeline-management-configure/assets/sales_management_agent.agent +2938 -0
  56. package/skills/sales-agentforce-pipeline-management-configure/assets/sales_management_agent.bundle-meta.xml +4 -0
  57. package/skills/sales-agentforce-pipeline-management-configure/assets/sfdx-project.json +12 -0
  58. package/skills/sales-agentforce-pipeline-management-configure/assets/stage-descriptions/bant.txt +11 -0
  59. package/skills/sales-agentforce-pipeline-management-configure/assets/stage-descriptions/meddic.txt +11 -0
  60. package/skills/sales-agentforce-pipeline-management-configure/assets/stage-descriptions/spiced.txt +11 -0
  61. package/skills/sales-agentforce-pipeline-management-configure/examples/custom-prompt-instructions.md +317 -0
  62. package/skills/sales-agentforce-pipeline-management-configure/references/admin-communication.md +355 -0
  63. package/skills/sales-agentforce-pipeline-management-configure/references/agent-creation.md +383 -0
  64. package/skills/sales-agentforce-pipeline-management-configure/references/auth-and-cli.md +146 -0
  65. package/skills/sales-agentforce-pipeline-management-configure/references/automation-matrix.md +23 -0
  66. package/skills/sales-agentforce-pipeline-management-configure/references/autonomous-updates.md +215 -0
  67. package/skills/sales-agentforce-pipeline-management-configure/references/canonical-agent-path.md +75 -0
  68. package/skills/sales-agentforce-pipeline-management-configure/references/data-sources.md +155 -0
  69. package/skills/sales-agentforce-pipeline-management-configure/references/field-completion-prompt-template.md +120 -0
  70. package/skills/sales-agentforce-pipeline-management-configure/references/field-completion-prompts.md +149 -0
  71. package/skills/sales-agentforce-pipeline-management-configure/references/flags.md +13 -0
  72. package/skills/sales-agentforce-pipeline-management-configure/references/flow-clone-from-template.md +447 -0
  73. package/skills/sales-agentforce-pipeline-management-configure/references/metadata-inventory.md +330 -0
  74. package/skills/sales-agentforce-pipeline-management-configure/references/opportunity-stages.md +246 -0
  75. package/skills/sales-agentforce-pipeline-management-configure/references/repair-diagnostics.md +265 -0
  76. package/skills/sales-agentforce-pipeline-management-configure/references/setup-order.md +263 -0
  77. package/skills/sales-agentforce-pipeline-management-configure/references/soap-api-enablement.md +528 -0
  78. package/skills/sales-agentforce-pipeline-management-configure/scripts/CHANGES.md +180 -0
  79. package/skills/sales-agentforce-pipeline-management-configure/scripts/README.md +56 -0
  80. package/skills/sales-agentforce-pipeline-management-configure/scripts/add-field-suggestion.sh +679 -0
  81. package/skills/sales-agentforce-pipeline-management-configure/scripts/create-agent.sh +302 -0
  82. package/skills/sales-agentforce-pipeline-management-configure/scripts/create-flow.sh +250 -0
  83. package/skills/sales-agentforce-pipeline-management-configure/scripts/define-agent-access.sh +430 -0
  84. package/skills/sales-agentforce-pipeline-management-configure/scripts/deploy-settings.sh +77 -0
  85. package/skills/sales-agentforce-pipeline-management-configure/scripts/enable-deal-agent.sh +241 -0
  86. package/skills/sales-agentforce-pipeline-management-configure/scripts/enable-prerequisites.sh +538 -0
  87. package/skills/sales-agentforce-pipeline-management-configure/scripts/flow-debug-and-verify.sh +385 -0
  88. package/skills/sales-agentforce-pipeline-management-configure/scripts/retrieve-settings.sh +131 -0
  89. package/skills/sales-agentforce-pipeline-management-configure/scripts/setup-all.sh +2791 -0
  90. package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/agent-bundle-publish.sh +189 -0
  91. package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/agent-detection.sh +239 -0
  92. package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/flow-builder.sh +238 -0
  93. package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/psg.sh +48 -0
  94. package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/soap.sh +140 -0
  95. package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/stage-descriptions.sh +448 -0
  96. package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/test-opp.sh +166 -0
  97. package/skills/sales-agentforce-pipeline-management-configure/scripts/verify-all.sh +636 -0
  98. package/skills/sales-agentforce-pipeline-management-configure/scripts/verify-prompt-generation.sh +346 -0
@@ -0,0 +1,124 @@
1
+ # Lightning Type Discovery Procedure
2
+
3
+ Use this procedure in Phase 2 of the orchestrator workflow. The goal is to resolve the user's named Lightning Type into an on-disk `schema.json`, verify it is **Apex-backed** (the only kind this orchestrator handles), and capture a SHA-256 fingerprint plus the Apex class FQN for the Phase 5 P0 gate and the Phase 4 widget-skill handoff.
4
+
5
+ > **Applies to the `existing-lightning-type-with-widget` path only.** Skipped on the `new-lightning-type-with-widget` path (the user is creating a new Lightning Type — there is nothing to discover). Do not run this procedure when Phase 1 picks `new-lightning-type-with-widget`.
6
+
7
+ ---
8
+
9
+ The sequence is **find → verify → ensure-class**: locate the Lightning Type (local project first, then org), verify it is Apex-backed, then ensure its backing Apex class is in the local project (retrieving it from the org if needed). The downstream widget skill and the Phase 5 `field-trace` gate both read the `.cls` to enumerate `@AuraEnabled` fields — a Lightning Type without its class in the local project is unrenderable.
10
+
11
+ ---
12
+
13
+ ## Step 1 — Search the local project files
14
+
15
+ Look for any of:
16
+
17
+ - `force-app/**/lightningTypes/<TypeName>/schema.json`
18
+ - `<pkgDir>/lightningTypes/<TypeName>/schema.json` where `<pkgDir>` = `<packageDirectories[].path>/main/default` (per `platform-widget-generate/references/widget-bundle-layout.md`).
19
+
20
+ Match `<TypeName>` case-insensitively for the search but preserve the directory's actual case for outputs.
21
+
22
+ **Outcomes:**
23
+
24
+ - **Exactly one match.** Continue to Step 3 (verify Apex-backed) before capturing path + SHA-256.
25
+ - **Multiple matches** (case-insensitive name collision, multiple package directories, etc.). List candidates with their full paths to the user. Ask: *"Multiple Lightning Types match `<TypeName>`. Which one should the widget ground on?"* Wait for the user's pick, then continue to Step 3.
26
+ - **No match — do not skip.** Continue to Step 2 (org retrieve).
27
+
28
+ ---
29
+
30
+ ## Step 2 — Retrieve from the org
31
+
32
+ If the Lightning Type is not in the local project, run:
33
+
34
+ ```bash
35
+ sf project retrieve start --metadata LightningTypeBundle:<TypeName>
36
+ ```
37
+
38
+ The retrieve writes the Lightning Type bundle into the project under the configured package directory.
39
+
40
+ **Outcomes:**
41
+
42
+ - **Retrieve succeeds with one Lightning Type.** Continue to Step 3 (verify Apex-backed) before capturing path + SHA-256 + Apex class FQN.
43
+ - **Retrieve succeeds with multiple Lightning Types** (wildcard match; `LightningType:*<partial>*`). List them. Ask the user to pick. Re-retrieve with the exact name if needed, then continue to Step 3.
44
+ - **Retrieve reports "no metadata found".** The Lightning Type does not exist in the org. Continue to Step 5.
45
+ - **Retrieve fails with an error** (auth expired, org unreachable, permission denied, etc.). Surface the CLI error verbatim. Ask the user to fix and re-run.
46
+
47
+ ---
48
+
49
+ ## Step 3 — Verify the Lightning Type is Apex-backed
50
+
51
+ Read the located `schema.json`. Inspect the root `lightning:type` value.
52
+
53
+ | Root `lightning:type` value | Decision |
54
+ |---|---|
55
+ | Starts with `@apexClassType/` (for example `@apexClassType/c__AccountBriefing`) | **Apex-backed.** Continue. Capture the FQN — everything after `@apexClassType/`. The FQN points at the **outer Apex class**, whose `@AuraEnabled` fields define the payload shape. The `$<InnerClass>` suffix is not used at the Lightning Type root; inner classes live as `List<Inner>` fields on the outer class. |
56
+ | `lightning__objectType` (with primitive `properties`) | **Object/JSON-based.** Out of scope for this orchestrator. Tell the user: *"`<TypeName>` is an object/JSON-based Lightning Type. This orchestrator only handles Apex-backed Lightning Types. Use `platform-custom-lightning-type-generate` and `platform-widget-generate` separately for this case."* Stop. |
57
+ | Anything else | Surface the unrecognized value to the user and stop. Do not guess. |
58
+
59
+ When Apex-backed, capture path + SHA-256 + Apex class FQN, then continue to Step 4 (do not stop here — the class must be verified in the local project first).
60
+
61
+ ---
62
+
63
+ ## Step 4 — Ensure the backing Apex class is in the local project
64
+
65
+ **Both entry paths converge here** — a Lightning Type located in the local project (Step 1) and one retrieved from the org (Step 2) both reach this step. Locating the Lightning Type does NOT guarantee its backing class is local: `sf project retrieve --metadata LightningTypeBundle:<TypeName>` pulls only the bundle, not the referenced Apex class, and a hand-authored or partially-synced local bundle can reference a class that was never committed.
66
+
67
+ Parse `<ClassName>` from the Apex class FQN captured in Step 3 (`@apexClassType/<namespace>__<ClassName>` → `<ClassName>`; strip any `$<Inner>` suffix — retrieve the outer class). Check whether `<pkgDir>/classes/<ClassName>.cls` exists in the local project.
68
+
69
+ **Outcomes (covering all four LT × class scenarios):**
70
+
71
+ | Lightning Type source | `.cls` in local project? | Action |
72
+ |---|---|---|
73
+ | local project (Step 1) | yes | Nothing to do — continue. |
74
+ | local project (Step 1) | no | Retrieve the class (below). |
75
+ | org-retrieve (Step 2) | yes | Nothing to do — continue. |
76
+ | org-retrieve (Step 2) | no | Retrieve the class (below). |
77
+
78
+ When the class is absent, retrieve it by name:
79
+
80
+ ```bash
81
+ sf project retrieve start --metadata ApexClass:<ClassName>
82
+ ```
83
+
84
+ `ApexClass` is the metadata type; `<ClassName>` is the bare class name — no namespace prefix, no `.cls` extension. For multiple classes, comma-separate: `--metadata ApexClass:OrderSummary --metadata ApexClass:OrderLine`.
85
+
86
+ **Retrieve outcomes:**
87
+
88
+ - **Succeeds.** The `.cls` now lands under `<pkgDir>/classes/`. Continue.
89
+ - **Reports "no metadata found".** The backing class exists neither in the local project nor in the org — the Lightning Type is **unrenderable** (its payload shape is undefined). Surface this to the user verbatim and STOP. Do not hand the widget skill a Lightning Type whose `@AuraEnabled` fields cannot be enumerated.
90
+ - **Fails with an error** (auth expired, org unreachable, permission denied). Surface the CLI error verbatim. Ask the user to fix and re-run.
91
+
92
+ Done — path + SHA-256 + Apex class FQN captured, and the `.cls` confirmed in the local project.
93
+
94
+ ---
95
+
96
+ ## Step 5 — Lightning Type does not exist anywhere
97
+
98
+ Tell the user the Lightning Type is not in the local project and not in the org. Offer to **switch to the `new-lightning-type-with-widget` path** — generate a new Apex-backed Lightning Type (with its Apex class, auto-engaged) before authoring the widget.
99
+
100
+ Wait for the user's confirmation. Do not silently pick. If the user does not want a Lightning Type at all, route them to `platform-widget-generate` directly — that case is outside this orchestrator's scope.
101
+
102
+ ---
103
+
104
+ ## Staleness rule
105
+
106
+ Do **not** maintain a cross-session cache. Each invocation of this orchestrator re-reads the local project and re-retrieves from the org as needed. Any single retrieve result is treated as authoritative for the lifetime of that orchestrator run.
107
+
108
+ ---
109
+
110
+ ## Output of Phase 2
111
+
112
+ ```text
113
+ lightningTypeSchema = {
114
+ name: "<TypeName>",
115
+ path: "<pkgDir>/lightningTypes/<TypeName>/schema.json",
116
+ sha256: "<hex>",
117
+ source: "fs" | "org-retrieve",
118
+ apexClassFqn: "<namespace>__<ClassName>", # outer class only — no $<Inner> form
119
+ apexClassPath: "<pkgDir>/classes/<ClassName>.cls", # guaranteed in the local project by Step 4
120
+ apexClassSource: "fs" | "org-retrieve",
121
+ }
122
+ ```
123
+
124
+ Phase 2 always ends with a non-null `lightningTypeSchema` on the `existing-lightning-type-with-widget` path, **and with the backing `.cls` confirmed in the local project** (per Step 4). If discovery fails and the user does not switch to `new-lightning-type-with-widget`, or if the backing Apex class exists nowhere, the orchestrator stops.
@@ -0,0 +1,130 @@
1
+ # Validation Gates
2
+
3
+ The orchestrator runs only **cross-skill validations** — checks that span two skills' outputs or compare against state captured in earlier phases. Widget-bundle-internal checks (schema parses, root keys, leaf types, attribute bindings resolve, `.uiwidget-meta.xml` well-formed, `<UiWidgetBundle>` root, widget-type) are owned by `platform-widget-generate` and run as part of its own self-validation step.
4
+
5
+ Run every gate below. If a hard-failure gate fails, fix and re-run before reporting success. Warn-level gates are advisory — failures emit warnings but do not block.
6
+
7
+ ---
8
+
9
+ ## Hard — block on failure
10
+
11
+ | Name | Gate | Failure → fix |
12
+ |---|---|---|
13
+ | `lightning-type-unchanged` | **`existing-lightning-type-with-widget` only** — the Lightning Type `schema.json` SHA-256 captured in Phase 2 matches the on-disk SHA at end of Phase 4. | The orchestrator (or a sub-skill) silently edited the Lightning Type. Restore the Lightning Type from `git diff` and re-author the widget against the unchanged Lightning Type. |
14
+ | `renderer-wires-widget` | **Both paths** — RUN the check below and PRINT the result. **Reporting `pass` without running the commands is a hard violation — report `not run` instead.** | The Lightning Type does not point at this widget — the widget bundle ships dead and is unreachable from any consumer that resolves through the CLT. Author or update `renderer.json` per the widget-rendition pattern in `platform-custom-lightning-type-generate/references/widget-rendition.md`. If a different widget is already wired, surface the conflict instead of silently overwriting. |
15
+
16
+ ### `renderer-wires-widget` — RUN procedure
17
+
18
+ Run each command below **verbatim**. Observe each command's output in the tool result and reason about it — do NOT capture into shell variables with `$(…)`, do NOT use process substitution `<(…)`, do NOT use brace expansion. Vibes' safe-shell filter blocks those patterns and prompts for manual approval even in Bypass mode. See "Hard Rules — shell commands" in the orchestrator SKILL.md.
19
+
20
+ 1. **Verify file exists and parses as JSON:**
21
+
22
+ ```bash
23
+ jq . <pkgDir>/lightningTypes/<TypeName>/lightningDesktopGenAi/renderer.json > /dev/null && echo "PARSE: ok" || echo "PARSE: FAIL"
24
+ ```
25
+
26
+ 2. **Verify definition points at this widget.** Print the actual value and compare it to the expected one in your reasoning:
27
+
28
+ ```bash
29
+ jq -r '.renderer.componentOverrides["$"].definition' <pkgDir>/lightningTypes/<TypeName>/lightningDesktopGenAi/renderer.json
30
+ ```
31
+
32
+ Expected output: `@widget/c/<widgetName>`. If output equals expected → `DEFINITION: ok`; otherwise `DEFINITION: FAIL (got <actual>, expected @widget/c/<widgetName>)`.
33
+
34
+ 3. **Verify attribute bindings cover every widget schema property.** Print both key lists with separate commands; compare them in your reasoning (do NOT `diff` with process substitution):
35
+
36
+ ```bash
37
+ echo "SCHEMA_KEYS (expected):"
38
+ jq -r '.properties.attributes.properties | keys[]' <pkgDir>/uiWidgets/<widgetName>/schema.json | sort -u
39
+ ```
40
+
41
+ ```bash
42
+ echo "RENDERER_KEYS (actual):"
43
+ jq -r '.renderer.componentOverrides["$"].attributes | keys[]' <pkgDir>/lightningTypes/<TypeName>/lightningDesktopGenAi/renderer.json | sort -u
44
+ ```
45
+
46
+ Classify: same set → `ATTRIBUTES: ok`. Keys in `SCHEMA_KEYS` not in `RENDERER_KEYS` → `ATTRIBUTES: FAIL (missing: <list>)`. Keys in `RENDERER_KEYS` not in `SCHEMA_KEYS` → `ATTRIBUTES: FAIL (extra: <list>)`.
47
+
48
+ 4. **Verify each attribute value is a well-formed binding.** Dump the attributes map and inspect each entry in your reasoning:
49
+
50
+ ```bash
51
+ jq '.renderer.componentOverrides["$"].attributes' <pkgDir>/lightningTypes/<TypeName>/lightningDesktopGenAi/renderer.json
52
+ ```
53
+
54
+ For every key `K`, the value must match `{!$attrs.K}` exactly (same key name, no whitespace). All match → `BINDINGS: ok`. Otherwise `BINDINGS: FAIL (<key>: got <value>, expected {!$attrs.<key>})` for each offender.
55
+
56
+ 5. **Result classification:**
57
+ - All checks pass → `pass`
58
+ - File missing or does not parse → `fail (renderer.json missing or invalid JSON)`
59
+ - Definition mismatch → `fail (definition does not point at widget: got <actual>)`
60
+ - Attribute coverage mismatch → `fail (missing bindings: <list>)` or `fail (extra bindings: <list>)`
61
+ - Binding format invalid → `fail (malformed binding for <key>: <actual>)`
62
+
63
+ ---
64
+
65
+ ## Warn — advisory
66
+
67
+ | Name | Gate | Warning meaning |
68
+ |---|---|---|
69
+ | `field-trace` | **Both paths** — RUN the trace below and PRINT both lists explicitly. | See "`field-trace` — RUN procedure" below. **Reporting `pass` without printing the two lists side by side is a hard violation — report `not run` instead.** |
70
+ | `deploy-check` | **`new-lightning-type-with-widget` only** — RUN `sf project deploy --check-only --source-dir <pkgDir>/classes/<ClassName>.cls,<pkgDir>/lightningTypes/<TypeName>` and report the result. | Apex / Custom Lightning Type references are unresolved when validated against the org. Common cause: the FQN in the Custom Lightning Type does not match the actual Apex class. **Reporting `pass` without running this command is a hard violation. Reporting `not run` is only valid if the source files do not exist in the local project — "not yet deployed" is not a valid reason; `--check-only` submits the source as part of the call.** |
71
+
72
+ ### `field-trace` — RUN procedure
73
+
74
+ The gate enforces two things: no invented widget fields (subset rule), and no silent omission of `@AuraEnabled` fields (omission must be in the build plan's `Properties omitted:` and approved at Phase 3).
75
+
76
+ **`APEX_FIELDS` and `WIDGET_PROPS` are labels in the printed output, NOT shell variables. Do NOT assign either with `APEX_FIELDS=$(grep …)` or `WIDGET_PROPS=$(jq …)` — Vibes' safe-shell filter blocks `$(…)` and stalls the eval on manual approval. Run each command bare and reason about the output.**
77
+
78
+ 1. **Resolve the payload class from the Apex class FQN**, then extract `@AuraEnabled` field names from the payload class **and from every inner class referenced by it** — both singular nested objects (e.g. `Address address`) and `List<InnerClass>` collections. Split the FQN on `$`: no `$` → the outer class is the payload; with `$` (e.g. `c__OrderResponses$CreateResult`) → the named inner class is the payload and the outer class's own `@AuraEnabled` fields are NOT part of the trace.
79
+
80
+ Read the outer `.cls` file at `<pkgDir>/classes/<ClassName>.cls`; when the payload is the outer class, grep the whole file; when the payload is an inner class, scope the grep to that inner class's block.
81
+
82
+ ```bash
83
+ # Outer-class payload — print the field names. Do NOT wrap in $().
84
+ echo "APEX_FIELDS:"
85
+ grep -B0 -A2 '@AuraEnabled' <pkgDir>/classes/<ClassName>.cls \
86
+ | grep -oE '(public|global)\s+[A-Za-z0-9_<>,\s]+\s+[a-zA-Z_][a-zA-Z0-9_]*\s*;' \
87
+ | sed -E 's/.*\s([a-zA-Z_][a-zA-Z0-9_]*)\s*;/\1/' \
88
+ | sort -u
89
+ ```
90
+
91
+ For an inner-class payload, read the .cls file, locate the named inner class's block (`class <InnerClass> {…}`), and run the field enumeration scoped to that block only. Identify further inner classes the payload class declares (singular `InnerClass <field>;` and `List<InnerClass> <field>;`) — typically siblings inside the same outer file — and repeat against each. Combine the printed sets in your reasoning under the label `APEX_FIELDS`. If grep returns nothing, fall back to reading the .cls file with the Read tool and listing fields manually — but do NOT skip the comparison.
92
+
93
+ 2. Extract widget schema property keys, expanding nested `lightning__objectType` properties to their inner-field dot paths:
94
+
95
+ ```bash
96
+ echo "WIDGET_PROPS:"
97
+ jq -r '.properties.attributes.properties | keys[]' <pkgDir>/uiWidgets/<widgetName>/schema.json | sort -u
98
+ ```
99
+
100
+ For any property whose `lightning:type` is `lightning__objectType`, also include the dot-notation bindings actually referenced in the widget body (e.g. `address.city`) — you can see these by reading the widget JSON directly with the Read tool. For any property whose `lightning:type` is `lightning__listType`, also include the `{!$item.<innerField>}` references inside the `forEach`. Combine in your reasoning under the label `WIDGET_PROPS`.
101
+
102
+ 3. PRINT both lists in the gate report (not just an assertion) — as plain text you author from the two command outputs above, NOT via a shell expression:
103
+
104
+ ```text
105
+ APEX_FIELDS: cartId, currencyIsoCode, items.itemId, items.qty, itemCount, ...
106
+ WIDGET_PROPS: cartId, currencyIsoCode, itemCount, ...
107
+ INVENTED (widget − apex): <empty>
108
+ OMITTED (apex − widget): items.*
109
+ ```
110
+
111
+ 4. Result classification:
112
+ - `INVENTED` non-empty → **fail** (subset rule violated). Report `fail (invented: <list>)`.
113
+ - `OMITTED` non-empty AND every omitted field appears in the Phase 3 build plan's `Properties omitted:` section → **pass** (auditable omission).
114
+ - `OMITTED` non-empty AND any omitted field is NOT in `Properties omitted:` → **warn** (silent omission). Report `warn (silent omission: <list>)` and surface to the user before the final summary.
115
+ - Both empty → **pass**.
116
+
117
+ ---
118
+
119
+ ## Direction of subset rule
120
+
121
+ The widget `schema.json` (plus the dot-notation paths it binds through nested `lightning__objectType` properties and the `{!$item.X}` references inside `lightning__listType` loops) is a **subset** of the Apex class's `@AuraEnabled` fields (outer class plus every referenced inner class). The orchestrator enforces both directions, asymmetrically:
122
+
123
+ - **No invented fields (hard).** Widget MUST NOT introduce properties or inner-field paths the Apex classes do not expose. A non-empty INVENTED set fails `field-trace`.
124
+ - **No silent omissions (warn).** Widget MAY omit Apex fields, but every omission MUST appear in the Phase 3 build plan's `Properties omitted:` section with a rationale. Omissions not in the plan are silent and warn at `field-trace` (OMITTED list flagged). The leaf skill must surface the proposed omissions to the user before authoring (`platform-widget-generate/references/schema-from-lightning-type.md`). Inner-class fields (whether reached as singular nested objects or via `List<InnerClass>`) are NEVER silently omitted.
125
+
126
+ ---
127
+
128
+ ## Reporting
129
+
130
+ Phase 6 must list each gate's result by name: `pass`, `fail (<reason>)`, `warn (<reason>)`, or `not run`. Do not summarize ("all passed") — list each gate explicitly so the reviewer can spot a silent skip.
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: platform-sharing-owd-configure
3
+ description: "Use when the user wants to retrieve or update Organization-Wide Default (OWD) sharing settings for Salesforce objects. TRIGGER when: user asks to check current OWD settings, view sharing defaults, change default access levels (Private, Public Read Only, Public Read/Write, Controlled by Parent), configure internal or external access for standard or custom objects, mentions org-wide defaults, wants to make records private or restrict who can see records, wants to control default record visibility for an object, or references .settings-meta.xml sharing fields or sharingModel in .object-meta.xml files. DO NOT TRIGGER when: user asks about sharing rules, criteria-based sharing, role hierarchy, or manual sharing — delegate to platform-sharing-rules-generate."
4
+ metadata:
5
+ version: "1.0"
6
+ cliTools:
7
+ - tool: ["sf"]
8
+ semver: ">=2.0.0"
9
+ ---
10
+
11
+ # Managing Org-Wide Defaults
12
+
13
+ Retrieve and update Organization-Wide Default (OWD) sharing settings for standard and custom objects in a Salesforce org. OWDs define the baseline level of access users have to records they do not own.
14
+
15
+ ## Scope
16
+
17
+ - **In scope**: Retrieving current OWD settings, updating internal/external access levels for standard and custom objects
18
+ - **Out of scope**: Sharing rules, role hierarchy configuration, manual sharing, permission sets, criteria-based sharing — delegate to appropriate skills
19
+
20
+ ---
21
+
22
+ ## Clarifying Questions
23
+
24
+ Before proceeding, confirm with the user if not already clear:
25
+
26
+ - Which object(s) do you want to get or update OWD settings for?
27
+ - What access level do you want to set? (Private, Public Read Only, Public Read/Write, Controlled by Parent)
28
+ - Do you need to change both internal and external access, or just one?
29
+
30
+ ---
31
+
32
+ ## Required Inputs
33
+
34
+ Gather or infer before proceeding:
35
+
36
+ - **Target org**: The org alias or username to query/update (use default org if not specified)
37
+ - **Object name(s)**: Standard object API name (e.g., `Account`, `Contact`) or custom object API name (e.g., `Invoice__c`)
38
+ - **Operation**: Get (retrieve current settings) or Update (change access levels)
39
+ - **Access levels** (for update): Internal access and/or external access values
40
+
41
+ Defaults unless specified:
42
+ - Use the default connected org
43
+ - If only one access level is provided, assume it applies to internal access
44
+
45
+ ---
46
+
47
+ ## Workflow
48
+
49
+ All steps are sequential. Do not skip or reorder.
50
+
51
+ ### Phase 1 — Retrieve Current Settings
52
+
53
+ 1. **Query current OWD settings** using the Salesforce CLI Tooling API:
54
+ ```bash
55
+ sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE QualifiedApiName = '<ObjectName>'" --use-tooling-api --target-org <org>
56
+ ```
57
+
58
+ 2. **For retrieving all OWD settings at once:**
59
+ ```bash
60
+ sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE IsCustomizable = true ORDER BY QualifiedApiName" --use-tooling-api --target-org <org>
61
+ ```
62
+
63
+ 3. **Present results clearly** — read `references/access_levels.md` for valid values and display a formatted table to the user.
64
+
65
+ ### Phase 2 — Update Settings (if requested)
66
+
67
+ 4. **Validate the requested access level** — read `references/access_levels.md` to confirm the value is valid for the target object.
68
+
69
+ 5. **Retrieve the object metadata** using the Metadata API (same command for both standard and custom objects):
70
+ ```bash
71
+ sf project retrieve start --metadata CustomObject:<ObjectName> --target-org <org>
72
+ ```
73
+ This retrieves `<ObjectName>.object-meta.xml` containing `<sharingModel>` and `<externalSharingModel>`. See `references/metadata_api_approach.md` for the full procedure.
74
+
75
+ 6. **Modify the sharing settings** — update the `<sharingModel>` (internal access) and/or `<externalSharingModel>` (external access) in the object's `.object-meta.xml`. Read `references/metadata_api_approach.md` for details.
76
+
77
+ 7. **Pre-deploy verification** — before deploying, confirm:
78
+ - [ ] External access is not more permissive than internal access
79
+ - [ ] Objects with Master-Detail relationships use `ControlledByParent`
80
+ - [ ] The requested access level is valid for the target object (see `references/access_levels.md`)
81
+ - [ ] Cross-object constraints are satisfied (see "Cross-Object Constraints" in `references/access_levels.md`)
82
+
83
+ 8. **Deploy the updated settings:**
84
+ ```bash
85
+ sf project deploy start --metadata CustomObject:<ObjectName> --target-org <org>
86
+ ```
87
+
88
+ 9. **Verify the change** by re-running the query from Step 1.
89
+
90
+ ---
91
+
92
+ ## Rules / Constraints
93
+
94
+ | Constraint | Rationale |
95
+ |-----------|-----------|
96
+ | Objects with Master-Detail relationships must use `ControlledByParent` | Platform enforces this — attempting other values fails |
97
+ | External access cannot be more permissive than internal access | Salesforce rejects configurations where external > internal |
98
+ | Some standard objects have fixed OWD (e.g., User, Activity) | Not all objects support OWD changes |
99
+ | Changing OWD to more restrictive triggers sharing recalculation | This can take significant time on large orgs — warn the user |
100
+ | Custom objects default to `Public Read/Write` when created | Users may not realize the default is permissive |
101
+ | Always verify the org connection before querying | Prevents confusing error messages |
102
+
103
+ ---
104
+
105
+ ## Gotchas
106
+
107
+ | Issue | Resolution |
108
+ |-------|------------|
109
+ | `INSUFFICIENT_ACCESS` error when updating | User needs Manage Sharing permission or System Administrator profile |
110
+ | OWD change appears stuck | Sharing recalculation is running — check Setup > Sharing Settings for progress |
111
+ | Custom object not found in query | Use the full API name including `__c` suffix |
112
+ | `ControlledByParent` not available | Object has no Master-Detail relationship — use Private, Public Read Only, or Public Read/Write |
113
+ | External access field not showing | External sharing model only appears when external org-wide defaults are enabled |
114
+ | Query returns no results | Object may not be customizable or API name may be incorrect — verify spelling |
115
+
116
+ ---
117
+
118
+ ## Output Expectations
119
+
120
+ Deliverables:
121
+ - **For get operations**: Formatted table showing object name, internal access level, and external access level
122
+ - **For update operations**: Confirmation of the change with before/after comparison
123
+
124
+ ---
125
+
126
+ ## Cross-Skill Integration
127
+
128
+ | Need | Delegate to |
129
+ |------|-------------|
130
+ | Creating sharing rules after restricting OWD | `platform-sharing-rules-generate` skill |
131
+ | Deploying metadata changes to another org | `platform-metadata-deploy` skill |
132
+
133
+ ---
134
+
135
+ ## Reference File Index
136
+
137
+ | File | When to read |
138
+ |------|-------------|
139
+ | `references/access_levels.md` | When validating or explaining OWD access level values |
140
+ | `references/metadata_api_approach.md` | When using Metadata API to update OWD instead of Tooling API |
141
+ | `examples/get_owd_output.md` | To verify formatted output matches expected structure |
142
+ | `examples/update_owd_output.md` | To verify update confirmation matches expected structure |
@@ -0,0 +1,38 @@
1
+ # Example: Get OWD Output
2
+
3
+ ## Single Object Query
4
+
5
+ **User prompt:** "What are the org-wide defaults for Account?"
6
+
7
+ **Expected output format:**
8
+
9
+ | Object | Internal Access | External Access |
10
+ |--------|----------------|-----------------|
11
+ | Account | Public Read/Write | Private |
12
+
13
+ ## Multiple Objects Query
14
+
15
+ **User prompt:** "Show me all org-wide defaults"
16
+
17
+ **Expected output format:**
18
+
19
+ | Object | Internal Access | External Access |
20
+ |--------|----------------|-----------------|
21
+ | Account | Public Read/Write | Private |
22
+ | Contact | Controlled by Parent | Controlled by Parent |
23
+ | Opportunity | Private | Private |
24
+ | Case | Public Read/Write/Transfer | Private |
25
+ | Lead | Public Read/Write/Transfer | Public Read Only |
26
+ | Campaign | Public Full Access | Private |
27
+ | Invoice__c | Private | Private |
28
+ | Project__c | Public Read Only | Private |
29
+
30
+ ## Custom Object Query
31
+
32
+ **User prompt:** "Get the OWD for Invoice__c"
33
+
34
+ **Expected output format:**
35
+
36
+ | Object | Internal Access | External Access |
37
+ |--------|----------------|-----------------|
38
+ | Invoice__c | Private | Private |
@@ -0,0 +1,44 @@
1
+ # Example: Update OWD Output
2
+
3
+ ## Standard Object Update
4
+
5
+ **User prompt:** "Change Account OWD to Private"
6
+
7
+ **Expected output format:**
8
+
9
+ ### OWD Updated Successfully
10
+
11
+ | Object | Field | Before | After |
12
+ |--------|-------|--------|-------|
13
+ | Account | Internal Access | Public Read/Write | Private |
14
+ | Account | External Access | Private | Private |
15
+
16
+ > **Note:** Sharing recalculation has been triggered. This may take time on large orgs. Check Setup > Sharing Settings to monitor progress.
17
+
18
+ ## Custom Object Update
19
+
20
+ **User prompt:** "Set Invoice__c org-wide default to Public Read Only for internal and Private for external"
21
+
22
+ **Expected output format:**
23
+
24
+ ### OWD Updated Successfully
25
+
26
+ | Object | Field | Before | After |
27
+ |--------|-------|--------|-------|
28
+ | Invoice__c | Internal Access | Private | Public Read Only |
29
+ | Invoice__c | External Access | Private | Private |
30
+
31
+ ## Update with Warning
32
+
33
+ **User prompt:** "Change Opportunity OWD to Public Read/Write"
34
+
35
+ **Expected output format:**
36
+
37
+ ### OWD Updated Successfully
38
+
39
+ | Object | Field | Before | After |
40
+ |--------|-------|--------|-------|
41
+ | Opportunity | Internal Access | Private | Public Read/Write |
42
+ | Opportunity | External Access | Private | Private |
43
+
44
+ > **Warning:** Opening access from Private to Public Read/Write means all users will be able to view and edit all Opportunity records regardless of ownership. Ensure this aligns with your security requirements.
@@ -0,0 +1,49 @@
1
+ # OWD Access Levels Reference
2
+
3
+ ## Valid Access Level Values
4
+
5
+ | API Value | Display Name | Description |
6
+ |-----------|-------------|-------------|
7
+ | `Private` | Private | Only record owner and users above in role hierarchy can view/edit |
8
+ | `Read` | Public Read Only | All users can view records but only owner can edit |
9
+ | `ReadWrite` | Public Read/Write | All users can view and edit all records |
10
+ | `ReadWriteTransfer` | Public Read/Write/Transfer | All users can view, edit, and transfer ownership (Cases, Leads only) |
11
+ | `FullAccess` | Public Full Access | All users have full access including delete (Campaigns only) |
12
+ | `ControlledByParent` | Controlled by Parent | Access determined by parent record's sharing (requires Master-Detail) |
13
+
14
+ ## Object-Specific Restrictions
15
+
16
+ | Object | Allowed Values | Notes |
17
+ |--------|---------------|-------|
18
+ | Account | Private, Read, ReadWrite | Contact and Opportunity OWD tied to Account when ControlledByParent |
19
+ | Contact | Private, Read, ReadWrite, ControlledByParent | ControlledByParent ties to Account |
20
+ | Opportunity | Private, Read, ReadWrite, ControlledByParent | ControlledByParent ties to Account |
21
+ | Case | Private, Read, ReadWrite, ReadWriteTransfer | Transfer is unique to Case |
22
+ | Lead | Private, Read, ReadWrite, ReadWriteTransfer | Transfer is unique to Lead |
23
+ | Campaign | Private, Read, ReadWrite, FullAccess | FullAccess is unique to Campaign |
24
+ | Custom Objects | Private, Read, ReadWrite, ControlledByParent | ControlledByParent requires Master-Detail field |
25
+
26
+ ## Cross-Object Constraints
27
+
28
+ | Constraint | Detail |
29
+ |-----------|--------|
30
+ | Account = Private cascades | Setting Account to Private forces Contact, Case, and Opportunity to Private — all four recalculate together |
31
+ | Contract tied to Account | Contract OWD cannot be set independently; it follows Account's OWD |
32
+ | Pricebook | Only accepts `Use` or `No Access` (`ReadSelect` / `None` in API) — standard access levels do not apply |
33
+ | ControlledByParent cascade | If a child object uses ControlledByParent, changing the parent's OWD implicitly changes the child's effective access |
34
+
35
+ ## Internal vs External Access
36
+
37
+ - **Internal access**: Applies to users within the org (internal users)
38
+ - **External access**: Applies to external users (Community/Experience Cloud users, portal users)
39
+ - External access can never be more permissive than internal access
40
+ - External OWD must be enabled in Setup before external values appear
41
+
42
+ ## Common Transitions
43
+
44
+ | From | To | Impact |
45
+ |------|-----|--------|
46
+ | Public Read/Write → Private | High | Triggers full sharing recalculation; users lose access immediately |
47
+ | Private → Public Read Only | Medium | Grants read access to all; recalculation needed |
48
+ | Private → Public Read/Write | Low | Opens access broadly; fast operation |
49
+ | Any → ControlledByParent | High | Requires Master-Detail relationship; existing sharing rules deleted |
@@ -0,0 +1,69 @@
1
+ # Metadata API Approach for Updating OWD
2
+
3
+ When the Tooling API approach is not suitable or the user prefers a metadata-driven workflow, use the Metadata API to update Organization-Wide Defaults.
4
+
5
+ ## Step-by-Step Procedure
6
+
7
+ ### 1. Create a project directory (if not already in an SFDX project)
8
+
9
+ ```bash
10
+ sf project generate --name owd-update --template empty
11
+ cd owd-update
12
+ ```
13
+
14
+ ### 2. Retrieve the object metadata
15
+
16
+ Both standard and custom objects store their OWD sharing model in `<Object>.object-meta.xml` using the `<sharingModel>` and `<externalSharingModel>` elements.
17
+
18
+ ```bash
19
+ sf project retrieve start --metadata CustomObject:<ObjectName> --target-org <org>
20
+ ```
21
+
22
+ This creates a file at: `force-app/main/default/objects/<ObjectName>/<ObjectName>.object-meta.xml`
23
+
24
+ ### 3. Locate the sharing model entries
25
+
26
+ The object metadata file contains `<sharingModel>` and `<externalSharingModel>` elements:
27
+
28
+ Example for a standard object (Account):
29
+ ```xml
30
+ <?xml version="1.0" encoding="UTF-8"?>
31
+ <CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
32
+ <sharingModel>ReadWrite</sharingModel>
33
+ <externalSharingModel>Private</externalSharingModel>
34
+ </CustomObject>
35
+ ```
36
+
37
+ Example for a custom object (Invoice__c):
38
+ ```xml
39
+ <?xml version="1.0" encoding="UTF-8"?>
40
+ <CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
41
+ <label>Invoice</label>
42
+ <sharingModel>Private</sharingModel>
43
+ <externalSharingModel>Private</externalSharingModel>
44
+ </CustomObject>
45
+ ```
46
+
47
+ ### 4. Modify the sharing model values
48
+
49
+ Update the `<sharingModel>` (internal access) and/or `<externalSharingModel>` (external access) to the desired access level. See `access_levels.md` for valid values per object.
50
+
51
+ ### 5. Deploy the changes
52
+
53
+ ```bash
54
+ sf project deploy start --metadata CustomObject:<ObjectName> --target-org <org>
55
+ ```
56
+
57
+ ### 6. Verify
58
+
59
+ Re-query using the Tooling API to confirm the change took effect:
60
+ ```bash
61
+ sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE QualifiedApiName = '<ObjectName>'" --use-tooling-api --target-org <org>
62
+ ```
63
+
64
+ ## When to Use This Approach
65
+
66
+ - User wants a source-trackable, version-controlled change
67
+ - Multiple OWD changes need to be deployed together
68
+ - Change is part of a larger metadata deployment
69
+ - Tooling API direct update is not permitted by org policies