mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-09 08:53:18 +08:00
Compare commits
4 Commits
19b470fb94
...
7b8e7da88d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b8e7da88d | ||
|
|
f874c6e1d7 | ||
|
|
3d993405ed | ||
|
|
699ba8c663 |
@ -34,7 +34,7 @@ When working with Experience LWR sites:
|
||||
|
||||
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.
|
||||
2. **ALWAYS** load the relevant reference docs before doing anything.
|
||||
3. If the workflows in [Common Workflows](#common-workflows) match user's requirements, you **MUST** follow them strictly. The instructions there should override any conflicting global rules and should have the highest priority over your existing knowledge.
|
||||
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.
|
||||
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.
|
||||
|
||||
## Core Site Properties
|
||||
@ -94,12 +94,12 @@ Reference docs within the skill directory. Note that these are **local** and not
|
||||
## Common Workflows
|
||||
|
||||
- See [References](#references) for detailed capabilities.
|
||||
- **Always** follow the steps defined in the workflows sequentially whether the task is small, big, quick, or complex.
|
||||
|
||||
### Creating a New Site
|
||||
|
||||
**Rules**:
|
||||
|
||||
- **NEVER** call `get_metadata_api_context` on metadata type DigitalExperienceConfig, DigitalExperienceBundle, Network, or CustomSite for new site generation.
|
||||
- **NEVER** generate the files manually.
|
||||
|
||||
**Steps** (Follow the steps sequentially. Do not skip any step before proceeding):
|
||||
@ -147,9 +147,9 @@ Reference docs within the skill directory. Note that these are **local** and not
|
||||
- [ ] Determine what content types the user wants to modify
|
||||
- [ ] Read and follow strictly 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).
|
||||
- [ ] **Always** Read [handle-component-and-region-ids.md](docs/handle-component-and-region-ids.md) if creating or modifying view or theme layout
|
||||
- [ ] Call `execute_metadata_action` to get the schema and examples for that content type **after** loading the corresponding reference docs.
|
||||
- [ ] **Always** Call `execute_metadata_action` to get the schema and examples for that content type **after** loading the corresponding reference docs.
|
||||
- **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.
|
||||
- For each unique content type you need to work with, call `execute_metadata_action` using the following (Do not call the `execute_metadata_action` MCP tool with any other site actionName unless specified in this knowledge doc):
|
||||
- For each unique content type you need to work with, **always** call `execute_metadata_action` using the following:
|
||||
|
||||
```json
|
||||
{
|
||||
@ -180,14 +180,6 @@ The site developer name can be found in the CustomSite filename (e.g., `sites/My
|
||||
|
||||
If the site is not found, an error message will be returned indicating that the site may not be deployed. Ensure the site has been successfully deployed before calling this action.
|
||||
|
||||
### Retrieve Site Metadata Schemas and Documentation
|
||||
|
||||
`get_metadata_api_context` MCP tool can be used to retrieve metadata schemas and documentation. For Experience sites, these metadata types are used: DigitalExperienceConfig, DigitalExperienceBundle, Network, CustomSite.
|
||||
|
||||
```json
|
||||
{ "metadataType": "<metadata type>" }
|
||||
```
|
||||
|
||||
### Validation & Deployment
|
||||
|
||||
Use `sf` CLI to validate and deploy. Access help docs by attaching `--help`, e.g.:
|
||||
|
||||
@ -70,6 +70,10 @@ The `content.json` file must contain:
|
||||
- **Patterns**: See the "Branding Property Patterns" section for details on value relationships.
|
||||
- `urlName`: Lowercase with hyphens (e.g., `branding-set`)
|
||||
|
||||
**Rules**:
|
||||
|
||||
- Before any actions, *always* call `execute_metadata_action` to get the full schema and examples per the skill document.
|
||||
|
||||
### 4. Naming Conventions Summary
|
||||
|
||||
| Field | Format | Example |
|
||||
|
||||
@ -186,6 +186,10 @@ Use `[ObjectName]` as the object name (Account, Test_Object) and `[IDENTIFIER]`
|
||||
}
|
||||
```
|
||||
|
||||
**Rules**:
|
||||
|
||||
- Before any actions, *always* call `execute_metadata_action` to get the full schema and examples per the skill document.
|
||||
|
||||
#### routeType Examples
|
||||
|
||||
| Route Type | Standard (Account) | Custom (Test_Object__c) |
|
||||
|
||||
@ -73,6 +73,10 @@ The `content.json` file must contain:
|
||||
- Do not add additional fields.
|
||||
- `urlName`: URL identifier (lowercase, words separated by dashes e.g., "scoped-header-and-footer")
|
||||
|
||||
**Rules**:
|
||||
|
||||
- Before any actions, *always* call `execute_metadata_action` to get the full schema and examples per the skill document.
|
||||
|
||||
### Naming Conventions
|
||||
|
||||
1. **Directory Name**: Should be in camelCase
|
||||
|
||||
@ -184,6 +184,10 @@ Create three directories under `sfdc_cms__view/`:
|
||||
- `contentBody.viewType`: **CRITICAL**: Must exactly match route's `routeType`
|
||||
- `urlName`: Lowercase with hyphens (e.g., `account-detail`)
|
||||
|
||||
**Rules**:
|
||||
|
||||
- Before any actions, *always* call `execute_metadata_action` to get the full schema and examples per the skill document.
|
||||
|
||||
#### B.4. Component Structure
|
||||
|
||||
Uses same structure as Part A.1 (Component Structure) with these SEO assistant differences:
|
||||
|
||||
@ -5,13 +5,7 @@ If sharingRules metadata is not available locally in force-app/main/default/shar
|
||||
|
||||
## Retrieve Full SharingRules Schema
|
||||
|
||||
Use the `get_metadata_api_context` MCP tool:
|
||||
|
||||
```json
|
||||
{
|
||||
"metadataType": "SharingRules"
|
||||
}
|
||||
```
|
||||
Use the metadata MCP tool with metadataType "SharingRules" to retrieve schema.
|
||||
|
||||
## XML Example
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
- **CRITICAL**: Each step must be performed separately - do NOT combine steps into a single automated command or script
|
||||
- **Step 1**: Create files with descriptive placeholders for UUIDs (e.g., `UUID_CONTENT_REGION`, `UUID_HIDDEN_REGION`, `UUID_SEO_COMPONENT`)
|
||||
- **Step 2**: Count the total number of UUID placeholder occurrences in the generated file, then generate exactly that many UUIDs using:
|
||||
- `node -e "console.log(Array.from({length: N}, () => require('crypto').randomUUID()).join('\n'))"` where N is the total count of placeholder occurrences. Present this command to the user for manual execution.
|
||||
- **Step 3**: Replace each placeholder occurrence sequentially with the generated UUIDs from the list, ensuring each occurrence gets a unique UUID from the list. Perform replacements manually one at a time or in small batches - do NOT automate this with scripts.
|
||||
- `node -e "console.log(Array.from({length: N}, () => require('crypto').randomUUID()).join('\n'))"` where N is the total count of placeholder occurrences. Present this command to the user for execution.
|
||||
- **Step 3**: Replace each placeholder occurrence sequentially with the generated UUIDs from the list, ensuring each occurrence gets a unique UUID from the list. Perform replacements one at a time or in small batches - do NOT automate this with scripts.
|
||||
- **Step 4**: Validate that all placeholders have been replaced - read the file and search for any remaining placeholder patterns (e.g., `UUID_`). The file is NOT valid until all placeholders are replaced with actual UUIDs.
|
||||
- **CRITICAL**: Every single placeholder occurrence must be replaced with a DIFFERENT UUID from the generated list, even if the placeholder name is repeated. For example, if you have 5 total placeholder occurrences, generate 5 UUIDs and replace each occurrence with the next UUID from the list.
|
||||
- **NEVER** write UUIDs inline during file creation - always use the multistep placeholder approach
|
||||
|
||||
@ -89,6 +89,32 @@ community_layout:sldsFlexibleLayout (root)
|
||||
}
|
||||
```
|
||||
|
||||
### Named Region Creation
|
||||
In order to create a component with drag-n-droppable region/slot that can be used in Experience Builder sites and persist across views, there are multiple steps needed.
|
||||
|
||||
Page layout components should add the lightningCommunity__Page_Layout target in js-meta.xml.
|
||||
Theme layout components should add the lightningCommunity__Theme_Layout target in js-meta.xml.
|
||||
Add lightningCommunity__Page as a target for page layouts and any component with slots that is not explicitly defined as a theme layout.
|
||||
|
||||
The js file in LWC need to declare named slots:
|
||||
```js
|
||||
/**
|
||||
* @slot header
|
||||
* @slot footer
|
||||
*/
|
||||
export default class YourComponentName extends LightningElement {}
|
||||
```
|
||||
|
||||
Do not add any other comments in the declaration comment block. The named @slot annotations must be the last comments
|
||||
in the block before the class declaration.
|
||||
|
||||
In html, named slots are needed. <slot name="header"> and <slot name="footer"> in the above example.
|
||||
|
||||
For theme layout component, a <slot> with no name is the main content region, a slot with name is a sticky region that doesn't change from page to page that uses the same theme layout component.
|
||||
|
||||
No need to declare target config properties for the slots/regions.
|
||||
See the example below for adding a component with named slots into a view.
|
||||
|
||||
### Component Structure
|
||||
|
||||
```json
|
||||
@ -114,8 +140,9 @@ community_layout:sldsFlexibleLayout (root)
|
||||
- Custom LWC: Only `@api` properties in `targetConfigs` (with `lightningCommunity__Default` target)
|
||||
- OOTB: Only exposed schema properties
|
||||
|
||||
### Complete Example
|
||||
### Complete Examples
|
||||
|
||||
**Example 1: Overall structure**
|
||||
Correct nesting: `content` region → section → column region → components
|
||||
|
||||
```json
|
||||
@ -159,3 +186,30 @@ Correct nesting: `content` region → section → column region → components
|
||||
```
|
||||
|
||||
**CRITICAL**: Follow UUID generation process (`handle-component-and-region-ids.md`) when inserting components.
|
||||
|
||||
**Example 2: Representing slots**
|
||||
If a component with slots (i.e. @slot annotation) is inserted, slots must appear as named regions.
|
||||
In this example the component threeColumn has 3 slots, named left, center, and right.
|
||||
```json
|
||||
{
|
||||
"attributes" : { },
|
||||
"children" : [ {
|
||||
"id" : "4c6148c7-c07e-4245-ae50-ac07891046f2",
|
||||
"name" : "left",
|
||||
"title" : "left",
|
||||
"type" : "region"
|
||||
}, {
|
||||
"id" : "f362e789-7f09-40b4-a59f-03f76ea73401",
|
||||
"name" : "center",
|
||||
"title" : "center",
|
||||
"type" : "region"
|
||||
}, {
|
||||
"id" : "2678ddd4-a1a4-41c4-bf5a-1a3e55891eb2",
|
||||
"name" : "right",
|
||||
"title" : "right",
|
||||
"type" : "region"
|
||||
} ],
|
||||
"definition" : "c:threeColumn",
|
||||
"id" : "b9e517c5-90ac-49e9-91b7-3730512c95a3",
|
||||
"type" : "component"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user