@salesforce/afv-skills 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -5
- package/skills/creating-webapp/SKILL.md +0 -2
- package/skills/generating-apex/SKILL.md +253 -0
- package/skills/generating-apex/assets/abstract.cls +128 -0
- package/skills/generating-apex/assets/batch.cls +125 -0
- package/skills/generating-apex/assets/domain.cls +102 -0
- package/skills/generating-apex/assets/dto.cls +108 -0
- package/skills/generating-apex/assets/exception.cls +51 -0
- package/skills/generating-apex/assets/interface.cls +25 -0
- package/skills/generating-apex/assets/queueable.cls +92 -0
- package/skills/generating-apex/assets/schedulable.cls +75 -0
- package/skills/generating-apex/assets/selector.cls +92 -0
- package/skills/generating-apex/assets/service.cls +69 -0
- package/skills/generating-apex/assets/utility.cls +97 -0
- package/skills/generating-apex/references/AccountDeduplicationBatch.cls +148 -0
- package/skills/generating-apex/references/AccountSelector.cls +193 -0
- package/skills/generating-apex/references/AccountService.cls +201 -0
- package/skills/generating-apex-test/SKILL.md +108 -0
- package/skills/generating-apex-test/assets/test-class-template.cls +124 -0
- package/skills/generating-apex-test/assets/test-data-factory-template.cls +112 -0
- package/skills/generating-apex-test/references/assertion-patterns.md +165 -0
- package/skills/generating-apex-test/references/async-testing.md +276 -0
- package/skills/generating-apex-test/references/mocking-patterns.md +219 -0
- package/skills/generating-apex-test/references/test-data-factory.md +176 -0
- package/skills/generating-experience-lwr-site/SKILL.md +42 -16
- package/skills/generating-experience-lwr-site/docs/configure-content-brandingSet.md +17 -7
- package/skills/generating-experience-lwr-site/docs/configure-content-themeLayout.md +2 -1
- package/skills/generating-experience-lwr-site/docs/configure-content-view.md +3 -3
- package/skills/generating-experience-react-site/SKILL.md +11 -0
- package/skills/generating-flexipage/SKILL.md +39 -57
- package/skills/searching-media/SKILL.md +342 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Mocking Patterns
|
|
2
|
+
|
|
3
|
+
## HTTP Callout Mocking
|
|
4
|
+
|
|
5
|
+
Apex doesn't allow real HTTP callouts in tests. Use `HttpCalloutMock` interface.
|
|
6
|
+
|
|
7
|
+
### Basic Mock Implementation
|
|
8
|
+
|
|
9
|
+
```apex
|
|
10
|
+
@isTest
|
|
11
|
+
public class MockHttpResponse implements HttpCalloutMock {
|
|
12
|
+
|
|
13
|
+
private Integer statusCode;
|
|
14
|
+
private String body;
|
|
15
|
+
|
|
16
|
+
public MockHttpResponse(Integer statusCode, String body) {
|
|
17
|
+
this.statusCode = statusCode;
|
|
18
|
+
this.body = body;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public HTTPResponse respond(HTTPRequest req) {
|
|
22
|
+
HttpResponse res = new HttpResponse();
|
|
23
|
+
res.setStatusCode(statusCode);
|
|
24
|
+
res.setBody(body);
|
|
25
|
+
res.setHeader('Content-Type', 'application/json');
|
|
26
|
+
return res;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Using the Mock
|
|
32
|
+
|
|
33
|
+
```apex
|
|
34
|
+
@isTest
|
|
35
|
+
static void shouldProcessApiResponse_WhenCalloutSucceeds() {
|
|
36
|
+
// Given
|
|
37
|
+
String mockResponse = '{"status": "success", "data": [{"id": "123"}]}';
|
|
38
|
+
Test.setMock(HttpCalloutMock.class, new MockHttpResponse(200, mockResponse));
|
|
39
|
+
|
|
40
|
+
// When
|
|
41
|
+
Test.startTest();
|
|
42
|
+
List<ExternalRecord> results = MyIntegrationService.fetchRecords();
|
|
43
|
+
Test.stopTest();
|
|
44
|
+
|
|
45
|
+
// Then
|
|
46
|
+
System.assertEquals(1, results.size(), 'Should parse one record from response');
|
|
47
|
+
System.assertEquals('123', results[0].externalId, 'Should extract correct ID');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@isTest
|
|
51
|
+
static void shouldHandleError_WhenCalloutFails() {
|
|
52
|
+
// Given
|
|
53
|
+
String errorResponse = '{"error": "Unauthorized"}';
|
|
54
|
+
Test.setMock(HttpCalloutMock.class, new MockHttpResponse(401, errorResponse));
|
|
55
|
+
|
|
56
|
+
// When
|
|
57
|
+
Test.startTest();
|
|
58
|
+
CalloutResult result = MyIntegrationService.fetchRecords();
|
|
59
|
+
Test.stopTest();
|
|
60
|
+
|
|
61
|
+
// Then
|
|
62
|
+
System.assertEquals(false, result.isSuccess, 'Should indicate failure');
|
|
63
|
+
System.assert(result.errorMessage.contains('Unauthorized'), 'Should capture error');
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Multi-Request Mock
|
|
68
|
+
|
|
69
|
+
For services making multiple callouts:
|
|
70
|
+
|
|
71
|
+
```apex
|
|
72
|
+
@isTest
|
|
73
|
+
public class MultiRequestMock implements HttpCalloutMock {
|
|
74
|
+
|
|
75
|
+
private Map<String, HttpResponse> endpointResponses;
|
|
76
|
+
|
|
77
|
+
public MultiRequestMock(Map<String, HttpResponse> responses) {
|
|
78
|
+
this.endpointResponses = responses;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public HTTPResponse respond(HTTPRequest req) {
|
|
82
|
+
String endpoint = req.getEndpoint();
|
|
83
|
+
|
|
84
|
+
for (String key : endpointResponses.keySet()) {
|
|
85
|
+
if (endpoint.contains(key)) {
|
|
86
|
+
return endpointResponses.get(key);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Default 404 if no match
|
|
91
|
+
HttpResponse res = new HttpResponse();
|
|
92
|
+
res.setStatusCode(404);
|
|
93
|
+
res.setBody('{"error": "Not found"}');
|
|
94
|
+
return res;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Usage:
|
|
99
|
+
Map<String, HttpResponse> mocks = new Map<String, HttpResponse>();
|
|
100
|
+
|
|
101
|
+
HttpResponse authResponse = new HttpResponse();
|
|
102
|
+
authResponse.setStatusCode(200);
|
|
103
|
+
authResponse.setBody('{"token": "abc123"}');
|
|
104
|
+
mocks.put('/oauth/token', authResponse);
|
|
105
|
+
|
|
106
|
+
HttpResponse dataResponse = new HttpResponse();
|
|
107
|
+
dataResponse.setStatusCode(200);
|
|
108
|
+
dataResponse.setBody('{"records": []}');
|
|
109
|
+
mocks.put('/api/records', dataResponse);
|
|
110
|
+
|
|
111
|
+
Test.setMock(HttpCalloutMock.class, new MultiRequestMock(mocks));
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## StaticResourceCalloutMock
|
|
115
|
+
|
|
116
|
+
For complex response bodies, store JSON in Static Resources:
|
|
117
|
+
|
|
118
|
+
```apex
|
|
119
|
+
@isTest
|
|
120
|
+
static void shouldParseComplexResponse() {
|
|
121
|
+
StaticResourceCalloutMock mock = new StaticResourceCalloutMock();
|
|
122
|
+
mock.setStaticResource('TestApiResponse'); // Static Resource name
|
|
123
|
+
mock.setStatusCode(200);
|
|
124
|
+
mock.setHeader('Content-Type', 'application/json');
|
|
125
|
+
|
|
126
|
+
Test.setMock(HttpCalloutMock.class, mock);
|
|
127
|
+
|
|
128
|
+
Test.startTest();
|
|
129
|
+
Result r = MyService.callExternalApi();
|
|
130
|
+
Test.stopTest();
|
|
131
|
+
|
|
132
|
+
System.assertNotEquals(null, r, 'Should parse response');
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Stub API (Enterprise Pattern)
|
|
137
|
+
|
|
138
|
+
For mocking Apex class dependencies using `System.StubProvider`:
|
|
139
|
+
|
|
140
|
+
```apex
|
|
141
|
+
@isTest
|
|
142
|
+
public class MyServiceMock implements System.StubProvider {
|
|
143
|
+
|
|
144
|
+
public Object handleMethodCall(
|
|
145
|
+
Object stubbedObject,
|
|
146
|
+
String stubbedMethodName,
|
|
147
|
+
Type returnType,
|
|
148
|
+
List<Type> paramTypes,
|
|
149
|
+
List<String> paramNames,
|
|
150
|
+
List<Object> args
|
|
151
|
+
) {
|
|
152
|
+
if (stubbedMethodName == 'getAccountData') {
|
|
153
|
+
return new AccountData('Mock Account', 'Active');
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Usage in test:
|
|
160
|
+
@isTest
|
|
161
|
+
static void shouldUseAccountData() {
|
|
162
|
+
MyServiceMock mockProvider = new MyServiceMock();
|
|
163
|
+
IMyService mockService = (IMyService)Test.createStub(IMyService.class, mockProvider);
|
|
164
|
+
|
|
165
|
+
// Inject mock into class under test
|
|
166
|
+
MyController controller = new MyController(mockService);
|
|
167
|
+
|
|
168
|
+
Test.startTest();
|
|
169
|
+
String result = controller.displayAccountInfo();
|
|
170
|
+
Test.stopTest();
|
|
171
|
+
|
|
172
|
+
System.assert(result.contains('Mock Account'), 'Should use mocked data');
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Email Mocking
|
|
177
|
+
|
|
178
|
+
Apex sends real emails by default. Use limits to verify:
|
|
179
|
+
|
|
180
|
+
```apex
|
|
181
|
+
@isTest
|
|
182
|
+
static void shouldSendEmail_WhenTriggered() {
|
|
183
|
+
Integer emailsBefore = Limits.getEmailInvocations();
|
|
184
|
+
|
|
185
|
+
Test.startTest();
|
|
186
|
+
MyService.sendNotification(testContact);
|
|
187
|
+
Test.stopTest();
|
|
188
|
+
|
|
189
|
+
// Verify email was queued (not actually sent in tests)
|
|
190
|
+
System.assertEquals(
|
|
191
|
+
emailsBefore + 1,
|
|
192
|
+
Limits.getEmailInvocations(),
|
|
193
|
+
'One email should be sent'
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Platform Event Testing
|
|
199
|
+
|
|
200
|
+
```apex
|
|
201
|
+
@isTest
|
|
202
|
+
static void shouldPublishEvent_WhenRecordCreated() {
|
|
203
|
+
Test.startTest();
|
|
204
|
+
|
|
205
|
+
// Enable event delivery in test context
|
|
206
|
+
Test.enableChangeDataCapture();
|
|
207
|
+
|
|
208
|
+
Account acc = TestDataFactory.createAccount(true);
|
|
209
|
+
|
|
210
|
+
// Deliver events
|
|
211
|
+
Test.getEventBus().deliver();
|
|
212
|
+
|
|
213
|
+
Test.stopTest();
|
|
214
|
+
|
|
215
|
+
// Query platform event trigger results
|
|
216
|
+
List<EventLog__c> logs = [SELECT Id FROM EventLog__c WHERE AccountId__c = :acc.Id];
|
|
217
|
+
System.assertEquals(1, logs.size(), 'Event handler should create log record');
|
|
218
|
+
}
|
|
219
|
+
```
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# TestDataFactory Patterns
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
TestDataFactory is a centralized utility class for creating test records with sensible defaults. It ensures consistent test data across all test classes and reduces duplication.
|
|
6
|
+
|
|
7
|
+
## Base Template
|
|
8
|
+
|
|
9
|
+
```apex
|
|
10
|
+
@isTest
|
|
11
|
+
public class TestDataFactory {
|
|
12
|
+
|
|
13
|
+
// ============ ACCOUNTS ============
|
|
14
|
+
|
|
15
|
+
public static List<Account> createAccounts(Integer count, Boolean doInsert) {
|
|
16
|
+
List<Account> accounts = new List<Account>();
|
|
17
|
+
for (Integer i = 0; i < count; i++) {
|
|
18
|
+
accounts.add(new Account(
|
|
19
|
+
Name = 'Test Account ' + i,
|
|
20
|
+
BillingStreet = '123 Test St',
|
|
21
|
+
BillingCity = 'San Francisco',
|
|
22
|
+
BillingState = 'CA',
|
|
23
|
+
BillingPostalCode = '94105',
|
|
24
|
+
BillingCountry = 'USA',
|
|
25
|
+
Industry = 'Technology',
|
|
26
|
+
Type = 'Customer'
|
|
27
|
+
));
|
|
28
|
+
}
|
|
29
|
+
if (doInsert) insert accounts;
|
|
30
|
+
return accounts;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public static Account createAccount(Boolean doInsert) {
|
|
34
|
+
return createAccounts(1, doInsert)[0];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ============ CONTACTS ============
|
|
38
|
+
|
|
39
|
+
public static List<Contact> createContacts(List<Account> accounts, Integer countPerAccount, Boolean doInsert) {
|
|
40
|
+
List<Contact> contacts = new List<Contact>();
|
|
41
|
+
Integer index = 0;
|
|
42
|
+
for (Account acc : accounts) {
|
|
43
|
+
for (Integer i = 0; i < countPerAccount; i++) {
|
|
44
|
+
contacts.add(new Contact(
|
|
45
|
+
FirstName = 'Test',
|
|
46
|
+
LastName = 'Contact ' + index,
|
|
47
|
+
Email = 'test.contact' + index + '@example.com',
|
|
48
|
+
Phone = '555-000-' + String.valueOf(index).leftPad(4, '0'),
|
|
49
|
+
AccountId = acc.Id
|
|
50
|
+
));
|
|
51
|
+
index++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (doInsert) insert contacts;
|
|
55
|
+
return contacts;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ============ OPPORTUNITIES ============
|
|
59
|
+
|
|
60
|
+
public static List<Opportunity> createOpportunities(List<Account> accounts, Integer countPerAccount, Boolean doInsert) {
|
|
61
|
+
List<Opportunity> opps = new List<Opportunity>();
|
|
62
|
+
Integer index = 0;
|
|
63
|
+
for (Account acc : accounts) {
|
|
64
|
+
for (Integer i = 0; i < countPerAccount; i++) {
|
|
65
|
+
opps.add(new Opportunity(
|
|
66
|
+
Name = 'Test Opportunity ' + index,
|
|
67
|
+
AccountId = acc.Id,
|
|
68
|
+
StageName = 'Prospecting',
|
|
69
|
+
CloseDate = Date.today().addDays(30),
|
|
70
|
+
Amount = 10000 + (index * 1000)
|
|
71
|
+
));
|
|
72
|
+
index++;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (doInsert) insert opps;
|
|
76
|
+
return opps;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ============ USERS ============
|
|
80
|
+
|
|
81
|
+
public static User createUser(String profileName, Boolean doInsert) {
|
|
82
|
+
Profile p = [SELECT Id FROM Profile WHERE Name = :profileName LIMIT 1];
|
|
83
|
+
String uniqueKey = String.valueOf(DateTime.now().getTime());
|
|
84
|
+
|
|
85
|
+
User u = new User(
|
|
86
|
+
FirstName = 'Test',
|
|
87
|
+
LastName = 'User ' + uniqueKey,
|
|
88
|
+
Email = 'testuser' + uniqueKey + '@example.com',
|
|
89
|
+
Username = 'testuser' + uniqueKey + '@example.com.test',
|
|
90
|
+
Alias = 'tuser',
|
|
91
|
+
TimeZoneSidKey = 'America/Los_Angeles',
|
|
92
|
+
LocaleSidKey = 'en_US',
|
|
93
|
+
EmailEncodingKey = 'UTF-8',
|
|
94
|
+
LanguageLocaleKey = 'en_US',
|
|
95
|
+
ProfileId = p.Id
|
|
96
|
+
);
|
|
97
|
+
if (doInsert) insert u;
|
|
98
|
+
return u;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ============ CUSTOM OBJECTS ============
|
|
102
|
+
|
|
103
|
+
// Add methods for your custom objects following the same pattern:
|
|
104
|
+
// public static List<MyObject__c> createMyObjects(Integer count, Boolean doInsert) { ... }
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Field Override Pattern
|
|
109
|
+
|
|
110
|
+
Allow callers to override default values:
|
|
111
|
+
|
|
112
|
+
```apex
|
|
113
|
+
public static Account createAccount(Map<String, Object> fieldOverrides, Boolean doInsert) {
|
|
114
|
+
Account acc = new Account(
|
|
115
|
+
Name = 'Test Account',
|
|
116
|
+
Industry = 'Technology'
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// Apply overrides
|
|
120
|
+
for (String fieldName : fieldOverrides.keySet()) {
|
|
121
|
+
acc.put(fieldName, fieldOverrides.get(fieldName));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (doInsert) insert acc;
|
|
125
|
+
return acc;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Usage:
|
|
129
|
+
Account acc = TestDataFactory.createAccount(new Map<String, Object>{
|
|
130
|
+
'Name' => 'Custom Name',
|
|
131
|
+
'Industry' => 'Healthcare'
|
|
132
|
+
}, true);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Handling Required Fields and Validation Rules
|
|
136
|
+
|
|
137
|
+
```apex
|
|
138
|
+
public static Account createAccountWithRequiredFields(Boolean doInsert) {
|
|
139
|
+
Account acc = new Account(
|
|
140
|
+
Name = 'Test Account',
|
|
141
|
+
// Required custom fields
|
|
142
|
+
External_Id__c = 'EXT-' + String.valueOf(DateTime.now().getTime()),
|
|
143
|
+
// Fields required by validation rules
|
|
144
|
+
Phone = '555-123-4567',
|
|
145
|
+
Website = 'https://example.com'
|
|
146
|
+
);
|
|
147
|
+
if (doInsert) insert acc;
|
|
148
|
+
return acc;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Record Type Support
|
|
153
|
+
|
|
154
|
+
```apex
|
|
155
|
+
public static Account createAccountByRecordType(String recordTypeName, Boolean doInsert) {
|
|
156
|
+
Id recordTypeId = Schema.SObjectType.Account
|
|
157
|
+
.getRecordTypeInfosByDeveloperName()
|
|
158
|
+
.get(recordTypeName)
|
|
159
|
+
.getRecordTypeId();
|
|
160
|
+
|
|
161
|
+
Account acc = new Account(
|
|
162
|
+
Name = 'Test Account',
|
|
163
|
+
RecordTypeId = recordTypeId
|
|
164
|
+
);
|
|
165
|
+
if (doInsert) insert acc;
|
|
166
|
+
return acc;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Best Practices
|
|
171
|
+
|
|
172
|
+
1. **Always include doInsert parameter** - Allows flexibility for tests that need to modify records before insert
|
|
173
|
+
2. **Use unique identifiers** - Include index or timestamp in Name/Email fields to avoid duplicates
|
|
174
|
+
3. **Set all required fields** - Include all fields required by validation rules
|
|
175
|
+
4. **Return the created records** - Enables chaining and further manipulation
|
|
176
|
+
5. **Create bulk methods first** - Single record methods should call bulk methods with count=1
|
|
@@ -7,6 +7,11 @@ description: "Creates, modifies, or manages Salesforce Experience Cloud LWR site
|
|
|
7
7
|
|
|
8
8
|
Build and configure Salesforce Experience Cloud Lightning Web Runtime (LWR) sites via metadata (DigitalExperienceConfig, DigitalExperienceBundle, Network, CustomSite, CMS contents).
|
|
9
9
|
|
|
10
|
+
## IMPORTANT!!
|
|
11
|
+
|
|
12
|
+
Right after loading this skill, you MUST copy the selected workflows/steps to your plan as a TODO checklist and work on each of the item carefully to ensure correctness.
|
|
13
|
+
You MUST load the relevant reference docs even though they may live outside of user's project folder.
|
|
14
|
+
|
|
10
15
|
## Table of Contents
|
|
11
16
|
|
|
12
17
|
- When to Use
|
|
@@ -33,8 +38,8 @@ When working with Experience LWR sites:
|
|
|
33
38
|
## Critical Rules
|
|
34
39
|
|
|
35
40
|
1. Before using any MCP tool, make sure they're actually available. If a tool is missing for the current task, let the user know and pause the current workflow.
|
|
36
|
-
2. **ALWAYS** load the relevant reference docs before doing anything.
|
|
37
|
-
3. **ALWAYS** strictly follow workflows in [Common Workflows](#common-workflows) that match user's requirements. The instructions there should override any conflicting global rules and should have the highest priority over your existing knowledge.
|
|
41
|
+
2. **MUST ALWAYS** load the relevant reference docs before doing anything.
|
|
42
|
+
3. **MUST ALWAYS** strictly follow workflows in [Common Workflows](#common-workflows) that match user's requirements. The instructions there should override any conflicting global rules and should have the highest priority over your existing knowledge.
|
|
38
43
|
4. Flexipage is abstracted away for newer LWR sites with DigitalExperienceBundle, so **NEVER** use any Flexipage-related MCP tool or skills to handle LWR sites' contents.
|
|
39
44
|
|
|
40
45
|
## Core Site Properties
|
|
@@ -71,7 +76,7 @@ Before doing anything else, note down the following properties from the local pr
|
|
|
71
76
|
| `sfdc_cms__appPage` | Application page container that groups routes and views | Required; defines the app shell |
|
|
72
77
|
| `sfdc_cms__route` | URL routing definition mapping paths to views | Create one for each page/URL path |
|
|
73
78
|
| `sfdc_cms__view` | Page layout and component structure | Create one for each route; defines page content. Also use to edit existing views (e.g., adding/removing components on a specific page) |
|
|
74
|
-
| `sfdc_cms__brandingSet` | Brand colors, fonts, and styling tokens | Required; defines site-wide styling |
|
|
79
|
+
| `sfdc_cms__brandingSet` | Brand colors, fonts, and styling tokens | Required; defines site-wide styling. Use to create or edit existing branding sets |
|
|
75
80
|
| `sfdc_cms__languageSettings` | Language and localization configuration | Required; defines supported languages |
|
|
76
81
|
| `sfdc_cms__mobilePublisherConfig` | Mobile app publishing settings | Required for mobile app deployment |
|
|
77
82
|
| `sfdc_cms__theme` | Theme definition referencing layouts and branding | Required; one per site |
|
|
@@ -79,9 +84,14 @@ Before doing anything else, note down the following properties from the local pr
|
|
|
79
84
|
|
|
80
85
|
**Important:** Creating any new pages require BOTH `sfdc_cms__route` AND `sfdc_cms__view`.
|
|
81
86
|
|
|
87
|
+
#### Object Pages
|
|
88
|
+
|
|
89
|
+
Object Pages are dedicated pages used to display and manage record-level data for a specific Salesforce entity/object. For example, an custom object "Car" should have "Car_Detail", "Car_List", and "Car_Related_list" views.
|
|
90
|
+
|
|
82
91
|
## References
|
|
83
92
|
|
|
84
93
|
Reference docs within the skill directory. Note that these are **local** and not MCP.
|
|
94
|
+
Before doing anything, you **MUST ALWAYS** load them first if they match user intent.
|
|
85
95
|
|
|
86
96
|
- [bootstrap-template-byo-lwr.md](docs/bootstrap-template-byo-lwr.md) - Site creation, template defaults
|
|
87
97
|
- [configure-content-route.md](docs/configure-content-route.md) - Route creation (custom/object pages)
|
|
@@ -111,32 +121,46 @@ Reference docs within the skill directory. Note that these are **local** and not
|
|
|
111
121
|
|
|
112
122
|
**Steps** (Follow the steps sequentially. Do not skip any step before proceeding):
|
|
113
123
|
|
|
114
|
-
- [ ]
|
|
115
|
-
- [ ]
|
|
116
|
-
- [ ]
|
|
117
|
-
- [ ] Follow the instructions of the above docs strictly to accomplish user's goal
|
|
124
|
+
- [ ] MUST read [configure-content-route.md](docs/configure-content-route.md)
|
|
125
|
+
- [ ] MUST read [configure-content-view.md](docs/configure-content-view.md)
|
|
126
|
+
- [ ] MUST read [handle-component-and-region-ids.md](docs/handle-component-and-region-ids.md)
|
|
118
127
|
|
|
119
128
|
### Adding UI Components to Pages
|
|
120
129
|
|
|
121
130
|
**Steps** (Follow the steps sequentially. Do not skip any step before proceeding):
|
|
122
131
|
|
|
123
|
-
- [ ]
|
|
124
|
-
- [ ]
|
|
125
|
-
- [ ]
|
|
132
|
+
- [ ] MUST read [handle-ui-components.md](docs/handle-ui-components.md) to add LWCs to LWR sites.
|
|
133
|
+
- [ ] MUST read [handle-component-and-region-ids.md](docs/handle-component-and-region-ids.md) to handle id generation
|
|
134
|
+
- [ ] MUST read [configure-content-themeLayout.md](docs/configure-content-themeLayout.md) if a component has one of the following requirements:
|
|
126
135
|
- needs to be "sticky" and persistent across pages
|
|
127
136
|
- is used as a theme layout
|
|
128
137
|
|
|
138
|
+
### Creating Page Layouts / Container Components
|
|
139
|
+
|
|
140
|
+
**Steps** (Follow the steps sequentially. Do not skip any step before proceeding):
|
|
141
|
+
|
|
142
|
+
- [ ] MUST read [handle-ui-components.md](docs/handle-ui-components.md)
|
|
143
|
+
|
|
129
144
|
### Creating Theme Layouts
|
|
130
145
|
|
|
131
146
|
**Steps** (Follow the steps sequentially. Do not skip any step before proceeding):
|
|
132
147
|
|
|
133
|
-
- [ ]
|
|
148
|
+
- [ ] Check with user whether this new theme layout reuses an existing theme layout component or requires a new one.
|
|
149
|
+
- [ ] MUST read [handle-ui-components.md](docs/handle-ui-components.md) if creating a new theme layout component.
|
|
150
|
+
- [ ] MUST read [configure-content-themeLayout.md](docs/configure-content-themeLayout.md).
|
|
151
|
+
- [ ] MUST read [configure-content-view.md](docs/configure-content-view.md) if need to apply theme layout to pages
|
|
152
|
+
|
|
153
|
+
### Applying/Setting Theme Layouts
|
|
154
|
+
|
|
155
|
+
**Steps** (Follow the steps sequentially. Do not skip any step before proceeding):
|
|
156
|
+
|
|
157
|
+
- [ ] MUST read [configure-content-view.md](docs/configure-content-view.md)
|
|
134
158
|
|
|
135
159
|
### Configuring Branding
|
|
136
160
|
|
|
137
161
|
**Steps** (Follow the steps sequentially. Do not skip any step before proceeding):
|
|
138
162
|
|
|
139
|
-
- [ ]
|
|
163
|
+
- [ ] MUST read [configure-content-brandingSet.md](docs/configure-content-brandingSet.md) to configure background colors, foreground colors, button colors, and other branding colors that affect all pages.
|
|
140
164
|
|
|
141
165
|
### CUD Operations on DigitalExperience Contents
|
|
142
166
|
|
|
@@ -145,8 +169,8 @@ Reference docs within the skill directory. Note that these are **local** and not
|
|
|
145
169
|
**Steps** (Follow the steps sequentially. Do not skip any step before proceeding):
|
|
146
170
|
|
|
147
171
|
- [ ] Determine what content types the user wants to modify
|
|
148
|
-
- [ ]
|
|
149
|
-
- [ ]
|
|
172
|
+
- [ ] MUST read the reference doc related to the target content types if the doc exists. e.g., if modifying `sfdc_cms__route`, load [configure-content-route.md](docs/configure-content-route.md).
|
|
173
|
+
- [ ] MUST read [handle-component-and-region-ids.md](docs/handle-component-and-region-ids.md) if creating or modifying view or theme layout
|
|
150
174
|
- [ ] **Always** Call `execute_metadata_action` to get the schema and examples for that content type **after** loading the corresponding reference docs.
|
|
151
175
|
- **Call once per content type per user request**: If you're creating/modifying multiple items of the same content type (e.g., creating 3 routes), you only need to call `execute_metadata_action` ONCE for that content type. Reuse the schema and examples for all items of that type within the same user request.
|
|
152
176
|
- For each unique content type you need to work with, **always** call `execute_metadata_action` using the following:
|
|
@@ -162,9 +186,11 @@ Reference docs within the skill directory. Note that these are **local** and not
|
|
|
162
186
|
}
|
|
163
187
|
```
|
|
164
188
|
|
|
165
|
-
### Retrieving Site URLs After Deployment
|
|
189
|
+
### Retrieving Site Preview and Builder URLs After Deployment
|
|
190
|
+
|
|
191
|
+
**Use when** user requests to preview a site, access a builder site, or after successfully deploying a site.
|
|
166
192
|
|
|
167
|
-
|
|
193
|
+
Use the `execute_metadata_action` MCP tool to get the preview and builder URLs:
|
|
168
194
|
|
|
169
195
|
```json
|
|
170
196
|
{
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
- Core Principles
|
|
8
8
|
- Generation Guidelines
|
|
9
|
+
- Editing Existing Branding Sets
|
|
9
10
|
- Branding Property Patterns
|
|
10
11
|
|
|
11
12
|
## Core Principles
|
|
@@ -58,7 +59,11 @@ The `content.json` file must contain:
|
|
|
58
59
|
- `title`: **Required**. Human-readable display title (e.g., Branding Set).
|
|
59
60
|
- Maximum length is **100 characters**.
|
|
60
61
|
- Must be **unique** within the space's brandingSet content items.
|
|
61
|
-
- `contentBody`: Include all `required` properties from `schemaDefinition`.
|
|
62
|
+
- `contentBody`: Include all `required` properties from `schemaDefinition`.
|
|
63
|
+
1. **Seed**: Always call `execute_metadata_action` with `shouldIncludeExamples: true`. Copy the *entire* example object from `examplesOfContentType[0]` into `content.json`. **NEVER** start from a minimal stub.
|
|
64
|
+
2. **Recalculate (CRITICAL STOP)**: You MUST stop and perform explicit changes for dependent tokens BEFORE generating JSON.
|
|
65
|
+
- [] Refer to "Branding Property Patterns" for detailed calculations.
|
|
66
|
+
|
|
62
67
|
- `brandingSetType`: Represents whether the color palette is for the entire site or a specific section.
|
|
63
68
|
- `APP`: The branding set applies to the entire site. There can be only one branding set of this type.
|
|
64
69
|
- `SCOPED`: A `SCOPED` branding set can be applied only to a section component for granular overrides.
|
|
@@ -70,10 +75,6 @@ The `content.json` file must contain:
|
|
|
70
75
|
- **Patterns**: See the "Branding Property Patterns" section for details on value relationships.
|
|
71
76
|
- `urlName`: Lowercase with hyphens (e.g., `branding-set`)
|
|
72
77
|
|
|
73
|
-
**Rules**:
|
|
74
|
-
|
|
75
|
-
- Before any actions, *always* call `execute_metadata_action` to get the full schema and examples per the skill document.
|
|
76
|
-
|
|
77
78
|
### 4. Naming Conventions Summary
|
|
78
79
|
|
|
79
80
|
| Field | Format | Example |
|
|
@@ -84,9 +85,18 @@ The `content.json` file must contain:
|
|
|
84
85
|
|
|
85
86
|
### 5. Generation Checklist
|
|
86
87
|
|
|
87
|
-
- [ ] Directory and `_meta.json` follow naming conventions
|
|
88
|
-
- [ ] `content.json` has all required fields
|
|
88
|
+
- [ ] Directory and `_meta.json` follow naming conventions
|
|
89
|
+
- [ ] `content.json` has all required fields
|
|
89
90
|
- [ ] `contentBody` follows the schema provided by `execute_metadata_action`
|
|
91
|
+
- [ ] **STOP AND VERIFY**: `contentBody.values` honors all **Branding Property Patterns** defined below and explicitly recalculated and updated all dependent tokens based on any token updates requested by the user.
|
|
92
|
+
|
|
93
|
+
## Editing Existing Branding Sets
|
|
94
|
+
|
|
95
|
+
Use this section when modifying existing branding sets under the `sfdc_cms__brandingSet` directory.
|
|
96
|
+
|
|
97
|
+
### Editing Checklist
|
|
98
|
+
|
|
99
|
+
- [ ] Ensure all modified branding properties honor the **Branding Property Patterns** defined below.
|
|
90
100
|
|
|
91
101
|
## Branding Property Patterns
|
|
92
102
|
|
|
@@ -72,6 +72,7 @@ The `content.json` file must contain:
|
|
|
72
72
|
- `contentBody`: Include all `required` properties from `schemaDefinition`. Use `examplesOfContentType` for reference.
|
|
73
73
|
- Do not add additional fields.
|
|
74
74
|
- `urlName`: URL identifier (lowercase, words separated by dashes e.g., "scoped-header-and-footer")
|
|
75
|
+
- `contentBody.compnent.definition`: The actual theme layout component that displays/renders the layout and includes theme region components.
|
|
75
76
|
|
|
76
77
|
**Rules**:
|
|
77
78
|
|
|
@@ -130,7 +131,7 @@ When generating a new theme layout, ensure:
|
|
|
130
131
|
- [ ] `urlName` uses lowercase with hyphens (V)
|
|
131
132
|
- [ ] `title` is human-readable (V)
|
|
132
133
|
- [ ] `sfdc_cms__theme/[THEME_API_NAME]/content.json` updated by appending a new `contentBody.layouts` mapping (VI)
|
|
133
|
-
- [ ] **CRITICAL**: Complete all the UUID generation steps. See
|
|
134
|
+
- [ ] **CRITICAL**: Complete all the UUID generation steps. See [handle-component-and-region-ids.md](docs/handle-component-and-region-ids.md)
|
|
134
135
|
|
|
135
136
|
## Purpose B: Editing Existing Theme Layouts
|
|
136
137
|
|
|
@@ -49,7 +49,7 @@ The `_meta.json` file must contain:
|
|
|
49
49
|
|
|
50
50
|
### Theme Layout Type (All Views)
|
|
51
51
|
|
|
52
|
-
The `contentBody.themeLayoutType` field specifies which theme layout to use for the view.
|
|
52
|
+
The `contentBody.themeLayoutType` field specifies which theme layout to use for the view. There can only be one per view.
|
|
53
53
|
|
|
54
54
|
- **Default**: `"Inner"` - Use this default if the user does not specify a layout OR if the lookup fails to find a matching layoutType
|
|
55
55
|
- **Lookup**: To find valid values:
|
|
@@ -126,7 +126,7 @@ The route's `activeViewId` must match the view's directory name exactly.
|
|
|
126
126
|
- [ ] Directory and `_meta.json` follow structure (see Directory Structure, _meta.json Structure)
|
|
127
127
|
- [ ] `content.json` has all required fields (A.1)
|
|
128
128
|
- [ ] Component structure correct with both regions (A.1)
|
|
129
|
-
- [ ] **CRITICAL**: Complete all the UUID generation steps. see
|
|
129
|
+
- [ ] **CRITICAL**: Complete all the UUID generation steps. see [handle-component-and-region-ids.md](docs/handle-component-and-region-ids.md)
|
|
130
130
|
- [ ] `viewType` matches route's `routeType` (CRITICAL)
|
|
131
131
|
|
|
132
132
|
### PART B: OBJECT PAGES
|
|
@@ -218,7 +218,7 @@ The route's `activeViewId` must match the view's directory name exactly. The `vi
|
|
|
218
218
|
- [ ] `viewType` matches route's `routeType` for all three views (CRITICAL)
|
|
219
219
|
- [ ] Component structure correct with both regions (see A.1)
|
|
220
220
|
- [ ] SEO assistant configured correctly per view type (B.4)
|
|
221
|
-
- [ ] **CRITICAL**: Complete both UUID generation steps. see
|
|
221
|
+
- [ ] **CRITICAL**: Complete both UUID generation steps. see [handle-component-and-region-ids.md](docs/handle-component-and-region-ids.md)
|
|
222
222
|
|
|
223
223
|
## Purpose B: Editing Existing Views
|
|
224
224
|
|
|
@@ -51,6 +51,17 @@ Use the default templates in the docs below. Values in `{braces}` are resolved p
|
|
|
51
51
|
| DigitalExperienceBundle | [configure-metadata-digital-experience-bundle.md](docs/configure-metadata-digital-experience-bundle.md) |
|
|
52
52
|
| DigitalExperience (sfdc_cms__site) | [configure-metadata-digital-experience.md](docs/configure-metadata-digital-experience.md) |
|
|
53
53
|
|
|
54
|
+
### Execution Note for Step 3: Load and use the docs
|
|
55
|
+
- Agents MUST read the full contents of each docs/*.md file referenced in Step 3 before attempting to populate metadata fields.
|
|
56
|
+
- Use your platform's file-read tool (for example, `read_file`) to load these files in full, then perform placeholder substitution for values in `{braces}` using the resolved properties from Step 1.
|
|
57
|
+
- Files to load:
|
|
58
|
+
- `docs/configure-metadata-network.md`
|
|
59
|
+
- `docs/configure-metadata-custom-site.md`
|
|
60
|
+
- `docs/configure-metadata-digital-experience-config.md`
|
|
61
|
+
- `docs/configure-metadata-digital-experience-bundle.md`
|
|
62
|
+
- `docs/configure-metadata-digital-experience.md`
|
|
63
|
+
- Read entire file contents, replace placeholders (e.g. `{siteName}`) with the resolved values, then use the expanded templates to populate the metadata XML/JSON content.
|
|
64
|
+
|
|
54
65
|
### Step 4: Resolve Additional Configurations
|
|
55
66
|
Address any extra configurations the user requests. Use the schemas returned by `get_metadata_api_context` in Step 2 to understand each field's purpose, and update only the minimum necessary fields.
|
|
56
67
|
|