@salesforce/b2c-dx-mcp 0.4.13 → 0.5.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.
- package/README.md +21 -21
- package/content/sfnext/page-designer.md +7 -15
- package/content/sfnext/quick-reference.md +1 -1
- package/dist/commands/mcp.d.ts +2 -2
- package/dist/commands/mcp.js +3 -3
- package/dist/registry.d.ts +2 -2
- package/dist/tools/adapter.d.ts +1 -1
- package/dist/tools/adapter.js +1 -1
- package/dist/tools/cartridges/index.d.ts +1 -1
- package/dist/tools/mrt/index.d.ts +1 -1
- package/dist/tools/pwav3/index.d.ts +1 -1
- package/dist/tools/pwav3/pwa-kit-development-guidelines.d.ts +1 -1
- package/dist/tools/pwav3/pwa-kit-development-guidelines.js +1 -1
- package/dist/tools/scapi/index.d.ts +1 -1
- package/dist/tools/scapi/index.js +2 -2
- package/dist/tools/scapi/{scapi-custom-api-scaffold.d.ts → scapi-custom-api-generate-scaffold.d.ts} +4 -4
- package/dist/tools/scapi/{scapi-custom-api-scaffold.js → scapi-custom-api-generate-scaffold.js} +5 -5
- package/dist/tools/scapi/{scapi-custom-apis-status.d.ts → scapi-custom-apis-get-status.d.ts} +2 -2
- package/dist/tools/scapi/{scapi-custom-apis-status.js → scapi-custom-apis-get-status.js} +4 -4
- package/dist/tools/scapi/scapi-schemas-list.d.ts +1 -1
- package/dist/tools/scapi/scapi-schemas-list.js +1 -1
- package/dist/tools/storefrontnext/figma/figma-to-component/index.d.ts +2 -2
- package/dist/tools/storefrontnext/figma/figma-to-component/index.js +7 -7
- package/dist/tools/storefrontnext/figma/generate-component/index.d.ts +2 -2
- package/dist/tools/storefrontnext/figma/generate-component/index.js +2 -2
- package/dist/tools/storefrontnext/figma/map-tokens/index.d.ts +2 -2
- package/dist/tools/storefrontnext/figma/map-tokens/index.js +2 -2
- package/dist/tools/storefrontnext/index.d.ts +7 -7
- package/dist/tools/storefrontnext/page-designer-decorator/analyzer.js +47 -30
- package/dist/tools/storefrontnext/page-designer-decorator/index.d.ts +1 -1
- package/dist/tools/storefrontnext/page-designer-decorator/index.js +2 -2
- package/dist/tools/storefrontnext/page-designer-decorator/templates/decorator-generator.d.ts +1 -1
- package/dist/tools/storefrontnext/page-designer-decorator/templates/decorator-generator.js +1 -1
- package/dist/tools/storefrontnext/sfnext-development-guidelines.d.ts +1 -1
- package/dist/tools/storefrontnext/sfnext-development-guidelines.js +1 -1
- package/dist/tools/storefrontnext/site-theming/index.d.ts +1 -1
- package/dist/tools/storefrontnext/site-theming/index.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -82,9 +82,9 @@ See the [Configuration Guide](https://salesforcecommercecloud.github.io/b2c-deve
|
|
|
82
82
|
|---------|-------|------|
|
|
83
83
|
| CARTRIDGES | `cartridge_deploy` | [toolsets#cartridges](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#cartridges) |
|
|
84
84
|
| MRT | `mrt_bundle_push` | [toolsets#mrt](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#mrt) |
|
|
85
|
-
| SCAPI | `scapi_schemas_list`, `
|
|
86
|
-
| STOREFRONTNEXT | `
|
|
87
|
-
| PWAV3 | `
|
|
85
|
+
| SCAPI | `scapi_schemas_list`, `scapi_custom_apis_get_status`, `scapi_custom_api_generate_scaffold` | [toolsets#scapi](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#scapi) |
|
|
86
|
+
| STOREFRONTNEXT | `sfnext_get_guidelines`, `sfnext_add_page_designer_decorator`, `sfnext_configure_theme`, `sfnext_start_figma_workflow`, `sfnext_analyze_component`, `sfnext_match_tokens_to_theme` | [toolsets#storefrontnext](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#storefrontnext) |
|
|
87
|
+
| PWAV3 | `pwakit_get_guidelines` + SCAPI tools | [toolsets#pwav3](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#pwav3) |
|
|
88
88
|
|
|
89
89
|
### cartridge_deploy
|
|
90
90
|
|
|
@@ -107,62 +107,62 @@ List or fetch SCAPI schemas (standard and custom). [Details](https://salesforcec
|
|
|
107
107
|
- "Use the MCP tool to list all SCAPI schemas."
|
|
108
108
|
- "Use the MCP tool to get the OpenAPI schema for shopper-baskets v1."
|
|
109
109
|
|
|
110
|
-
###
|
|
110
|
+
### scapi_custom_apis_get_status
|
|
111
111
|
|
|
112
|
-
Get custom API endpoint registration status. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/scapi-custom-apis-status)
|
|
112
|
+
Get custom API endpoint registration status. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/scapi-custom-apis-get-status)
|
|
113
113
|
|
|
114
114
|
- "Use the MCP tool to list custom API endpoints on my instance."
|
|
115
115
|
- "Use the MCP tool to show which custom APIs are active vs not registered."
|
|
116
116
|
|
|
117
|
-
###
|
|
117
|
+
### scapi_custom_api_generate_scaffold
|
|
118
118
|
|
|
119
|
-
Generate new custom SCAPI endpoint in a cartridge. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/scapi-custom-api-scaffold)
|
|
119
|
+
Generate new custom SCAPI endpoint in a cartridge. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/scapi-custom-api-generate-scaffold)
|
|
120
120
|
|
|
121
121
|
- "Use the MCP tool to scaffold a new custom API named my-products."
|
|
122
122
|
- "Use the MCP tool to create a custom admin API called customer-trips."
|
|
123
123
|
|
|
124
|
-
###
|
|
124
|
+
### sfnext_get_guidelines
|
|
125
125
|
|
|
126
|
-
Get Storefront Next guidelines and best practices. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/
|
|
126
|
+
Get Storefront Next guidelines and best practices. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-get-guidelines)
|
|
127
127
|
|
|
128
128
|
- "Use the MCP tool to show me critical Storefront Next rules."
|
|
129
129
|
- "Use the MCP tool to get data-fetching and component patterns."
|
|
130
130
|
|
|
131
|
-
###
|
|
131
|
+
### sfnext_add_page_designer_decorator
|
|
132
132
|
|
|
133
|
-
Add Page Designer decorators to components. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/
|
|
133
|
+
Add Page Designer decorators to components. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-add-page-designer-decorator)
|
|
134
134
|
|
|
135
135
|
- "Use the MCP tool to add Page Designer decorators to my component."
|
|
136
136
|
|
|
137
|
-
###
|
|
137
|
+
### sfnext_configure_theme
|
|
138
138
|
|
|
139
|
-
Get theming guidelines, questions, and WCAG color validation for Storefront Next. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/
|
|
139
|
+
Get theming guidelines, questions, and WCAG color validation for Storefront Next. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-configure-theme)
|
|
140
140
|
|
|
141
141
|
- "Use the MCP tool to help me apply my brand colors to my Storefront Next site."
|
|
142
142
|
- "Use the MCP tool to validate my color combinations for accessibility."
|
|
143
143
|
|
|
144
|
-
###
|
|
144
|
+
### sfnext_start_figma_workflow
|
|
145
145
|
|
|
146
|
-
Workflow orchestrator for Figma-to-component conversion. Parses Figma URL, returns step-by-step instructions for subsequent tool calls. Requires external Figma MCP server. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/
|
|
146
|
+
Workflow orchestrator for Figma-to-component conversion. Parses Figma URL, returns step-by-step instructions for subsequent tool calls. Requires external Figma MCP server. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-start-figma-workflow) — [Figma Setup](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/figma-tools-setup)
|
|
147
147
|
|
|
148
148
|
- "Use the MCP tool to convert this Figma design to a Storefront Next component: [Figma URL with node-id]"
|
|
149
149
|
- "Use the MCP tool to create this homepage from the Figma design: [Figma URL with node-id]"
|
|
150
150
|
|
|
151
|
-
###
|
|
151
|
+
### sfnext_analyze_component
|
|
152
152
|
|
|
153
|
-
Analyze
|
|
153
|
+
Analyze design and discovered components to recommend REUSE, EXTEND, or CREATE strategy. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-analyze-component)
|
|
154
154
|
|
|
155
155
|
- "Use the MCP tool to analyze the Figma design and recommend whether to reuse, extend, or create a component."
|
|
156
156
|
|
|
157
|
-
###
|
|
157
|
+
### sfnext_match_tokens_to_theme
|
|
158
158
|
|
|
159
|
-
Map
|
|
159
|
+
Map design tokens to existing theme tokens in app.css with confidence scores and suggestions. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-match-tokens-to-theme)
|
|
160
160
|
|
|
161
161
|
- "Use the MCP tool to map these Figma design tokens to my theme."
|
|
162
162
|
|
|
163
|
-
###
|
|
163
|
+
### pwakit_get_guidelines
|
|
164
164
|
|
|
165
|
-
Get PWA Kit v3 guidelines. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/pwakit-
|
|
165
|
+
Get PWA Kit v3 guidelines. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/pwakit-get-guidelines)
|
|
166
166
|
|
|
167
167
|
- "Use the MCP tool to get PWA Kit development guidelines."
|
|
168
168
|
|
|
@@ -35,7 +35,7 @@ To add a new content page: define a page type and ID in Commerce Cloud, then in
|
|
|
35
35
|
|
|
36
36
|
- **Add a metadata class** with `@Component('typeId', { name, description })` and `@AttributeDefinition()` (and optionally `@AttributeDefinition({ type: 'image' })`, `type: 'url'`, etc.) for each prop you want editable in Page Designer. Use `@RegionDefinition([...])` if the component has nested regions (e.g. a grid with slots).
|
|
37
37
|
- **Implement the React component** so it accepts those props (and strips Page Designer–only props like `component`, `page`, `componentData`, `designMetadata` before spreading to the DOM). If the component needs server data (e.g. products for a carousel), export a `loader({ componentData, context })` and optionally a `fallback` component; the registry calls the loader during `collectComponentDataPromises` and passes resolved data as the `data` prop.
|
|
38
|
-
- **Use the MCP tool `
|
|
38
|
+
- **Use the MCP tool `sfnext_add_page_designer_decorator`** to generate decorators instead of writing them by hand. Example components: `components/hero/index.tsx`, `components/content-card/index.tsx`, `components/product-carousel/index.tsx`.
|
|
39
39
|
|
|
40
40
|
### After changes
|
|
41
41
|
|
|
@@ -50,29 +50,21 @@ To add a new content page: define a page type and ID in Commerce Cloud, then in
|
|
|
50
50
|
|
|
51
51
|
Use the **B2C DX MCP server** for Page Designer work instead of hand-writing decorators and metadata. Configure the B2C DX MCP server in your IDE (e.g. in MCP settings) so these tools are available.
|
|
52
52
|
|
|
53
|
-
### 1. `
|
|
53
|
+
### 1. `sfnext_add_page_designer_decorator` (STOREFRONTNEXT toolset)
|
|
54
54
|
|
|
55
55
|
Adds Page Designer decorators to an existing React component so it can be used in Business Manager. The tool analyzes the component, picks suitable props, infers types (e.g. `*Url`/`*Link` → url, `*Image` → image, `is*`/`show*` → boolean), and generates `@Component('typeId', { name, description })`, `@AttributeDefinition()` on a metadata class, and optionally `@RegionDefinition([...])` for nested regions. It skips complex or UI-only props (e.g. className, style, callbacks).
|
|
56
56
|
|
|
57
57
|
- **Auto mode** (fast): Ask in your IDE: *"Add Page Designer support to [ComponentName] with autoMode"*. The tool runs in one turn with no prompts.
|
|
58
58
|
- **Interactive mode** (control): Ask *"Add Page Designer support to [ComponentName]"* and answer questions about typeId, which props to expose, types, and optional nested regions.
|
|
59
59
|
|
|
60
|
-
### 2. `
|
|
60
|
+
### 2. `cartridge_deploy` (CARTRIDGES toolset)
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- **Full scan**: Run with no file list to process the whole project.
|
|
65
|
-
- **Incremental**: Pass specific file paths to regenerate only those components.
|
|
66
|
-
- **Dry run**: Use `dryRun: true` to see what would be generated without writing files.
|
|
67
|
-
|
|
68
|
-
### 3. `cartridge_deploy` (CARTRIDGES toolset)
|
|
69
|
-
|
|
70
|
-
Packages the cartridge, uploads it to Commerce Cloud via WebDAV, and unpacks it on the server. Requires Commerce Cloud credentials (e.g. `dw.json` or explicit config). Use after generating metadata so the new/updated metadata is available in Business Manager.
|
|
62
|
+
Packages the cartridge, uploads it to Commerce Cloud via WebDAV, and unpacks it on the server. **Run `pnpm generate:cartridge` or `pnpm build` before `cartridge_deploy`.** Requires Commerce Cloud credentials (e.g. `dw.json` or explicit config). Use after generating metadata so the new/updated metadata is available in Business Manager.
|
|
71
63
|
|
|
72
64
|
### Typical workflow
|
|
73
65
|
|
|
74
|
-
1. **`
|
|
75
|
-
2.
|
|
66
|
+
1. **`sfnext_add_page_designer_decorator`** — Add decorators to the component (use autoMode for a quick first pass).
|
|
67
|
+
2. **Rebuild** — The static registry is auto-generated at build time by the staticRegistry Vite plugin.
|
|
76
68
|
3. **`cartridge_deploy`** — Deploy to Commerce Cloud so merchants can use the component in Business Manager.
|
|
77
69
|
|
|
78
70
|
## Best Practices
|
|
@@ -81,6 +73,6 @@ Packages the cartridge, uploads it to Commerce Cloud via WebDAV, and unpacks it
|
|
|
81
73
|
2. **Use registry for components**: Register all Page Designer components with proper `typeId`
|
|
82
74
|
3. **Handle design mode**: Adapt UI when `pageDesignerMode` is `'EDIT'` or `'PREVIEW'`
|
|
83
75
|
4. **Rebuild after registry changes**: Static registry is generated at build time
|
|
84
|
-
5. **Use MCP tools**: Leverage `
|
|
76
|
+
5. **Use MCP tools**: Leverage `sfnext_add_page_designer_decorator` for faster development
|
|
85
77
|
|
|
86
78
|
**Reference:** See README.md for complete Page Designer documentation and MCP tool setup.
|
|
@@ -196,7 +196,7 @@ import { Card } from '@/components/ui/card';
|
|
|
196
196
|
|
|
197
197
|
## 🔍 Get Detailed Guidelines
|
|
198
198
|
|
|
199
|
-
Use the `
|
|
199
|
+
Use the `sfnext_get_guidelines` MCP tool with specific sections:
|
|
200
200
|
|
|
201
201
|
```json
|
|
202
202
|
{
|
package/dist/commands/mcp.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export default class McpServerCommand extends BaseCommand<typeof McpServerComman
|
|
|
81
81
|
* 3. dw.json file (via --config flag or auto-discovered from --project-directory)
|
|
82
82
|
* 4. ~/.mobify file (for MRT API key)
|
|
83
83
|
*/
|
|
84
|
-
protected loadConfiguration(): ResolvedB2CConfig
|
|
84
|
+
protected loadConfiguration(): Promise<ResolvedB2CConfig>;
|
|
85
85
|
/**
|
|
86
86
|
* Loads configuration and creates a new Services instance.
|
|
87
87
|
*
|
|
@@ -91,7 +91,7 @@ export default class McpServerCommand extends BaseCommand<typeof McpServerComman
|
|
|
91
91
|
*
|
|
92
92
|
* @returns A new Services instance with loaded configuration
|
|
93
93
|
*/
|
|
94
|
-
protected loadServices(): Services
|
|
94
|
+
protected loadServices(): Promise<Services>;
|
|
95
95
|
/**
|
|
96
96
|
* Main entry point - starts the MCP server.
|
|
97
97
|
*
|
package/dist/commands/mcp.js
CHANGED
|
@@ -236,7 +236,7 @@ export default class McpServerCommand extends BaseCommand {
|
|
|
236
236
|
* 3. dw.json file (via --config flag or auto-discovered from --project-directory)
|
|
237
237
|
* 4. ~/.mobify file (for MRT API key)
|
|
238
238
|
*/
|
|
239
|
-
loadConfiguration() {
|
|
239
|
+
async loadConfiguration() {
|
|
240
240
|
const mrt = extractMrtFlags(this.flags);
|
|
241
241
|
const options = {
|
|
242
242
|
...this.getBaseConfigOptions(),
|
|
@@ -258,8 +258,8 @@ export default class McpServerCommand extends BaseCommand {
|
|
|
258
258
|
*
|
|
259
259
|
* @returns A new Services instance with loaded configuration
|
|
260
260
|
*/
|
|
261
|
-
loadServices() {
|
|
262
|
-
const config = this.loadConfiguration();
|
|
261
|
+
async loadServices() {
|
|
262
|
+
const config = await this.loadConfiguration();
|
|
263
263
|
return Services.fromResolvedConfig(config);
|
|
264
264
|
}
|
|
265
265
|
/**
|
package/dist/registry.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type ToolRegistry = Record<Toolset, McpTool[]>;
|
|
|
14
14
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
15
15
|
* @returns Complete tool registry
|
|
16
16
|
*/
|
|
17
|
-
export declare function createToolRegistry(loadServices: () => Services): ToolRegistry;
|
|
17
|
+
export declare function createToolRegistry(loadServices: () => Promise<Services> | Services): ToolRegistry;
|
|
18
18
|
/**
|
|
19
19
|
* Register tools with the MCP server based on startup flags.
|
|
20
20
|
*
|
|
@@ -34,4 +34,4 @@ export declare function createToolRegistry(loadServices: () => Services): ToolRe
|
|
|
34
34
|
* @param server - B2CDxMcpServer instance
|
|
35
35
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
36
36
|
*/
|
|
37
|
-
export declare function registerToolsets(flags: StartupFlags, server: B2CDxMcpServer, loadServices: () => Services): Promise<void>;
|
|
37
|
+
export declare function registerToolsets(flags: StartupFlags, server: B2CDxMcpServer, loadServices: () => Promise<Services> | Services): Promise<void>;
|
package/dist/tools/adapter.d.ts
CHANGED
|
@@ -206,4 +206,4 @@ export declare function jsonResult(data: unknown, indent?: number): ToolResult;
|
|
|
206
206
|
* }, loadServices);
|
|
207
207
|
* ```
|
|
208
208
|
*/
|
|
209
|
-
export declare function createToolAdapter<TInput, TOutput>(options: ToolAdapterOptions<TInput, TOutput>, loadServices: () => Services): McpTool;
|
|
209
|
+
export declare function createToolAdapter<TInput, TOutput>(options: ToolAdapterOptions<TInput, TOutput>, loadServices: () => Promise<Services> | Services): McpTool;
|
package/dist/tools/adapter.js
CHANGED
|
@@ -187,7 +187,7 @@ export function createToolAdapter(options, loadServices) {
|
|
|
187
187
|
const args = parseResult.data;
|
|
188
188
|
try {
|
|
189
189
|
// 2. Load Services to get fresh configuration (re-reads config files)
|
|
190
|
-
const services = loadServices();
|
|
190
|
+
const services = await loadServices();
|
|
191
191
|
// 3. Get B2CInstance if required (loaded on each call)
|
|
192
192
|
let b2cInstance;
|
|
193
193
|
if (requiresInstance) {
|
|
@@ -18,5 +18,5 @@ interface CartridgeToolInjections {
|
|
|
18
18
|
* @param injections - Optional dependency injections for testing
|
|
19
19
|
* @returns Array of MCP tools
|
|
20
20
|
*/
|
|
21
|
-
export declare function createCartridgesTools(loadServices: () => Services, injections?: CartridgeToolInjections): McpTool[];
|
|
21
|
+
export declare function createCartridgesTools(loadServices: () => Promise<Services> | Services, injections?: CartridgeToolInjections): McpTool[];
|
|
22
22
|
export {};
|
|
@@ -21,5 +21,5 @@ interface MrtToolInjections {
|
|
|
21
21
|
* @param injections - Optional dependency injections for testing
|
|
22
22
|
* @returns Array of MCP tools
|
|
23
23
|
*/
|
|
24
|
-
export declare function createMrtTools(loadServices: () => Services, injections?: MrtToolInjections): McpTool[];
|
|
24
|
+
export declare function createMrtTools(loadServices: () => Promise<Services> | Services, injections?: MrtToolInjections): McpTool[];
|
|
25
25
|
export {};
|
|
@@ -19,4 +19,4 @@ import type { Services } from '../../services.js';
|
|
|
19
19
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
20
20
|
* @returns Array of MCP tools
|
|
21
21
|
*/
|
|
22
|
-
export declare function createPwav3Tools(loadServices: () => Services): McpTool[];
|
|
22
|
+
export declare function createPwav3Tools(loadServices: () => Promise<Services> | Services): McpTool[];
|
|
@@ -6,4 +6,4 @@ import type { Services } from '../../services.js';
|
|
|
6
6
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
7
7
|
* @returns The configured MCP tool
|
|
8
8
|
*/
|
|
9
|
-
export declare function createDeveloperGuidelinesTool(loadServices: () => Services): McpTool;
|
|
9
|
+
export declare function createDeveloperGuidelinesTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -95,7 +95,7 @@ const DEFAULT_SECTIONS = ['quick-reference', 'components', 'data-fetching', 'rou
|
|
|
95
95
|
*/
|
|
96
96
|
export function createDeveloperGuidelinesTool(loadServices) {
|
|
97
97
|
return createToolAdapter({
|
|
98
|
-
name: '
|
|
98
|
+
name: 'pwakit_get_guidelines',
|
|
99
99
|
description: 'ESSENTIAL FIRST STEP for PWA Kit v3 development. Returns critical architecture rules, coding standards, and best practices. ' +
|
|
100
100
|
'Use this tool FIRST before writing any PWA Kit code to understand non-negotiable patterns for React components, ' +
|
|
101
101
|
'data fetching, routing, configuration, and framework constraints. Returns comprehensive guidelines by default (quick-reference + key sections); ' +
|
|
@@ -14,4 +14,4 @@ import type { Services } from '../../services.js';
|
|
|
14
14
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
15
15
|
* @returns Array of MCP tools
|
|
16
16
|
*/
|
|
17
|
-
export declare function createScapiTools(loadServices: () => Services): McpTool[];
|
|
17
|
+
export declare function createScapiTools(loadServices: () => Promise<Services> | Services): McpTool[];
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { createScapiSchemasListTool } from './scapi-schemas-list.js';
|
|
7
|
-
import { createScapiCustomApisStatusTool } from './scapi-custom-apis-status.js';
|
|
8
|
-
import { createScaffoldCustomApiTool } from './scapi-custom-api-scaffold.js';
|
|
7
|
+
import { createScapiCustomApisStatusTool } from './scapi-custom-apis-get-status.js';
|
|
8
|
+
import { createScaffoldCustomApiTool } from './scapi-custom-api-generate-scaffold.js';
|
|
9
9
|
/**
|
|
10
10
|
* Creates all tools for the SCAPI toolset.
|
|
11
11
|
*
|
package/dist/tools/scapi/{scapi-custom-api-scaffold.d.ts → scapi-custom-api-generate-scaffold.d.ts}
RENAMED
|
@@ -9,7 +9,7 @@ export interface ScaffoldCustomApiExecuteOverrides {
|
|
|
9
9
|
resolveScaffoldParameters?: (scaffold: Scaffold, opts: ResolveParametersOptions) => Promise<ResolvedParameters>;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Input schema for
|
|
12
|
+
* Input schema for scapi_custom_api_generate_scaffold tool.
|
|
13
13
|
* Parameters match the custom-api scaffold: apiName, apiType, cartridgeName, etc.
|
|
14
14
|
*/
|
|
15
15
|
interface ScaffoldCustomApiInput {
|
|
@@ -27,7 +27,7 @@ interface ScaffoldCustomApiInput {
|
|
|
27
27
|
outputDir?: string;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Output schema for
|
|
30
|
+
* Output schema for scapi_custom_api_generate_scaffold tool.
|
|
31
31
|
*/
|
|
32
32
|
interface ScaffoldCustomApiOutput {
|
|
33
33
|
scaffold: string;
|
|
@@ -47,7 +47,7 @@ interface ScaffoldCustomApiOutput {
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function executeScaffoldCustomApi(args: ScaffoldCustomApiInput, services: Services, overrides?: ScaffoldCustomApiExecuteOverrides): Promise<ScaffoldCustomApiOutput>;
|
|
49
49
|
/**
|
|
50
|
-
* Creates the
|
|
50
|
+
* Creates the scapi_custom_api_generate_scaffold tool.
|
|
51
51
|
*
|
|
52
52
|
* Uses @salesforce/b2c-tooling-sdk scaffold: registry, resolveScaffoldParameters,
|
|
53
53
|
* resolveOutputDirectory, generateFromScaffold. cartridgeName must be a cartridge
|
|
@@ -56,5 +56,5 @@ export declare function executeScaffoldCustomApi(args: ScaffoldCustomApiInput, s
|
|
|
56
56
|
* @param loadServices - Function that returns Services (used by adapter on each call).
|
|
57
57
|
* @param executeOverrides - Optional overrides for testing (getScaffold, resolveScaffoldParameters).
|
|
58
58
|
*/
|
|
59
|
-
export declare function createScaffoldCustomApiTool(loadServices: () => Services, executeOverrides?: ScaffoldCustomApiExecuteOverrides): McpTool;
|
|
59
|
+
export declare function createScaffoldCustomApiTool(loadServices: () => Promise<Services> | Services, executeOverrides?: ScaffoldCustomApiExecuteOverrides): McpTool;
|
|
60
60
|
export {};
|
package/dist/tools/scapi/{scapi-custom-api-scaffold.js → scapi-custom-api-generate-scaffold.js}
RENAMED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* SCAPI Custom API Scaffold tool.
|
|
7
|
+
* SCAPI Custom API Generate Scaffold tool.
|
|
8
8
|
*
|
|
9
9
|
* Generates a new custom SCAPI endpoint using the SDK's custom-api scaffold
|
|
10
10
|
* (schema.yaml, api.json, script.js).
|
|
11
11
|
*
|
|
12
|
-
* @module tools/scapi/scapi-custom-api-scaffold
|
|
12
|
+
* @module tools/scapi/scapi-custom-api-generate-scaffold
|
|
13
13
|
*/
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
import { createToolAdapter, jsonResult, errorResult } from '../adapter.js';
|
|
@@ -122,7 +122,7 @@ export async function executeScaffoldCustomApi(args, services, overrides) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
|
-
* Creates the
|
|
125
|
+
* Creates the scapi_custom_api_generate_scaffold tool.
|
|
126
126
|
*
|
|
127
127
|
* Uses @salesforce/b2c-tooling-sdk scaffold: registry, resolveScaffoldParameters,
|
|
128
128
|
* resolveOutputDirectory, generateFromScaffold. cartridgeName must be a cartridge
|
|
@@ -133,7 +133,7 @@ export async function executeScaffoldCustomApi(args, services, overrides) {
|
|
|
133
133
|
*/
|
|
134
134
|
export function createScaffoldCustomApiTool(loadServices, executeOverrides) {
|
|
135
135
|
return createToolAdapter({
|
|
136
|
-
name: '
|
|
136
|
+
name: 'scapi_custom_api_generate_scaffold',
|
|
137
137
|
description: `Generate a new custom SCAPI endpoint (OAS 3.0 schema, api.json, script.js) in an existing cartridge. \
|
|
138
138
|
Required: apiName (kebab-case). Optional: cartridgeName (defaults to first cartridge found in project), apiType (shopper|admin) default to shopper, \
|
|
139
139
|
apiDescription, projectRoot, outputDir.`,
|
|
@@ -172,4 +172,4 @@ apiDescription, projectRoot, outputDir.`,
|
|
|
172
172
|
},
|
|
173
173
|
}, loadServices);
|
|
174
174
|
}
|
|
175
|
-
//# sourceMappingURL=scapi-custom-api-scaffold.js.map
|
|
175
|
+
//# sourceMappingURL=scapi-custom-api-generate-scaffold.js.map
|
package/dist/tools/scapi/{scapi-custom-apis-status.d.ts → scapi-custom-apis-get-status.d.ts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Services } from '../../services.js';
|
|
2
2
|
import type { McpTool } from '../../utils/index.js';
|
|
3
3
|
/**
|
|
4
|
-
* Creates the
|
|
4
|
+
* Creates the scapi_custom_apis_get_status tool.
|
|
5
5
|
*
|
|
6
6
|
* Mirrors CLI: b2c scapi custom status. All flags supported; agent chooses what to use.
|
|
7
7
|
* See: https://salesforcecommercecloud.github.io/b2c-developer-tooling/cli/custom-apis.html#b2c-scapi-custom-status
|
|
8
8
|
*/
|
|
9
|
-
export declare function createScapiCustomApisStatusTool(loadServices: () => Services): McpTool;
|
|
9
|
+
export declare function createScapiCustomApisStatusTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Mirrors CLI: b2c scapi custom status. All CLI flags are supported; let the agent decide what to use.
|
|
10
10
|
* Returns raw endpoints from the API (no roll-up). Remote only.
|
|
11
11
|
*
|
|
12
|
-
* @module tools/scapi/scapi-custom-apis-status
|
|
12
|
+
* @module tools/scapi/scapi-custom-apis-get-status
|
|
13
13
|
*/
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
import { createToolAdapter, jsonResult } from '../adapter.js';
|
|
@@ -74,14 +74,14 @@ function buildResponse(withMeta, args, columnList, activeCodeVersion) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
* Creates the
|
|
77
|
+
* Creates the scapi_custom_apis_get_status tool.
|
|
78
78
|
*
|
|
79
79
|
* Mirrors CLI: b2c scapi custom status. All flags supported; agent chooses what to use.
|
|
80
80
|
* See: https://salesforcecommercecloud.github.io/b2c-developer-tooling/cli/custom-apis.html#b2c-scapi-custom-status
|
|
81
81
|
*/
|
|
82
82
|
export function createScapiCustomApisStatusTool(loadServices) {
|
|
83
83
|
return createToolAdapter({
|
|
84
|
-
name: '
|
|
84
|
+
name: 'scapi_custom_apis_get_status',
|
|
85
85
|
description: `List Custom SCAPI endpoint registration status (active/not_registered). Returns one row per endpoint per site. For schemas, use scapi_schemas_list with apiFamily: "custom".
|
|
86
86
|
|
|
87
87
|
Use cases: Check endpoint status, verify deployment, get per-site details. Use status: "active" to filter, groupBy: "site" to group, columns: "field1,field2" for specific fields, or omit columns for defaults.
|
|
@@ -149,4 +149,4 @@ CLI: b2c scapi custom status`,
|
|
|
149
149
|
formatOutput: (output) => jsonResult(output),
|
|
150
150
|
}, loadServices);
|
|
151
151
|
}
|
|
152
|
-
//# sourceMappingURL=scapi-custom-apis-status.js.map
|
|
152
|
+
//# sourceMappingURL=scapi-custom-apis-get-status.js.map
|
|
@@ -9,4 +9,4 @@ import type { McpTool } from '../../utils/index.js';
|
|
|
9
9
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
10
10
|
* @returns MCP tool for listing/fetching SCAPI schemas
|
|
11
11
|
*/
|
|
12
|
-
export declare function createScapiSchemasListTool(loadServices: () => Services): McpTool;
|
|
12
|
+
export declare function createScapiSchemasListTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -187,7 +187,7 @@ function getAvailableFilters(schemas) {
|
|
|
187
187
|
export function createScapiSchemasListTool(loadServices) {
|
|
188
188
|
return createToolAdapter({
|
|
189
189
|
name: 'scapi_schemas_list',
|
|
190
|
-
description: `List or fetch SCAPI schema metadata and OpenAPI specs for standard SCAPI (Shop/Admin/Shopper) and custom APIs (apiFamily: "custom"). For endpoint registration status, use
|
|
190
|
+
description: `List or fetch SCAPI schema metadata and OpenAPI specs for standard SCAPI (Shop/Admin/Shopper) and custom APIs (apiFamily: "custom"). For endpoint registration status, use scapi_custom_apis_get_status.
|
|
191
191
|
|
|
192
192
|
**Modes:**
|
|
193
193
|
- **List (discovery):** Omit includeSchemas or any identifier. Returns metadata: schemas[], total, availableApiFamilies/Names/Versions.
|
|
@@ -34,9 +34,9 @@ export interface WorkflowConfig {
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function generateWorkflowResponse(figmaUrl: string, workflowFilePath?: string): string;
|
|
36
36
|
/**
|
|
37
|
-
* Creates the
|
|
37
|
+
* Creates the sfnext_start_figma_workflow MCP tool.
|
|
38
38
|
*
|
|
39
39
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
40
40
|
* @returns MCP tool for workflow orchestration
|
|
41
41
|
*/
|
|
42
|
-
export declare function createFigmaToComponentTool(loadServices: () => Services): McpTool;
|
|
42
|
+
export declare function createFigmaToComponentTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -224,7 +224,7 @@ function formatNextStepsReminder() {
|
|
|
224
224
|
|
|
225
225
|
This tool has provided workflow instructions only. You MUST now execute ALL steps below.
|
|
226
226
|
|
|
227
|
-
**EXPECTED FINAL OUTPUT:** A recommendation with confidence score from
|
|
227
|
+
**EXPECTED FINAL OUTPUT:** A recommendation with confidence score from sfnext_analyze_component tool AND a token mapping summary from sfnext_match_tokens_to_theme tool.
|
|
228
228
|
|
|
229
229
|
### Step 1: Fetch Figma Design Data (Parallel Calls)
|
|
230
230
|
Call these Figma MCP tools with the parameters above:
|
|
@@ -240,7 +240,7 @@ Use your tools to find existing components:
|
|
|
240
240
|
- Score each match (0-100) based on similarity
|
|
241
241
|
|
|
242
242
|
### Step 3: Analyze Component Strategy (CRITICAL - DO NOT SKIP)
|
|
243
|
-
You MUST call \`
|
|
243
|
+
You MUST call \`sfnext_analyze_component\` tool with:
|
|
244
244
|
- figmaMetadata (from step 1, or empty string if not fetched)
|
|
245
245
|
- figmaCode (from step 1)
|
|
246
246
|
- componentName (extracted from Figma)
|
|
@@ -249,14 +249,14 @@ You MUST call \`generate_component\` tool with:
|
|
|
249
249
|
This tool returns the recommendation with confidence score that MUST be shown to the user.
|
|
250
250
|
|
|
251
251
|
### Step 4: Map Design Tokens (CRITICAL - DO NOT SKIP)
|
|
252
|
-
You MUST call \`
|
|
252
|
+
You MUST call \`sfnext_match_tokens_to_theme\` tool with tokens extracted from Figma design.
|
|
253
253
|
|
|
254
254
|
This tool returns the token mapping summary that MUST be shown to the user.
|
|
255
255
|
|
|
256
256
|
### Step 5: Implement
|
|
257
257
|
After showing the recommendation and token mapping to the user, wait for approval then implement the code changes. Use the downloaded asset paths from Step 1 for any img src or imageUrl props—do not use placeholder paths.
|
|
258
258
|
|
|
259
|
-
**DO NOT STOP until you have called
|
|
259
|
+
**DO NOT STOP until you have called sfnext_analyze_component AND sfnext_match_tokens_to_theme and shown their outputs to the user.**
|
|
260
260
|
`;
|
|
261
261
|
}
|
|
262
262
|
function formatErrorResponse(details) {
|
|
@@ -297,20 +297,20 @@ export function generateWorkflowResponse(figmaUrl, workflowFilePath) {
|
|
|
297
297
|
return response;
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
300
|
-
* Creates the
|
|
300
|
+
* Creates the sfnext_start_figma_workflow MCP tool.
|
|
301
301
|
*
|
|
302
302
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
303
303
|
* @returns MCP tool for workflow orchestration
|
|
304
304
|
*/
|
|
305
305
|
export function createFigmaToComponentTool(loadServices) {
|
|
306
306
|
return createToolAdapter({
|
|
307
|
-
name: '
|
|
307
|
+
name: 'sfnext_start_figma_workflow',
|
|
308
308
|
description: 'WORKFLOW ORCHESTRATOR: Call this tool FIRST when converting Figma designs. ' +
|
|
309
309
|
'Parses Figma URL to extract fileKey and nodeId, returns step-by-step workflow instructions ' +
|
|
310
310
|
'and parameters for subsequent tool calls. ' +
|
|
311
311
|
'CRITICAL: This is only the FIRST step. After calling this tool, you MUST continue executing ' +
|
|
312
312
|
'the complete workflow: 1) Call Figma MCP tools, 2) Discover similar components, ' +
|
|
313
|
-
'3) Call
|
|
313
|
+
'3) Call sfnext_analyze_component tool, 4) Call sfnext_match_tokens_to_theme tool, ' +
|
|
314
314
|
'5) Show both outputs to the user then implement the recommended approach.',
|
|
315
315
|
toolsets: ['STOREFRONTNEXT'],
|
|
316
316
|
isGA: false,
|
|
@@ -106,9 +106,9 @@ export interface ComponentAnalysisResult {
|
|
|
106
106
|
*/
|
|
107
107
|
export declare function generateComponentRecommendation(input: GenerateComponentInput): string;
|
|
108
108
|
/**
|
|
109
|
-
* Creates the
|
|
109
|
+
* Creates the sfnext_analyze_component MCP tool.
|
|
110
110
|
*
|
|
111
111
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
112
112
|
* @returns MCP tool for component analysis and recommendation
|
|
113
113
|
*/
|
|
114
|
-
export declare function createGenerateComponentTool(loadServices: () => Services): McpTool;
|
|
114
|
+
export declare function createGenerateComponentTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -68,14 +68,14 @@ export function generateComponentRecommendation(input) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
* Creates the
|
|
71
|
+
* Creates the sfnext_analyze_component MCP tool.
|
|
72
72
|
*
|
|
73
73
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
74
74
|
* @returns MCP tool for component analysis and recommendation
|
|
75
75
|
*/
|
|
76
76
|
export function createGenerateComponentTool(loadServices) {
|
|
77
77
|
return createToolAdapter({
|
|
78
|
-
name: '
|
|
78
|
+
name: 'sfnext_analyze_component',
|
|
79
79
|
description: 'Analyzes Figma design and discovered components to recommend component generation strategy. ' +
|
|
80
80
|
'Workflow: 1) Discover similar components using Glob/Grep/Read tools, ' +
|
|
81
81
|
'2) Call this tool with the discoveredComponents parameter, ' +
|
|
@@ -53,9 +53,9 @@ export type MapTokensToThemeInput = z.infer<typeof mapTokensToThemeSchema>;
|
|
|
53
53
|
*/
|
|
54
54
|
export declare function mapFigmaTokensToTheme(args: MapTokensToThemeInput, workspaceRoot?: string): string;
|
|
55
55
|
/**
|
|
56
|
-
* Creates the
|
|
56
|
+
* Creates the sfnext_match_tokens_to_theme MCP tool.
|
|
57
57
|
*
|
|
58
58
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
59
59
|
* @returns MCP tool for token mapping
|
|
60
60
|
*/
|
|
61
|
-
export declare function createMapTokensToThemeTool(loadServices: () => Services): McpTool;
|
|
61
|
+
export declare function createMapTokensToThemeTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -208,14 +208,14 @@ export function mapFigmaTokensToTheme(args, workspaceRoot) {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
|
-
* Creates the
|
|
211
|
+
* Creates the sfnext_match_tokens_to_theme MCP tool.
|
|
212
212
|
*
|
|
213
213
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
214
214
|
* @returns MCP tool for token mapping
|
|
215
215
|
*/
|
|
216
216
|
export function createMapTokensToThemeTool(loadServices) {
|
|
217
217
|
return createToolAdapter({
|
|
218
|
-
name: '
|
|
218
|
+
name: 'sfnext_match_tokens_to_theme',
|
|
219
219
|
description: 'Maps Figma design tokens to existing StorefrontNext theme tokens in app.css. ' +
|
|
220
220
|
'Analyzes Figma design tokens (colors, spacing, radius, etc.) and finds exact matches, ' +
|
|
221
221
|
'provides fuzzy matches with confidence scores, suggests new token names for unmatched values, ' +
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* This toolset provides MCP tools for Storefront Next development.
|
|
5
5
|
*
|
|
6
6
|
* **Implemented Tools:**
|
|
7
|
-
* - `
|
|
8
|
-
* - `
|
|
9
|
-
* - `
|
|
10
|
-
* - `
|
|
11
|
-
* - `
|
|
12
|
-
* - `
|
|
7
|
+
* - `sfnext_get_guidelines` - Get development guidelines and best practices
|
|
8
|
+
* - `sfnext_add_page_designer_decorator` - Add Page Designer decorators to React components
|
|
9
|
+
* - `sfnext_configure_theme` - Get theming guidelines, questions, and validation
|
|
10
|
+
* - `sfnext_start_figma_workflow` - Convert Figma to components
|
|
11
|
+
* - `sfnext_analyze_component` - Analyze design and recommend REUSE/EXTEND/CREATE
|
|
12
|
+
* - `sfnext_match_tokens_to_theme` - Match design tokens to theme
|
|
13
13
|
*
|
|
14
14
|
* Note: mrt_bundle_push is defined in the MRT toolset and appears in STOREFRONTNEXT.
|
|
15
15
|
*
|
|
@@ -27,4 +27,4 @@ import type { Services } from '../../services.js';
|
|
|
27
27
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
28
28
|
* @returns Array of MCP tools
|
|
29
29
|
*/
|
|
30
|
-
export declare function createStorefrontNextTools(loadServices: () => Services): McpTool[];
|
|
30
|
+
export declare function createStorefrontNextTools(loadServices: () => Promise<Services> | Services): McpTool[];
|
|
@@ -7,6 +7,21 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import { globSync } from 'glob';
|
|
9
9
|
import { Project, InterfaceDeclaration, PropertySignature } from 'ts-morph';
|
|
10
|
+
/**
|
|
11
|
+
* Lazily-initialized, reusable ts-morph Project for component analysis.
|
|
12
|
+
* Creating a new Project (~40ms) on every analyzeComponent call is expensive;
|
|
13
|
+
* reusing one with an in-memory file system avoids repeated TypeScript compiler init.
|
|
14
|
+
*/
|
|
15
|
+
let cachedProject;
|
|
16
|
+
function getProject() {
|
|
17
|
+
if (!cachedProject) {
|
|
18
|
+
cachedProject = new Project({
|
|
19
|
+
useInMemoryFileSystem: true,
|
|
20
|
+
skipAddingFilesFromTsConfig: true,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return cachedProject;
|
|
24
|
+
}
|
|
10
25
|
// ============================================================================
|
|
11
26
|
// TYPE INFERENCE
|
|
12
27
|
// ============================================================================
|
|
@@ -279,43 +294,45 @@ function parseComponentFile(filePath) {
|
|
|
279
294
|
filePath,
|
|
280
295
|
};
|
|
281
296
|
}
|
|
282
|
-
const project =
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
297
|
+
const project = getProject();
|
|
298
|
+
const sourceFile = project.createSourceFile(filePath, content, { overwrite: true });
|
|
299
|
+
try {
|
|
300
|
+
const interfaces = sourceFile.getInterfaces();
|
|
301
|
+
const propsInterface = interfaces.find((i) => i.getName().includes('Props'));
|
|
302
|
+
if (!propsInterface) {
|
|
303
|
+
return {
|
|
304
|
+
componentName: extractComponentName(content),
|
|
305
|
+
interfaceName: null,
|
|
306
|
+
hasDecorators: false,
|
|
307
|
+
props: [],
|
|
308
|
+
exportType: detectExportType(content),
|
|
309
|
+
filePath,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
const props = propsInterface.getProperties().map((prop) => {
|
|
313
|
+
const name = prop.getName();
|
|
314
|
+
const type = prop.getType().getText();
|
|
315
|
+
const optional = prop.hasQuestionToken();
|
|
316
|
+
return {
|
|
317
|
+
name,
|
|
318
|
+
type,
|
|
319
|
+
optional,
|
|
320
|
+
isComplex: isComplexType(type),
|
|
321
|
+
isUIOnly: isUIOnlyProp(name),
|
|
322
|
+
};
|
|
323
|
+
});
|
|
290
324
|
return {
|
|
291
325
|
componentName: extractComponentName(content),
|
|
292
|
-
interfaceName:
|
|
326
|
+
interfaceName: propsInterface.getName(),
|
|
293
327
|
hasDecorators: false,
|
|
294
|
-
props
|
|
328
|
+
props,
|
|
295
329
|
exportType: detectExportType(content),
|
|
296
330
|
filePath,
|
|
297
331
|
};
|
|
298
332
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const optional = prop.hasQuestionToken();
|
|
303
|
-
return {
|
|
304
|
-
name,
|
|
305
|
-
type,
|
|
306
|
-
optional,
|
|
307
|
-
isComplex: isComplexType(type),
|
|
308
|
-
isUIOnly: isUIOnlyProp(name),
|
|
309
|
-
};
|
|
310
|
-
});
|
|
311
|
-
return {
|
|
312
|
-
componentName: extractComponentName(content),
|
|
313
|
-
interfaceName: propsInterface.getName(),
|
|
314
|
-
hasDecorators: false,
|
|
315
|
-
props,
|
|
316
|
-
exportType: detectExportType(content),
|
|
317
|
-
filePath,
|
|
318
|
-
};
|
|
333
|
+
finally {
|
|
334
|
+
project.removeSourceFile(sourceFile);
|
|
335
|
+
}
|
|
319
336
|
}
|
|
320
337
|
// ============================================================================
|
|
321
338
|
// COMPONENT ANALYZER
|
|
@@ -249,4 +249,4 @@ export type PageDesignerDecoratorInput = z.infer<typeof pageDesignerDecoratorSch
|
|
|
249
249
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
250
250
|
* @returns The configured MCP tool
|
|
251
251
|
*/
|
|
252
|
-
export declare function createPageDesignerDecoratorTool(loadServices: () => Services): McpTool;
|
|
252
|
+
export declare function createPageDesignerDecoratorTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -527,7 +527,7 @@ function handleAutoMode(args, workspaceRoot) {
|
|
|
527
527
|
*/
|
|
528
528
|
export function createPageDesignerDecoratorTool(loadServices) {
|
|
529
529
|
return {
|
|
530
|
-
name: '
|
|
530
|
+
name: 'sfnext_add_page_designer_decorator',
|
|
531
531
|
description: 'Adds Page Designer decorators (@Component, @AttributeDefinition, @RegionDefinition) to React components. ' +
|
|
532
532
|
'Two modes: autoMode=true for quick setup with defaults, or interactive mode via conversationContext.step. ' +
|
|
533
533
|
'Component discovery uses --project-directory flag or SFCC_PROJECT_DIRECTORY env var. ' +
|
|
@@ -542,7 +542,7 @@ export function createPageDesignerDecoratorTool(loadServices) {
|
|
|
542
542
|
const validatedArgs = pageDesignerDecoratorSchema.parse(args);
|
|
543
543
|
// Use projectDirectory from services to ensure we search in the correct project directory
|
|
544
544
|
// This prevents searches in the home folder when MCP clients spawn servers from ~
|
|
545
|
-
const services = loadServices();
|
|
545
|
+
const services = await loadServices();
|
|
546
546
|
const workspaceRoot = services.resolveWithProjectDirectory();
|
|
547
547
|
if (validatedArgs.autoMode === undefined && !validatedArgs.conversationContext) {
|
|
548
548
|
const fullPath = resolveComponent(validatedArgs.component, workspaceRoot, validatedArgs.searchPaths);
|
package/dist/tools/storefrontnext/page-designer-decorator/templates/decorator-generator.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface MetadataContext {
|
|
|
67
67
|
* **Generated code must be:**
|
|
68
68
|
* - Added to the component file (after imports, before component)
|
|
69
69
|
* - Compiled with TypeScript
|
|
70
|
-
* - Used by
|
|
70
|
+
* - Used by the staticRegistry Vite plugin to generate the component registry
|
|
71
71
|
*
|
|
72
72
|
* @param context - Complete metadata context
|
|
73
73
|
* @returns TypeScript code string ready to paste into component file
|
|
@@ -284,7 +284,7 @@ function generateRegionDefinition(context) {
|
|
|
284
284
|
* **Generated code must be:**
|
|
285
285
|
* - Added to the component file (after imports, before component)
|
|
286
286
|
* - Compiled with TypeScript
|
|
287
|
-
* - Used by
|
|
287
|
+
* - Used by the staticRegistry Vite plugin to generate the component registry
|
|
288
288
|
*
|
|
289
289
|
* @param context - Complete metadata context
|
|
290
290
|
* @returns TypeScript code string ready to paste into component file
|
|
@@ -6,4 +6,4 @@ import type { Services } from '../../services.js';
|
|
|
6
6
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
7
7
|
* @returns The configured MCP tool
|
|
8
8
|
*/
|
|
9
|
-
export declare function createDeveloperGuidelinesTool(loadServices: () => Services): McpTool;
|
|
9
|
+
export declare function createDeveloperGuidelinesTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -82,7 +82,7 @@ const DEFAULT_SECTIONS = ['quick-reference', 'data-fetching', 'components', 'tes
|
|
|
82
82
|
*/
|
|
83
83
|
export function createDeveloperGuidelinesTool(loadServices) {
|
|
84
84
|
return createToolAdapter({
|
|
85
|
-
name: '
|
|
85
|
+
name: 'sfnext_get_guidelines',
|
|
86
86
|
description: 'ESSENTIAL FIRST STEP for Storefront Next development. Returns critical architecture rules, coding standards, and best practices. ' +
|
|
87
87
|
'Use this tool FIRST before writing any Storefront Next code to understand non-negotiable patterns for React Server Components, ' +
|
|
88
88
|
'data loading, and framework constraints. Returns comprehensive guidelines by default (quick-reference + key sections); ' +
|
|
@@ -11,4 +11,4 @@ export type { ColorEntry, ColorMapping, CollectedAnswers, ConversationContext, F
|
|
|
11
11
|
* @param loadServices - Function that loads configuration and returns Services instance
|
|
12
12
|
* @returns The configured MCP tool
|
|
13
13
|
*/
|
|
14
|
-
export declare function createSiteThemingTool(loadServices: () => Services): McpTool;
|
|
14
|
+
export declare function createSiteThemingTool(loadServices: () => Promise<Services> | Services): McpTool;
|
|
@@ -28,7 +28,7 @@ import { generateResponse } from './response-builder.js';
|
|
|
28
28
|
*/
|
|
29
29
|
export function createSiteThemingTool(loadServices) {
|
|
30
30
|
return createToolAdapter({
|
|
31
|
-
name: '
|
|
31
|
+
name: 'sfnext_configure_theme',
|
|
32
32
|
description: '⚠️ MANDATORY: Call this tool FIRST before implementing any theming changes. ' +
|
|
33
33
|
'Provides theming guidelines, questions, and automatic validation. ' +
|
|
34
34
|
'CRITICAL RULES: Call immediately when user requests theming (even if colors/fonts provided). ' +
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/b2c-dx-mcp",
|
|
3
3
|
"description": "MCP server for B2C Commerce developer experience tools",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "SalesforceCommerceCloud/b2c-developer-tooling",
|
|
@@ -76,11 +76,11 @@
|
|
|
76
76
|
"@modelcontextprotocol/sdk": "1.26.0",
|
|
77
77
|
"@oclif/core": "4.8.0",
|
|
78
78
|
"glob": "13.0.0",
|
|
79
|
-
"ts-morph": "
|
|
79
|
+
"ts-morph": "27.0.2",
|
|
80
80
|
"yaml": "2.8.1",
|
|
81
81
|
"postcss": "8.5.6",
|
|
82
82
|
"zod": "3.25.76",
|
|
83
|
-
"@salesforce/b2c-tooling-sdk": "0.
|
|
83
|
+
"@salesforce/b2c-tooling-sdk": "0.9.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@eslint/compat": "^1",
|