@salesforce/b2c-dx-mcp 0.3.2 → 0.4.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.
Files changed (54) hide show
  1. package/README.md +47 -27
  2. package/content/page-designer.md +4 -4
  3. package/dist/commands/mcp.d.ts +14 -2
  4. package/dist/commands/mcp.js +21 -9
  5. package/dist/registry.d.ts +4 -4
  6. package/dist/registry.js +13 -13
  7. package/dist/services.d.ts +75 -1
  8. package/dist/services.js +124 -1
  9. package/dist/tools/adapter.d.ts +29 -21
  10. package/dist/tools/adapter.js +34 -24
  11. package/dist/tools/cartridges/index.d.ts +5 -3
  12. package/dist/tools/cartridges/index.js +55 -25
  13. package/dist/tools/index.d.ts +1 -0
  14. package/dist/tools/index.js +1 -0
  15. package/dist/tools/mrt/index.d.ts +2 -2
  16. package/dist/tools/mrt/index.js +29 -10
  17. package/dist/tools/page-designer-decorator/analyzer.d.ts +169 -0
  18. package/dist/tools/page-designer-decorator/analyzer.js +535 -0
  19. package/dist/tools/page-designer-decorator/index.d.ts +252 -0
  20. package/dist/tools/page-designer-decorator/index.js +597 -0
  21. package/dist/tools/page-designer-decorator/rules/1-mode-selection.d.ts +8 -0
  22. package/dist/tools/page-designer-decorator/rules/1-mode-selection.js +65 -0
  23. package/dist/tools/page-designer-decorator/rules/2a-auto-mode.d.ts +13 -0
  24. package/dist/tools/page-designer-decorator/rules/2a-auto-mode.js +87 -0
  25. package/dist/tools/page-designer-decorator/rules/2b-0-interactive-overview.d.ts +4 -0
  26. package/dist/tools/page-designer-decorator/rules/2b-0-interactive-overview.js +55 -0
  27. package/dist/tools/page-designer-decorator/rules/2b-1-interactive-analyze.d.ts +22 -0
  28. package/dist/tools/page-designer-decorator/rules/2b-1-interactive-analyze.js +109 -0
  29. package/dist/tools/page-designer-decorator/rules/2b-2-interactive-select-props.d.ts +21 -0
  30. package/dist/tools/page-designer-decorator/rules/2b-2-interactive-select-props.js +60 -0
  31. package/dist/tools/page-designer-decorator/rules/2b-3-interactive-configure-attrs.d.ts +27 -0
  32. package/dist/tools/page-designer-decorator/rules/2b-3-interactive-configure-attrs.js +68 -0
  33. package/dist/tools/page-designer-decorator/rules/2b-4-interactive-configure-regions.d.ts +4 -0
  34. package/dist/tools/page-designer-decorator/rules/2b-4-interactive-configure-regions.js +65 -0
  35. package/dist/tools/page-designer-decorator/rules/2b-5-interactive-confirm-generation.d.ts +11 -0
  36. package/dist/tools/page-designer-decorator/rules/2b-5-interactive-confirm-generation.js +92 -0
  37. package/dist/tools/page-designer-decorator/rules.d.ts +51 -0
  38. package/dist/tools/page-designer-decorator/rules.js +70 -0
  39. package/dist/tools/page-designer-decorator/templates/decorator-generator.d.ts +116 -0
  40. package/dist/tools/page-designer-decorator/templates/decorator-generator.js +350 -0
  41. package/dist/tools/pwav3/index.d.ts +2 -2
  42. package/dist/tools/pwav3/index.js +13 -13
  43. package/dist/tools/scapi/index.d.ts +10 -2
  44. package/dist/tools/scapi/index.js +5 -56
  45. package/dist/tools/scapi/scapi-custom-apis-status.d.ts +9 -0
  46. package/dist/tools/scapi/scapi-custom-apis-status.js +152 -0
  47. package/dist/tools/scapi/scapi-schemas-list.d.ts +12 -0
  48. package/dist/tools/scapi/scapi-schemas-list.js +248 -0
  49. package/dist/tools/storefrontnext/developer-guidelines.d.ts +2 -2
  50. package/dist/tools/storefrontnext/developer-guidelines.js +3 -3
  51. package/dist/tools/storefrontnext/index.d.ts +2 -2
  52. package/dist/tools/storefrontnext/index.js +13 -13
  53. package/oclif.manifest.json +20 -6
  54. package/package.json +10 -5
@@ -0,0 +1,87 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ export function renderAutoMode(context) {
7
+ return `# Auto Mode - Page Designer Decorator Generation
8
+
9
+ ## LLM INSTRUCTIONS
10
+
11
+ ### Auto Mode Behavior
12
+
13
+ **Single-Step Execution:**
14
+ - NO user interaction required
15
+ - NO questions to ask
16
+ - Analyze component automatically
17
+ - Auto-select all suitable props
18
+ - Auto-infer types based on naming patterns
19
+ - Generate code immediately
20
+
21
+ **Auto-Selection Criteria:**
22
+ - ✅ Include: Simple props (string, number, boolean)
23
+ - ❌ Exclude: Complex types (objects, arrays, functions)
24
+ - ❌ Exclude: UI-only props (className, style, etc.)
25
+
26
+ **Auto-Inference Patterns:**
27
+ - \`*Url\`, \`*Link\` → \`url\` type
28
+ - \`*Image\`, \`*Icon\` → \`image\` type
29
+ - \`is*\`, \`has*\`, \`enable*\`, \`show*\` → \`boolean\` type (default: false)
30
+ - \`*Size\` → \`enum\` type (values: ['default', 'primary', 'secondary'])
31
+ - \`*Variant\` → \`enum\` type (values: ['default', 'primary', 'secondary'])
32
+
33
+ **Regions:**
34
+ - NOT configured in auto mode
35
+ - User must use interactive mode for regions
36
+
37
+ ### Component Analysis Summary
38
+
39
+ **Component Name**: ${context.componentName}
40
+ **File**: ${context.file}
41
+ **Component ID**: ${context.componentId}
42
+ **Selected Props**: ${context.selectedPropCount}
43
+ **Auto-configured**: ${context.autoConfigCount}
44
+ **Auto-inferred**: ${context.autoInferredCount}
45
+
46
+ ${context.hasNoSuitableProps
47
+ ? `⚠️ **No suitable props found**. The component has only complex or UI-only props.
48
+ Consider adding new attributes manually or using interactive mode.`
49
+ : ''}
50
+
51
+ ---
52
+
53
+ # USER-FACING RESPONSE
54
+
55
+ # ✅ Page Designer Decorators Generated (Auto Mode)
56
+
57
+ ## Auto-Configuration Summary
58
+
59
+ - **Component**: \`${context.componentName}\`
60
+ - **Component ID**: \`${context.componentId}\`
61
+ - **File**: \`${context.file}\`
62
+ - **Selected Props**: ${context.selectedProps}
63
+ - **Auto-configured**: ${context.autoConfigCount}
64
+ - **Auto-inferred**: ${context.autoInferredCount}
65
+
66
+ ${context.hasNoSuitableProps
67
+ ? `⚠️ **No suitable props found**. The component has only complex or UI-only props.
68
+ Consider adding new attributes manually or using interactive mode.`
69
+ : ''}
70
+
71
+ ## Generated Code
72
+
73
+ Add this metadata class to your component file:
74
+
75
+ \`\`\`typescript
76
+ ${context.decoratorCode}
77
+ \`\`\`
78
+
79
+ ## Next Steps
80
+
81
+ 1. **Add the code** to \`${context.file}\` (after imports, before component)
82
+ 2. **Update component props** to make them optional and add type unions as needed
83
+ 3. **Generate metadata**: Run \`sfnext generate-cartridge --project-directory .\`
84
+ 4. **Deploy cartridge**: Run \`sfnext deploy-cartridge --project-directory .\`
85
+ 5. **Verify in Business Manager**: Check Components > ${context.componentGroup} > ${context.componentName}`;
86
+ }
87
+ //# sourceMappingURL=2a-auto-mode.js.map
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Interactive mode workflow overview
3
+ */
4
+ export declare function renderInteractiveOverview(): string;
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ /**
7
+ * Interactive mode workflow overview
8
+ */
9
+ export function renderInteractiveOverview() {
10
+ return `# ⚠️ MANDATORY: Adding Page Designer Support
11
+
12
+ ## 🚨 CRITICAL: Multi-Step Workflow
13
+
14
+ **YOU MUST FOLLOW THIS WORKFLOW:**
15
+
16
+ 1. **analyze**: Present component analysis and ask configuration questions
17
+ - Component identity (ID, name, description, group)
18
+ - Which existing props to expose
19
+ - Whether to add new attributes
20
+
21
+ 2. **select_props**: Confirm user's selections
22
+ - Show what was selected
23
+ - Confirm component metadata
24
+ - Prepare for type configuration
25
+
26
+ 3. **configure_attrs**: Configure attribute types
27
+ - Show auto-inferred types
28
+ - Ask for explicit type configuration where needed
29
+ - Collect defaults and enum values
30
+
31
+ 4. **configure_regions**: Configure regions (optional)
32
+ - Ask if component needs nested content areas
33
+ - Configure region definitions if needed
34
+
35
+ 5. **confirm_generation**: Generate final decorator code
36
+ - Render decorators with all configurations
37
+ - Show code to user
38
+
39
+ **VIOLATION OF THIS WORKFLOW IS A CRITICAL ERROR.**
40
+
41
+ ## Workflow Enforcement
42
+
43
+ - Each step must complete before proceeding to the next
44
+ - User must confirm or provide input at each step
45
+ - Do not make assumptions about user preferences
46
+ - Do not skip steps, even if the answer seems obvious
47
+
48
+ ## Next Step Instructions
49
+
50
+ After presenting analysis, you MUST:
51
+ 1. Wait for user's answers to ALL questions
52
+ 2. Call tool again with step: "select_props" and user's responses in conversationContext
53
+ 3. NEVER proceed to code generation without completing all steps`;
54
+ }
55
+ //# sourceMappingURL=2b-0-interactive-overview.js.map
@@ -0,0 +1,22 @@
1
+ export interface PropInfo {
2
+ name: string;
3
+ type: string;
4
+ optional: boolean;
5
+ }
6
+ export interface AnalyzeStepContext {
7
+ componentName: string;
8
+ file: string;
9
+ hasDecorators: boolean;
10
+ interfaceName?: string;
11
+ totalProps: number;
12
+ exportType: string;
13
+ hasEditableProps: boolean;
14
+ editableProps: PropInfo[];
15
+ hasComplexProps: boolean;
16
+ complexProps: PropInfo[];
17
+ hasUIProps: boolean;
18
+ uiProps: PropInfo[];
19
+ suggestedComponentId: string;
20
+ suggestedComponentName: string;
21
+ }
22
+ export declare function renderAnalyzeStep(context: AnalyzeStepContext): string;
@@ -0,0 +1,109 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ export function renderAnalyzeStep(context) {
7
+ return `# Step 1: Component Analysis
8
+
9
+ ## LLM INSTRUCTIONS
10
+
11
+ ### Component Analysis Results
12
+
13
+ **Component Name**: ${context.componentName}
14
+ **File**: ${context.file}
15
+ **Has Decorators**: ${context.hasDecorators ? 'Yes (STOP - already decorated)' : 'No (proceed)'}
16
+ **Props Interface**: ${context.interfaceName || 'None found'}
17
+ **Total Props**: ${context.totalProps}
18
+
19
+ ${context.hasDecorators
20
+ ? `⚠️ **CRITICAL**: Component already has Page Designer decorators.
21
+ **ACTION**: Stop here and inform user. Do not proceed with generation.`
22
+ : ''}
23
+
24
+ ### Next Actions (LLM)
25
+
26
+ 1. Present the analysis to the user
27
+ 2. Ask all configuration questions (component identity, props selection, new properties)
28
+ 3. Wait for user's complete response
29
+ 4. THEN call tool again with step: "select_props" with collected answers
30
+
31
+ ---
32
+
33
+ # USER-FACING RESPONSE
34
+
35
+ ${context.hasDecorators
36
+ ? `# Analysis: ${context.componentName}
37
+
38
+ ✅ **This component already has Page Designer support.**
39
+
40
+ The component has existing decorators (@Component, @AttributeDefinition, etc.).
41
+
42
+ Would you like to modify the existing decorators instead?`
43
+ : `# Analysis: ${context.componentName}
44
+
45
+ ## Current State
46
+
47
+ - **Component**: \`${context.componentName}\`
48
+ - **File**: \`${context.file}\`
49
+ - **Props Interface**: \`${context.interfaceName || 'None found'}\`
50
+ - **Export Type**: ${context.exportType}
51
+
52
+ ## Existing Properties Analysis
53
+
54
+ ${context.hasEditableProps
55
+ ? `### ✅ Suitable for Page Designer:
56
+
57
+ ${context.editableProps.map((prop) => `- \`${prop.name}\` (${prop.type})${prop.optional ? ' - optional' : ''}`).join('\n')}`
58
+ : '### ⚠️ No suitable properties found'}
59
+
60
+ ${context.hasComplexProps
61
+ ? `### ⚠️ Complex (needs simplification):
62
+
63
+ ${context.complexProps.map((prop) => `- \`${prop.name}\` (${prop.type}) - Too complex for Page Designer`).join('\n')}
64
+
65
+ These complex types cannot be used directly. Consider creating simpler alternatives.`
66
+ : ''}
67
+
68
+ ${context.hasUIProps
69
+ ? `### 🎨 UI Props (typically not exposed):
70
+
71
+ ${context.uiProps.map((prop) => `- \`${prop.name}\` (${prop.type})`).join('\n')}
72
+
73
+ These are styling/layout props, usually not exposed to Page Designer.`
74
+ : ''}
75
+
76
+ ## Configuration Questions
77
+
78
+ ### 1️⃣ Component Identity
79
+
80
+ I suggest:
81
+ - **ID**: \`${context.suggestedComponentId}\`
82
+ - **Name**: "${context.suggestedComponentName}"
83
+ - **Description**: *[Please provide a description]*
84
+ - **Group**: \`odyssey_base\` (default) or specify custom group
85
+
86
+ ✏️ Are these acceptable, or would you like to change them?
87
+
88
+ ### 2️⃣ Existing Properties
89
+
90
+ ${context.hasEditableProps
91
+ ? `**Which properties should be editable in Page Designer?**
92
+
93
+ ${context.editableProps.map((prop) => `- [ ] \`${prop.name}\` - ${prop.type}`).join('\n')}`
94
+ : '⚠️ No existing properties are suitable.'}
95
+
96
+ ### 3️⃣ New Properties
97
+
98
+ **Should I add any new properties** that don't exist in the component interface?
99
+
100
+ Examples:
101
+ - Button text, labels, or headings
102
+ - Toggle flags (show/hide elements)
103
+ - Configuration options
104
+
105
+ ---
106
+
107
+ **Please answer these questions to proceed.**`}`;
108
+ }
109
+ //# sourceMappingURL=2b-1-interactive-analyze.js.map
@@ -0,0 +1,21 @@
1
+ export interface NewAttribute {
2
+ name: string;
3
+ description?: string;
4
+ required?: boolean;
5
+ }
6
+ export interface SelectPropsContext {
7
+ componentMetadata: {
8
+ id: string;
9
+ name: string;
10
+ description: string;
11
+ group?: string;
12
+ };
13
+ selectedProps: string[];
14
+ newAttributes: NewAttribute[];
15
+ selectedPropsCount: number;
16
+ newAttributesCount: number;
17
+ totalAttributeCount: number;
18
+ hasSelectedProps: boolean;
19
+ hasNewAttributes: boolean;
20
+ }
21
+ export declare function renderSelectPropsConfirmation(context: SelectPropsContext): string;
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ export function renderSelectPropsConfirmation(context) {
7
+ return `# Step 2: Selection Confirmation
8
+
9
+ ## LLM INSTRUCTIONS
10
+
11
+ ### Purpose
12
+ Present a clear confirmation of the user's selections from Step 1 (analyze).
13
+
14
+ ### Context Provided
15
+ - Component identity (id, name, description, group)
16
+ - Array of selected existing prop names
17
+ - Array of new attributes to add
18
+ - Counts and flags
19
+
20
+ ### Next Actions
21
+ After showing confirmation, instruct user to confirm proceeding to type configuration.
22
+
23
+ ---
24
+
25
+ # USER-FACING RESPONSE
26
+
27
+ # ✅ Selection Confirmed
28
+
29
+ ## Component Configuration
30
+
31
+ - **ID**: \`${context.componentMetadata.id}\`
32
+ - **Name**: "${context.componentMetadata.name}"
33
+ - **Description**: "${context.componentMetadata.description}"
34
+ - **Group**: \`${context.componentMetadata.group || 'odyssey_base'}\`
35
+
36
+ ${context.hasSelectedProps
37
+ ? `## 📋 Selected Existing Props (${context.selectedPropsCount})
38
+
39
+ ${context.selectedProps.map((prop) => `- \`${prop}\``).join('\n')}`
40
+ : `## 📋 Selected Existing Props
41
+
42
+ None selected.`}
43
+
44
+ ${context.hasNewAttributes
45
+ ? `## ➕ New Attributes to Add (${context.newAttributesCount})
46
+
47
+ ${context.newAttributes.map((attr) => `- \`${attr.name}\`${attr.description ? ` - ${attr.description}` : ''}${attr.required ? ' (required)' : ''}`).join('\n')}`
48
+ : `## ➕ New Attributes to Add
49
+
50
+ None requested.`}
51
+
52
+ ---
53
+
54
+ ## 🎯 Next Step: Attribute Configuration
55
+
56
+ Now I'll analyze the types for these ${context.totalAttributeCount} attribute(s) and help you configure them for Page Designer.
57
+
58
+ **Please confirm**: Ready to proceed with type configuration? (Say "yes" or "proceed")`;
59
+ }
60
+ //# sourceMappingURL=2b-2-interactive-select-props.js.map
@@ -0,0 +1,27 @@
1
+ export interface TypeSuggestion {
2
+ type: string;
3
+ priority: string;
4
+ reason: string;
5
+ }
6
+ export interface ConfigureAttrsContext {
7
+ totalAttributes: number;
8
+ autoInferredCount: number;
9
+ needsConfigCount: number;
10
+ hasAutoInferred: boolean;
11
+ autoInferredAttrs: Array<{
12
+ name: string;
13
+ tsType: string;
14
+ }>;
15
+ hasNeedsConfig: boolean;
16
+ needsConfigAttrs: Array<{
17
+ name: string;
18
+ tsType: string;
19
+ source: string;
20
+ hasSuggestions: boolean;
21
+ suggestions: TypeSuggestion[];
22
+ suggestedTypes: string;
23
+ humanReadableName: string;
24
+ hasEnumSuggestion: boolean;
25
+ }>;
26
+ }
27
+ export declare function renderConfigureAttrs(context: ConfigureAttrsContext): string;
@@ -0,0 +1,68 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ export function renderConfigureAttrs(context) {
7
+ return `# Step 2: Attribute Configuration
8
+
9
+ ## LLM INSTRUCTIONS
10
+
11
+ ### Analysis Complete
12
+
13
+ Total attributes to configure: ${context.totalAttributes}
14
+ Auto-inferred: ${context.autoInferredCount}
15
+ Need configuration: ${context.needsConfigCount}
16
+
17
+ ### Next Steps for LLM
18
+
19
+ **WAIT for user to:**
20
+ 1. Provide explicit type overrides (if desired)
21
+ 2. Provide custom names/descriptions (if desired)
22
+ 3. Provide enum values (if applicable)
23
+ 4. Or confirm "use defaults"
24
+
25
+ **THEN** call tool again with step: "configure_regions"
26
+
27
+ ---
28
+
29
+ # USER-FACING RESPONSE
30
+
31
+ # Attribute Configuration
32
+
33
+ ${context.hasAutoInferred
34
+ ? `## ✅ Auto-Configured Attributes
35
+
36
+ These attributes will use auto-inferred types (no explicit configuration needed):
37
+
38
+ ${context.autoInferredAttrs.map((attr) => `- **${attr.name}** (${attr.tsType}) → Auto-inferred as Page Designer type`).join('\n')}`
39
+ : ''}
40
+
41
+ ${context.hasNeedsConfig
42
+ ? `## ⚙️ Attributes Needing Configuration
43
+
44
+ ${context.needsConfigAttrs
45
+ .map((attr, index) => `### ${index + 1}. \`${attr.name}\`
46
+
47
+ - **TypeScript Type**: \`${attr.tsType}\`
48
+ - **Source**: ${attr.source}
49
+
50
+ ${attr.hasSuggestions
51
+ ? `**Recommendations**:
52
+
53
+ ${attr.suggestions.map((s) => `- **${s.type}** (${s.priority} priority): ${s.reason}`).join('\n')}`
54
+ : ''}
55
+
56
+ **Questions**:
57
+ - What Page Designer type should this be? (${attr.suggestedTypes})
58
+ - Custom display name? (default: "${attr.humanReadableName}")
59
+ - Default value?
60
+ ${attr.hasEnumSuggestion ? '- Enum values? (e.g., ["option1", "option2", "option3"])' : ''}`)
61
+ .join('\n\n')}`
62
+ : ''}
63
+
64
+ ---
65
+
66
+ **Please provide configuration for attributes that need it, or say "use defaults" to proceed.**`;
67
+ }
68
+ //# sourceMappingURL=2b-3-interactive-configure-attrs.js.map
@@ -0,0 +1,4 @@
1
+ export interface ConfigureRegionsContext {
2
+ componentName: string;
3
+ }
4
+ export declare function renderConfigureRegions(context: ConfigureRegionsContext): string;
@@ -0,0 +1,65 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ export function renderConfigureRegions(context) {
7
+ return `# Step 3: Region Configuration
8
+
9
+ ## LLM INSTRUCTIONS
10
+
11
+ ### 🚨 CRITICAL: Ask User About Regions
12
+
13
+ **YOU MUST:**
14
+ 1. Ask user if component needs regions for nested content
15
+ 2. If YES, ask for region configurations:
16
+ - Region ID (e.g., "main", "sidebar", "footer")
17
+ - Region name (display name)
18
+ - Description (optional)
19
+ - Max components (optional)
20
+ - Component type filters (optional)
21
+ 3. Wait for user response
22
+ 4. THEN call tool again with step: "confirm_generation" and regionConfig filled
23
+
24
+ ### Region Context
25
+
26
+ Regions allow business users to nest other components inside this component.
27
+ Examples: Hero with content slots, Layout containers, Section wrappers
28
+
29
+ ---
30
+
31
+ # USER-FACING RESPONSE
32
+
33
+ # Step 3: Region Configuration
34
+
35
+ **Component**: ${context.componentName}
36
+
37
+ ## About Regions
38
+
39
+ Regions define areas where business users can insert other components in Page Designer.
40
+ Use regions for:
41
+ - Layout containers (e.g., grid, flex layouts)
42
+ - Content areas with multiple components
43
+ - Sections that need nested content
44
+
45
+ **Does this component need regions for nested content?**
46
+
47
+ Examples:
48
+ - ✅ **YES** for: Layout, Container, Section, Grid
49
+ - ❌ **NO** for: Button, Image, Text, ProductCarousel
50
+
51
+ ---
52
+
53
+ **Please answer:**
54
+ 1. Does this component need regions? (yes/no)
55
+ 2. If yes, provide region configuration(s)
56
+
57
+ **Region Configuration Example:**
58
+ \`\`\`
59
+ - id: "main"
60
+ name: "Main Content"
61
+ description: "Primary content area"
62
+ maxComponents: 10
63
+ \`\`\``;
64
+ }
65
+ //# sourceMappingURL=2b-4-interactive-configure-regions.js.map
@@ -0,0 +1,11 @@
1
+ export interface ConfirmGenerationContext {
2
+ decoratorCode: string;
3
+ componentName: string;
4
+ componentId: string;
5
+ componentGroup: string;
6
+ file: string;
7
+ attributeCount: number;
8
+ hasRegions: boolean;
9
+ regionCount?: number;
10
+ }
11
+ export declare function renderConfirmGeneration(context: ConfirmGenerationContext): string;
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ export function renderConfirmGeneration(context) {
7
+ return `# Step 5: Code Generation
8
+
9
+ ## LLM INSTRUCTIONS
10
+
11
+ ### Purpose
12
+ Present the generated Page Designer decorator code and next steps.
13
+
14
+ ### Context Provided
15
+ - Complete generated metadata class with decorators
16
+ - Component name, ID, group
17
+ - File path, attribute count, region info
18
+
19
+ ### Next Actions
20
+ 1. Show the generated code
21
+ 2. Provide clear next steps for deployment
22
+ 3. Optionally offer to add code to the file
23
+
24
+ ---
25
+
26
+ # USER-FACING RESPONSE
27
+
28
+ # ✅ Page Designer Decorators Generated
29
+
30
+ ## Generated Code
31
+
32
+ Add this metadata class to \`${context.file}\`:
33
+
34
+ \`\`\`typescript
35
+ ${context.decoratorCode}
36
+ \`\`\`
37
+
38
+ ## Summary
39
+
40
+ - **Component**: ${context.componentName}
41
+ - **Component ID**: \`${context.componentId}\`
42
+ - **Group**: \`${context.componentGroup}\`
43
+ - **Attributes**: ${context.attributeCount}
44
+ ${context.hasRegions ? `- **Regions**: ${context.regionCount} configured` : ''}
45
+
46
+ ## Next Steps
47
+
48
+ ### 1. Add the Code
49
+
50
+ Add the generated metadata class to \`${context.file}\`:
51
+ - Place it **after imports**
52
+ - Place it **before the component definition**
53
+
54
+ ### 2. Update Component Props (if needed)
55
+
56
+ Make decorated props optional in your component interface:
57
+
58
+ \`\`\`typescript
59
+ interface ${context.componentName}Props {
60
+ title?: string; // Add ? if attribute is not required
61
+ // ... other props
62
+ }
63
+ \`\`\`
64
+
65
+ ### 3. Generate Cartridge Metadata
66
+
67
+ \`\`\`bash
68
+ cd packages/template-retail-rsc-app
69
+ pnpm sfnext generate-cartridge --project-directory .
70
+ \`\`\`
71
+
72
+ This creates JSON files in \`cartridges/app_storefrontnext_base/cartridge/experience/components/\`.
73
+
74
+ ### 4. Deploy Cartridge
75
+
76
+ \`\`\`bash
77
+ pnpm sfnext deploy-cartridge --project-directory .
78
+ \`\`\`
79
+
80
+ ### 5. Verify in Business Manager
81
+
82
+ 1. Log into Business Manager
83
+ 2. Navigate to: **Merchant Tools > Site > Page Designer**
84
+ 3. Find your component: **Components > ${context.componentGroup} > ${context.componentName}**
85
+ 4. Verify all attributes appear correctly
86
+ 5. Test editing a page with your component
87
+
88
+ ---
89
+
90
+ **Would you like me to add this code to your component file?**`;
91
+ }
92
+ //# sourceMappingURL=2b-5-interactive-confirm-generation.js.map
@@ -0,0 +1,51 @@
1
+ import { type ModeSelectionContext } from './rules/1-mode-selection.js';
2
+ import { type AnalyzeStepContext } from './rules/2b-1-interactive-analyze.js';
3
+ import { type SelectPropsContext } from './rules/2b-2-interactive-select-props.js';
4
+ import { type ConfigureAttrsContext } from './rules/2b-3-interactive-configure-attrs.js';
5
+ import { type ConfigureRegionsContext } from './rules/2b-4-interactive-configure-regions.js';
6
+ import { type ConfirmGenerationContext } from './rules/2b-5-interactive-confirm-generation.js';
7
+ import { type AutoModeContext } from './rules/2a-auto-mode.js';
8
+ /**
9
+ * Page Designer decorator rules - type-safe, zero dependencies
10
+ */
11
+ export declare const pageDesignerDecoratorRules: {
12
+ /**
13
+ * Renders the mode selection prompt
14
+ */
15
+ getModeSelectionInstructions(context: ModeSelectionContext): string;
16
+ /**
17
+ * Renders the interactive mode workflow overview
18
+ */
19
+ getInteractiveOverview(): string;
20
+ /**
21
+ * Renders Interactive Analyze step instructions
22
+ */
23
+ getAnalyzeInstructions(context: AnalyzeStepContext): string;
24
+ /**
25
+ * Renders Interactive Select Props step confirmation
26
+ */
27
+ getSelectPropsConfirmation(context: SelectPropsContext): string;
28
+ /**
29
+ * Renders Interactive Configure Attributes step instructions
30
+ */
31
+ getConfigureAttrsInstructions(context: ConfigureAttrsContext): string;
32
+ /**
33
+ * Renders Interactive Configure Regions step instructions
34
+ */
35
+ getConfigureRegionsInstructions(context: ConfigureRegionsContext): string;
36
+ /**
37
+ * Renders Interactive Confirm Generation step (final code presentation)
38
+ */
39
+ getConfirmGenerationInstructions(context: ConfirmGenerationContext): string;
40
+ /**
41
+ * Renders Auto Mode instructions
42
+ */
43
+ getAutoModeInstructions(context: AutoModeContext): string;
44
+ };
45
+ export type { ModeSelectionContext } from './rules/1-mode-selection.js';
46
+ export type { AutoModeContext } from './rules/2a-auto-mode.js';
47
+ export type { AnalyzeStepContext } from './rules/2b-1-interactive-analyze.js';
48
+ export type { SelectPropsContext } from './rules/2b-2-interactive-select-props.js';
49
+ export type { ConfigureAttrsContext } from './rules/2b-3-interactive-configure-attrs.js';
50
+ export type { ConfigureRegionsContext } from './rules/2b-4-interactive-configure-regions.js';
51
+ export type { ConfirmGenerationContext } from './rules/2b-5-interactive-confirm-generation.js';