@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
@@ -1,31 +1,47 @@
1
1
  ---
2
2
  name: platform-sharing-rules-generate
3
- description: "Use this skill when users need to create, generate, or modify Salesforce Sharing Rules metadata. TRIGGER when: users mention sharing rules, record sharing, criteria-based sharing, role-based sharing, guest user sharing, portal user sharing, sharingRules, sharingCriteriaRules, sharingGuestRules, sharingOwnerRules, .sharingRules-meta.xml files, or ask to share records with specific roles or groups. Also trigger when users want to configure record-level access beyond org-wide defaults (OWD), share object records with roles, groups, or guest users, or set up Experience Site guest user record visibility. SKIP when: user needs permission sets or profiles (use platform-permission-set-generate), or needs object-level security rather than record-level sharing (use platform-permission-set-generate)."
3
+ description: "Use this skill when users need to create, edit, delete, or manage Salesforce Sharing Rules metadata. TRIGGER when: users mention sharing rules, record sharing, criteria-based sharing, role-based sharing, guest user sharing, sharingRules, sharingCriteriaRules, sharingGuestRules, sharingOwnerRules, .sharingRules-meta.xml files, or ask to share records with specific roles or groups. Also trigger when users want to modify or remove existing sharing rules, or update sharing rule criteria or access levels. DO NOT TRIGGER when user needs permission sets or profiles (use platform-permission-set-generate), or needs object-level security rather than record-level sharing (use platform-permission-set-generate)."
4
4
  metadata:
5
- version: "1.0"
5
+ version: "1.1"
6
+ minApiVersion: "51.0"
7
+ relatedSkills:
8
+ - "platform-permission-set-generate"
9
+ - "platform-custom-object-generate"
10
+ cliTools:
11
+ - tool: ["sf"]
12
+ semver: ">=2.0.0"
6
13
  ---
7
14
 
8
15
  # Sharing Rules Generator
9
16
 
10
- Generate Salesforce Sharing Rules metadata to control record-level access beyond org-wide defaults. Supports criteria-based rules, role/group-based owner rules, and guest user rules for Experience Sites.
17
+ Create, edit, and delete Salesforce Sharing Rules metadata to control record-level access beyond org-wide defaults. Supports criteria-based rules, role/group-based owner rules, and guest user rules for Experience Sites.
11
18
 
12
19
  ## Scope
13
20
 
14
- - **In scope**: Generating `sharingCriteriaRules`, `sharingOwnerRules`, and `sharingGuestRules` metadata; retrieving existing sharing rules from an org; appending new rules to existing files; configuring rules for Guest and Portal profiles.
21
+ - **In scope**: Creating, editing, and deleting `sharingCriteriaRules`, `sharingOwnerRules`, and `sharingGuestRules` metadata; retrieving existing sharing rules from an org; appending new rules to existing files; modifying rule criteria, access levels, or shared-to targets; removing rules from metadata files; configuring rules for Guest and Portal profiles.
15
22
  - **Out of scope**: Changing org-wide defaults (OWD/sharing model), creating Experience Sites, configuring permission sets or profiles (use `platform-permission-set-generate`), territory-based sharing rules.
16
23
 
17
24
  ---
18
25
 
19
26
  ## Clarifying Questions
20
27
 
21
- Before generating, confirm with the user if not already clear:
28
+ Before proceeding, confirm with the user if not already clear:
22
29
 
30
+ ### For Create operations:
23
31
  - Which object should the sharing rule apply to? (standard or custom object API name)
24
32
  - What type of rule? (criteria-based, role/group-based owner rule, or guest user rule)
25
33
  - Who should records be shared with? (role name, group, portal role, or guest user nickname)
26
34
  - What access level? (Read or Read/Write)
27
35
  - For criteria-based rules: what field conditions should match?
28
36
 
37
+ ### For Edit operations:
38
+ - Which existing rule should be modified? (rule fullName or label)
39
+ - What should change? (access level, shared-to target, criteria, label)
40
+
41
+ ### For Delete operations:
42
+ - Which rule(s) should be removed? (rule fullName or label)
43
+ - Confirm the object the rule belongs to
44
+
29
45
  ---
30
46
 
31
47
  ## Required Inputs
@@ -48,7 +64,7 @@ Defaults unless specified:
48
64
 
49
65
  ## Workflow
50
66
 
51
- All steps are sequential. Do not skip or reorder.
67
+ Steps are sequential within each phase. Phase 3 branches by operation type — execute only the matching branch.
52
68
 
53
69
  ### Phase 1 — Discover
54
70
 
@@ -61,28 +77,61 @@ All steps are sequential. Do not skip or reorder.
61
77
  sf project retrieve start --metadata "SharingRules:<ObjectName>" --target-org <org>
62
78
  ```
63
79
 
64
- ### Phase 2 — Determine Rule Type
80
+ ### Phase 2 — Determine Operation and Rule Type
81
+
82
+ 4. **Identify the operation** — determine whether the user wants to **create**, **edit**, or **delete** a sharing rule.
83
+
84
+ 5. **Select the rule type** based on user intent. Read `references/rule-types.md` for the complete schema of each type and its required elements.
85
+
86
+ 6. **For Account sharing rules**: the `accountSettings` element is required. Default sub-access levels to `None` unless the user specifies otherwise.
87
+
88
+ 7. **For Guest rules**: the `sharedTo` must use `<guestUser>` with the site guest user's community nickname. Never use `<role>` or `<group>` for guest rules.
89
+
90
+ ### Phase 3 — Execute Operation
91
+
92
+ #### For Create:
65
93
 
66
- 4. **Select the rule type** based on user intent. Read `references/rule-types.md` for the complete schema of each type and its required elements.
94
+ 8a. **Construct the XML** following the schema in `references/rule-types.md`. Key structure:
95
+ - One `.sharingRules-meta.xml` file per object
96
+ - All rules for the same object go in the same file
97
+ - If appending to an existing file, add the new rule element inside the existing `<SharingRules>` root
67
98
 
68
- 5. **For Account sharing rules**: the `accountSettings` element is required. Default sub-access levels to `None` unless the user specifies otherwise.
99
+ 8b. **Name the rule** derive `<fullName>` from the intent (PascalCase, no spaces, descriptive). Generate a matching `<label>` in Title Case with spaces.
69
100
 
70
- 6. **For Guest rules**: the `sharedTo` must use `<guestUser>` with the site guest user's community nickname. Never use `<role>` or `<group>` for guest rules.
101
+ #### For Edit:
71
102
 
72
- ### Phase 3Generate
103
+ 8a. **Locate the target rule** find the rule by `<fullName>` or `<label>` in the existing `.sharingRules-meta.xml` file.
73
104
 
74
- 7. **Construct the XML** following the schema in `references/rule-types.md`. Key structure:
75
- - One `.sharingRules-meta.xml` file per object
76
- - All rules for the same object go in the same file
77
- - If appending to an existing file, add the new rule element inside the existing `<SharingRules>` root
105
+ 8b. **Determine modifications** identify which elements to change (e.g., `<accessLevel>`, `<sharedTo>`, `<criteriaItems>`, `<label>`) and what the new values will be. Do not write yet — all disk writes happen in Phase 5 after user confirmation.
78
106
 
79
- 8. **Name the rule** — derive `<fullName>` from the intent (PascalCase, no spaces, descriptive). Generate a matching `<label>` in Title Case with spaces.
107
+ #### For Delete:
80
108
 
81
- 9. **Write the file** to `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml`.
109
+ 8a. **Locate the target rule** find the rule by `<fullName>` or `<label>` in the existing `.sharingRules-meta.xml` file.
82
110
 
83
- ### Phase 4Verify
111
+ 8b. **Count remaining rules** — run: `grep -c '<sharingCriteriaRules>\|<sharingOwnerRules>\|<sharingGuestRules>' <file>` to get the total rule count. If the count is 1 (only the rule being deleted), the file must be removed entirely in Phase 5. Do not write yet all disk writes happen in Phase 5 after user confirmation.
84
112
 
85
- 10. **Run the verification checklist** below before presenting output.
113
+ ### Phase 4 Confirm with User CRITICAL
114
+
115
+ 9. **Present a summary of changes** before writing to disk. You MUST stop and wait for user confirmation. Format the summary as:
116
+
117
+ > **Operation:** Create / Edit / Delete
118
+ > **Object:** `<ObjectName>`
119
+ > **Rule:** `<fullName>` (`<label>`)
120
+ > **Changes:** (describe what will be created/modified/removed)
121
+ >
122
+ > Proceed? (yes / no / edit)
123
+
124
+ **Do NOT write any file changes until the user explicitly confirms.** If the user says "no", abort. If the user says "edit", incorporate their feedback and re-present.
125
+
126
+ ### Phase 5 — Write and Verify
127
+
128
+ 10. **Apply the change** only after user confirmation:
129
+ - **Create**: Write the file to `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml`.
130
+ - **Edit**: Update only the elements identified in step 8b; preserve all other elements exactly as they were.
131
+ - **Delete (rules remain)**: Write the updated file with the target rule removed.
132
+ - **Delete (last rule)**: Remove the file `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml` entirely.
133
+
134
+ 11. **Run the verification checklist** below and consult `examples/test-cases.md` for scenario-specific expected behaviors before presenting output.
86
135
 
87
136
  ---
88
137
 
@@ -109,6 +158,18 @@ All steps are sequential. Do not skip or reorder.
109
158
  - [ ] Does the rule have both `<sharedFrom>` and `<sharedTo>` elements?
110
159
  - [ ] Do both use valid `<role>`, `<roleAndSubordinates>`, or `<group>` targets?
111
160
 
161
+ ### Edit Operation Checks
162
+ - [ ] Was only the intended element modified?
163
+ - [ ] Are all required elements still present after the edit?
164
+ - [ ] Does the modified rule still pass the universal checks above?
165
+ - [ ] Was user confirmation received before writing?
166
+
167
+ ### Delete Operation Checks
168
+ - [ ] Was the correct rule removed (matched by `<fullName>`)?
169
+ - [ ] Is the remaining XML well-formed with proper `<SharingRules>` root?
170
+ - [ ] If no rules remain, was the file removed entirely?
171
+ - [ ] Was user confirmation received before writing?
172
+
112
173
  ### Account-Specific Checks CRITICAL
113
174
  - [ ] If object is Account, is `<accountSettings>` present with all three sub-elements?
114
175
  - [ ] Are `<caseAccessLevel>`, `<contactAccessLevel>`, `<opportunityAccessLevel>` all set?
@@ -126,6 +187,10 @@ All steps are sequential. Do not skip or reorder.
126
187
  | `includeHVUOwnedRecords` is required on guest rules | Missing it causes deployment failure |
127
188
  | Criteria field values must exist as picklist values on the org | Invalid values cause: "Picklist value does not exist" |
128
189
  | Never hardcode file paths — resolve from `sfdx-project.json` | Customer projects use custom package directories |
190
+ | Always confirm before writing changes | Prevents accidental creation, modification, or deletion of sharing rules |
191
+ | Edit must preserve unmodified elements | Changing only `accessLevel` must not alter `criteriaItems` or other fields |
192
+ | Delete must remove the entire rule block | Partial deletion leaves invalid XML and causes deployment failures |
193
+ | Delete last rule removes the file | An empty `<SharingRules>` root with no children is invalid metadata |
129
194
 
130
195
  ---
131
196
 
@@ -139,6 +204,10 @@ All steps are sequential. Do not skip or reorder.
139
204
  | Picklist value mismatch | Query the org for valid values before generating criteria |
140
205
  | Appending duplicates existing rule name | Check existing `<fullName>` values before writing |
141
206
  | Guest user nickname not found | Query: `SELECT CommunityNickname FROM User WHERE UserType='Guest' AND IsActive=true` |
207
+ | Editing a rule that doesn't exist locally | Retrieve from org first before attempting edit |
208
+ | Deleting a rule referenced by other automation | Warn the user about potential downstream impact before confirming |
209
+ | Editing changes rule type (e.g., criteria → owner) | Not supported — delete the old rule and create a new one instead |
210
+ | Delete leaves malformed XML | Ensure proper XML structure after removal; validate the file is well-formed |
142
211
 
143
212
  ---
144
213
 
@@ -163,3 +232,4 @@ Deliverables:
163
232
  | File | When to read |
164
233
  |------|-------------|
165
234
  | `references/rule-types.md` | Phase 2 — before generating any rule, to get the complete XML schema for each rule type |
235
+ | `examples/test-cases.md` | Phase 5, step 11 — during verification, to check expected behavior for each scenario type |
@@ -0,0 +1,381 @@
1
+ # Sharing Rules — Test Cases
2
+
3
+ Structured test scenarios for create, edit, and delete operations. Each test case defines an input, the expected behavior, and the expected output.
4
+
5
+ ---
6
+
7
+ ## Create Operations
8
+
9
+ ### TC-01: Create a criteria-based sharing rule
10
+
11
+ **Input:**
12
+ - Object: `Property__c`
13
+ - Rule type: criteria-based
14
+ - Share with: role `RegionalManager`
15
+ - Access level: Read
16
+ - Criteria: `Status__c` equals `Active`
17
+
18
+ **Expected behavior:**
19
+ 1. Discovers SFDX project path and checks for existing `Property__c.sharingRules-meta.xml`
20
+ 2. Presents confirmation summary to user and waits for approval
21
+ 3. After confirmation, writes the file
22
+
23
+ **Expected output:**
24
+ ```xml
25
+ <?xml version="1.0" encoding="UTF-8"?>
26
+ <SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
27
+ <sharingCriteriaRules>
28
+ <fullName>ShareActivePropertiesWithRegionalManager</fullName>
29
+ <accessLevel>Read</accessLevel>
30
+ <includeRecordsOwnedByAll>true</includeRecordsOwnedByAll>
31
+ <label>Share Active Properties With Regional Manager</label>
32
+ <sharedTo>
33
+ <role>RegionalManager</role>
34
+ </sharedTo>
35
+ <criteriaItems>
36
+ <field>Status__c</field>
37
+ <operation>equals</operation>
38
+ <value>Active</value>
39
+ </criteriaItems>
40
+ </sharingCriteriaRules>
41
+ </SharingRules>
42
+ ```
43
+
44
+ ---
45
+
46
+ ### TC-02: Create a guest user sharing rule
47
+
48
+ **Input:**
49
+ - Object: `Listing__c`
50
+ - Rule type: guest
51
+ - Share with: guest user with CommunityNickname `PropertySiteGuest`
52
+ - Access level: Read
53
+ - Criteria: `Published__c` equals `true`
54
+
55
+ **Expected behavior:**
56
+ 1. Discovers project path and checks for existing file
57
+ 2. Queries org for guest user nickname if not provided
58
+ 3. Presents confirmation summary and waits for approval
59
+ 4. After confirmation, writes file using `<guestUser>` (not `<role>` or `<group>`)
60
+
61
+ **Expected output:**
62
+ ```xml
63
+ <?xml version="1.0" encoding="UTF-8"?>
64
+ <SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
65
+ <sharingGuestRules>
66
+ <fullName>SharePublishedListingsWithSiteGuest</fullName>
67
+ <accessLevel>Read</accessLevel>
68
+ <includeHVUOwnedRecords>false</includeHVUOwnedRecords>
69
+ <label>Share Published Listings With Site Guest</label>
70
+ <sharedTo>
71
+ <guestUser>PropertySiteGuest</guestUser>
72
+ </sharedTo>
73
+ <criteriaItems>
74
+ <field>Published__c</field>
75
+ <operation>equals</operation>
76
+ <value>true</value>
77
+ </criteriaItems>
78
+ </sharingGuestRules>
79
+ </SharingRules>
80
+ ```
81
+
82
+ ---
83
+
84
+ ### TC-03: Create an Account owner-based sharing rule
85
+
86
+ **Input:**
87
+ - Object: `Account`
88
+ - Rule type: owner-based
89
+ - Share from: role `SalesDirector`
90
+ - Share to: role and subordinates `SalesTeam`
91
+ - Access level: Edit
92
+
93
+ **Expected behavior:**
94
+ 1. Discovers project path, checks for existing Account sharing rules
95
+ 2. Includes `<accountSettings>` with all three sub-elements defaulted to `None`
96
+ 3. Presents confirmation summary and waits for approval
97
+ 4. After confirmation, writes the file
98
+
99
+ **Expected output:**
100
+ ```xml
101
+ <?xml version="1.0" encoding="UTF-8"?>
102
+ <SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
103
+ <sharingOwnerRules>
104
+ <fullName>ShareDirectorAccountsWithSalesTeam</fullName>
105
+ <accessLevel>Edit</accessLevel>
106
+ <accountSettings>
107
+ <caseAccessLevel>None</caseAccessLevel>
108
+ <contactAccessLevel>None</contactAccessLevel>
109
+ <opportunityAccessLevel>None</opportunityAccessLevel>
110
+ </accountSettings>
111
+ <label>Share Director Accounts With Sales Team</label>
112
+ <sharedFrom>
113
+ <role>SalesDirector</role>
114
+ </sharedFrom>
115
+ <sharedTo>
116
+ <roleAndSubordinates>SalesTeam</roleAndSubordinates>
117
+ </sharedTo>
118
+ </sharingOwnerRules>
119
+ </SharingRules>
120
+ ```
121
+
122
+ ---
123
+
124
+ ### TC-04: Append a rule to an existing file
125
+
126
+ **Input:**
127
+ - Object: `Property__c` (file already exists with TC-01's rule)
128
+ - Rule type: criteria-based
129
+ - Share with: group `AllAgents`
130
+ - Access level: Edit
131
+ - Criteria: `Price__c` greaterThan `1000000`
132
+
133
+ **Expected behavior:**
134
+ 1. Reads existing file and finds TC-01's rule already present
135
+ 2. Does not duplicate existing rule
136
+ 3. Presents confirmation showing the new rule will be appended
137
+ 4. After confirmation, appends new rule inside existing `<SharingRules>` root
138
+
139
+ **Expected output:** File contains both TC-01's rule AND the new rule within the same `<SharingRules>` element.
140
+
141
+ ---
142
+
143
+ ## Edit Operations
144
+
145
+ ### TC-05: Edit access level of an existing rule
146
+
147
+ **Input:**
148
+ - Object: `Property__c`
149
+ - Target rule: `ShareActivePropertiesWithRegionalManager`
150
+ - Change: access level from `Read` to `Edit`
151
+
152
+ **Expected behavior:**
153
+ 1. Locates the rule by `<fullName>` in the existing file
154
+ 2. Presents confirmation showing current vs. proposed change:
155
+ > **Operation:** Edit
156
+ > **Object:** `Property__c`
157
+ > **Rule:** `ShareActivePropertiesWithRegionalManager` (Share Active Properties With Regional Manager)
158
+ > **Changes:** accessLevel: Read → Edit
159
+ >
160
+ > Proceed? (yes / no / edit)
161
+ 3. Waits for user confirmation
162
+ 4. After confirmation, modifies only `<accessLevel>` — all other elements unchanged
163
+
164
+ **Expected output (changed portion):**
165
+ ```xml
166
+ <accessLevel>Edit</accessLevel>
167
+ ```
168
+ All other elements (`fullName`, `label`, `sharedTo`, `criteriaItems`, `includeRecordsOwnedByAll`) remain identical.
169
+
170
+ ---
171
+
172
+ ### TC-06: Edit shared-to target of an existing rule
173
+
174
+ **Input:**
175
+ - Object: `Property__c`
176
+ - Target rule: `ShareActivePropertiesWithRegionalManager`
177
+ - Change: shared-to from role `RegionalManager` to group `PropertyViewers`
178
+
179
+ **Expected behavior:**
180
+ 1. Locates the rule in the file
181
+ 2. Presents confirmation showing:
182
+ > **Changes:** sharedTo: role `RegionalManager` → group `PropertyViewers`
183
+ 3. Waits for confirmation
184
+ 4. Replaces `<sharedTo>` content only
185
+
186
+ **Expected output (changed portion):**
187
+ ```xml
188
+ <sharedTo>
189
+ <group>PropertyViewers</group>
190
+ </sharedTo>
191
+ ```
192
+
193
+ ---
194
+
195
+ ### TC-07: Edit criteria of an existing rule
196
+
197
+ **Input:**
198
+ - Object: `Property__c`
199
+ - Target rule: `ShareActivePropertiesWithRegionalManager`
200
+ - Change: update criteria from `Status__c equals Active` to `Status__c equals Active` AND `Region__c equals West`
201
+
202
+ **Expected behavior:**
203
+ 1. Locates the rule in the file
204
+ 2. Presents confirmation showing current criteria vs. proposed criteria
205
+ 3. Waits for confirmation
206
+ 4. Replaces `<criteriaItems>` elements
207
+
208
+ **Expected output (changed portion):**
209
+ ```xml
210
+ <criteriaItems>
211
+ <field>Status__c</field>
212
+ <operation>equals</operation>
213
+ <value>Active</value>
214
+ </criteriaItems>
215
+ <criteriaItems>
216
+ <field>Region__c</field>
217
+ <operation>equals</operation>
218
+ <value>West</value>
219
+ </criteriaItems>
220
+ ```
221
+
222
+ ---
223
+
224
+ ### TC-08: Edit attempt on non-existent rule
225
+
226
+ **Input:**
227
+ - Object: `Property__c`
228
+ - Target rule: `NonExistentRule`
229
+ - Change: access level to `Edit`
230
+
231
+ **Expected behavior:**
232
+ 1. Searches for the rule by `<fullName>` in the file
233
+ 2. Rule not found — reports error to user
234
+ 3. Suggests listing available rules in the file and asks user to clarify
235
+
236
+ **Expected output:** No file changes. Error message listing available rule names in the file.
237
+
238
+ ---
239
+
240
+ ## Delete Operations
241
+
242
+ ### TC-09: Delete a single rule (other rules remain)
243
+
244
+ **Input:**
245
+ - Object: `Property__c` (file contains 2 rules)
246
+ - Delete rule: `ShareActivePropertiesWithRegionalManager`
247
+
248
+ **Expected behavior:**
249
+ 1. Locates the rule in the file
250
+ 2. Presents confirmation:
251
+ > **Operation:** Delete
252
+ > **Object:** `Property__c`
253
+ > **Rule:** `ShareActivePropertiesWithRegionalManager` (Share Active Properties With Regional Manager)
254
+ > **Changes:** Remove this criteria-based sharing rule entirely. 1 other rule(s) will remain in the file.
255
+ >
256
+ > Proceed? (yes / no / edit)
257
+ 3. Waits for confirmation
258
+ 4. Removes the entire `<sharingCriteriaRules>` block for that rule
259
+ 5. Other rules in the file remain intact
260
+
261
+ **Expected output:** File retains `<SharingRules>` root and all other rules, with the deleted rule's block completely removed.
262
+
263
+ ---
264
+
265
+ ### TC-10: Delete the last rule in a file
266
+
267
+ **Input:**
268
+ - Object: `Listing__c` (file contains only 1 rule)
269
+ - Delete rule: `SharePublishedListingsWithSiteGuest`
270
+
271
+ **Expected behavior:**
272
+ 1. Locates the rule — confirms it is the only rule in the file
273
+ 2. Presents confirmation warning that the entire file will be removed:
274
+ > **Operation:** Delete
275
+ > **Object:** `Listing__c`
276
+ > **Rule:** `SharePublishedListingsWithSiteGuest` (Share Published Listings With Site Guest)
277
+ > **Changes:** Remove this guest sharing rule. This is the last rule — the entire file `Listing__c.sharingRules-meta.xml` will be deleted.
278
+ >
279
+ > Proceed? (yes / no / edit)
280
+ 3. Waits for confirmation
281
+ 4. Deletes the entire file
282
+
283
+ **Expected output:** File `Listing__c.sharingRules-meta.xml` no longer exists.
284
+
285
+ ---
286
+
287
+ ### TC-11: Delete with user declining confirmation
288
+
289
+ **Input:**
290
+ - Object: `Account`
291
+ - Delete rule: `ShareDirectorAccountsWithSalesTeam`
292
+ - User response to confirmation: "no"
293
+
294
+ **Expected behavior:**
295
+ 1. Locates the rule
296
+ 2. Presents confirmation
297
+ 3. User says "no"
298
+ 4. Aborts — no changes written
299
+
300
+ **Expected output:** No file changes. Acknowledgment that the operation was cancelled.
301
+
302
+ ---
303
+
304
+ ### TC-12: Delete attempt on non-existent rule
305
+
306
+ **Input:**
307
+ - Object: `Property__c`
308
+ - Delete rule: `RuleThatDoesNotExist`
309
+
310
+ **Expected behavior:**
311
+ 1. Searches for the rule by `<fullName>` in the file
312
+ 2. Rule not found — reports error
313
+ 3. Lists available rules and asks user to clarify
314
+
315
+ **Expected output:** No file changes. Error message listing available rule names.
316
+
317
+ ---
318
+
319
+ ## Confirmation Flow Tests
320
+
321
+ ### TC-13: User confirms with "yes"
322
+
323
+ **Input:** Any create/edit/delete operation where user responds "yes" to confirmation.
324
+
325
+ **Expected behavior:** Changes are written to disk as presented in the summary.
326
+
327
+ ---
328
+
329
+ ### TC-14: User responds with "edit" and provides feedback
330
+
331
+ **Input:**
332
+ - Create operation for a criteria rule
333
+ - User responds "edit" to confirmation with: "Change the access level to Edit instead of Read"
334
+
335
+ **Expected behavior:**
336
+ 1. Original summary presented
337
+ 2. User says "edit" with feedback
338
+ 3. Incorporates feedback (changes `accessLevel` to `Edit`)
339
+ 4. Re-presents updated summary
340
+ 5. Waits for new confirmation before writing
341
+
342
+ ---
343
+
344
+ ### TC-15: User declines with "no"
345
+
346
+ **Input:** Any create/edit/delete operation where user responds "no" to confirmation.
347
+
348
+ **Expected behavior:** No file changes. Operation aborted with acknowledgment.
349
+
350
+ ---
351
+
352
+ ## Edge Cases
353
+
354
+ ### TC-16: Edit that would change rule type
355
+
356
+ **Input:**
357
+ - Object: `Property__c`
358
+ - Target rule: `ShareActivePropertiesWithRegionalManager` (criteria rule)
359
+ - Change: convert to owner-based rule
360
+
361
+ **Expected behavior:**
362
+ 1. Detects that the change would alter the rule type
363
+ 2. Informs user this is not supported as an edit
364
+ 3. Suggests: delete the existing rule and create a new one with the desired type
365
+
366
+ **Expected output:** No file changes. Guidance to user about delete + create workflow.
367
+
368
+ ---
369
+
370
+ ### TC-17: Create rule with duplicate fullName
371
+
372
+ **Input:**
373
+ - Object: `Property__c` (file already contains rule `ShareActivePropertiesWithRegionalManager`)
374
+ - Create a new rule also named `ShareActivePropertiesWithRegionalManager`
375
+
376
+ **Expected behavior:**
377
+ 1. Reads existing file, finds duplicate `<fullName>`
378
+ 2. Informs user of the conflict
379
+ 3. Suggests an alternative name or asks user to choose
380
+
381
+ **Expected output:** No file changes until conflict is resolved.