@salesforce/b2c-tooling-sdk 1.17.0 → 1.18.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/data/content-schemas/componenttype.json +79 -17
- package/data/content-schemas/pagetype.json +4 -0
- package/data/guides/enrichment.json +11264 -0
- package/data/guides/index.json +15166 -0
- package/data/job-steps/index.json +71 -1
- package/data/job-steps/job-steps.json +1 -1
- package/data/script-api/index.json +2145 -37
- package/data/tooling/index.json +222 -0
- package/data/xsd/index.json +1 -1
- package/dist/esm/auth/client-credentials.d.ts +27 -0
- package/dist/esm/auth/client-credentials.js +60 -0
- package/dist/esm/auth/client-credentials.js.map +1 -0
- package/dist/esm/auth/index.d.ts +1 -0
- package/dist/esm/auth/index.js +2 -0
- package/dist/esm/auth/index.js.map +1 -1
- package/dist/esm/auth/oauth.js +2 -1
- package/dist/esm/auth/oauth.js.map +1 -1
- package/dist/esm/cli/base-command.d.ts +40 -0
- package/dist/esm/cli/base-command.js +66 -5
- package/dist/esm/cli/base-command.js.map +1 -1
- package/dist/esm/cli/index.d.ts +2 -2
- package/dist/esm/cli/index.js +1 -1
- package/dist/esm/cli/index.js.map +1 -1
- package/dist/esm/cli/instance-command.d.ts +1 -1
- package/dist/esm/cli/instance-command.js +5 -3
- package/dist/esm/cli/instance-command.js.map +1 -1
- package/dist/esm/cli/oauth-command.d.ts +1 -1
- package/dist/esm/cli/oauth-command.js +5 -3
- package/dist/esm/cli/oauth-command.js.map +1 -1
- package/dist/esm/cli/ods-command.d.ts +1 -1
- package/dist/esm/cli/webdav-command.d.ts +1 -1
- package/dist/esm/config/sources/env-source.js +1 -0
- package/dist/esm/config/sources/env-source.js.map +1 -1
- package/dist/esm/discovery/detector.d.ts +0 -5
- package/dist/esm/discovery/detector.js +24 -3
- package/dist/esm/discovery/detector.js.map +1 -1
- package/dist/esm/discovery/index.d.ts +1 -0
- package/dist/esm/discovery/index.js +1 -0
- package/dist/esm/discovery/index.js.map +1 -1
- package/dist/esm/discovery/patterns/index.d.ts +4 -2
- package/dist/esm/discovery/patterns/index.js +9 -3
- package/dist/esm/discovery/patterns/index.js.map +1 -1
- package/dist/esm/discovery/patterns/pwa-kit.d.ts +12 -0
- package/dist/esm/discovery/patterns/pwa-kit.js +18 -7
- package/dist/esm/discovery/patterns/pwa-kit.js.map +1 -1
- package/dist/esm/discovery/patterns/sfra.d.ts +5 -4
- package/dist/esm/discovery/patterns/sfra.js +1 -1
- package/dist/esm/discovery/patterns/sfra.js.map +1 -1
- package/dist/esm/discovery/patterns/storefront-next.js +18 -2
- package/dist/esm/discovery/patterns/storefront-next.js.map +1 -1
- package/dist/esm/discovery/types.d.ts +13 -4
- package/dist/esm/discovery/types.js +11 -1
- package/dist/esm/discovery/types.js.map +1 -1
- package/dist/esm/docs/index.d.ts +3 -3
- package/dist/esm/docs/index.js +1 -1
- package/dist/esm/docs/index.js.map +1 -1
- package/dist/esm/docs/search.d.ts +111 -38
- package/dist/esm/docs/search.js +402 -81
- package/dist/esm/docs/search.js.map +1 -1
- package/dist/esm/docs/types.d.ts +56 -6
- package/dist/esm/docs/types.js +2 -0
- package/dist/esm/docs/types.js.map +1 -1
- package/dist/esm/slas/token.d.ts +9 -2
- package/dist/esm/slas/token.js +25 -29
- package/dist/esm/slas/token.js.map +1 -1
- package/dist/esm/telemetry/telemetry.d.ts +1 -0
- package/dist/esm/telemetry/telemetry.js +32 -0
- package/dist/esm/telemetry/telemetry.js.map +1 -1
- package/dist/esm/telemetry/types.d.ts +6 -0
- package/package.json +7 -2
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"generatedAt": "2026-07-08T01:12:00.365Z",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"id": "guide-account-manager",
|
|
7
|
+
"title": "Account Manager Guide",
|
|
8
|
+
"category": "tooling",
|
|
9
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/account-manager.html",
|
|
10
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/account-manager.md",
|
|
11
|
+
"headings": "Authentication • Zero-Config (Default) • User Authentication (`--user-auth`) • Client Credentials • Authentication Order • Role Requirements • Setting Up Credentials • For Interactive Use • For CI/CD and Automation • Common Workflows • User Onboarding • User Offboarding • Auditing • API Client Provisioning • Bulk Operations with JSON Output • CI/CD Examples • GitHub Actions • Shell Script Automation • Troubleshooting • \"operation forbidden\" or \"authentication invalid\" • \"No valid auth method available\" • Redirect URL errors with `--user-auth` • Next Steps",
|
|
12
|
+
"preview": "Manage Account Manager users, roles, organizations, and API clients with the B2C CLI, including authentication options, CI/CD automation, and common workflows."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "guide-agent-skills",
|
|
16
|
+
"title": "Agent Skills & Plugins",
|
|
17
|
+
"category": "tooling",
|
|
18
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/agent-skills.html",
|
|
19
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/agent-skills.md",
|
|
20
|
+
"headings": "Quick Start • Available Plugins • Claude Code • Codex • Cursor • Skill Discovery Locations • Install with the B2C CLI • Reuse Claude Code Plugin Installs • Copilot • Copilot (VS Code) • Copilot CLI • B2C CLI • Agentforce Vibes • Other IDEs • Manual Installation • Usage Examples",
|
|
21
|
+
"preview": "Agentic B2C Developer Toolkit — AI agent skills and plugins that teach Agentforce Vibes, Claude Code, Codex, Cursor, and GitHub Copilot the full B2C Commerce stack."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "guide-analytics-reports-cip-ccac",
|
|
25
|
+
"title": "Analytics Reports (CIP/CCAC)",
|
|
26
|
+
"category": "tooling",
|
|
27
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/analytics-reports-cip-ccac.html",
|
|
28
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/analytics-reports-cip-ccac.md",
|
|
29
|
+
"headings": "Authentication and Access • Non-Production Support (26.1+) • Host Selection Behavior • Quick Start • Curated reports (`cip report`) • Raw SQL (`cip query`) • Metadata discovery (`cip tables`, `cip describe`) • Choosing Query vs Report • Rate Limits and Query Discipline • Site ID Parameter Note • JSON Output • SDK Support • Next Steps",
|
|
30
|
+
"preview": "User guide for running CIP/CCAC analytics reports and SQL queries with the B2C CLI."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "guide-authentication",
|
|
34
|
+
"title": "Authentication Setup",
|
|
35
|
+
"category": "tooling",
|
|
36
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/authentication.html",
|
|
37
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/authentication.md",
|
|
38
|
+
"headings": "Overview • Account Manager API Client • Authentication Methods • Creating an API Client • Assigning Roles • Understanding Roles and Tenant Filters • For Client Credentials (Roles on API Client) • For User Authentication (roles on User) • Configuring Scopes • Configuring Tenant Filter • Redirect URLs • JWT Authentication (Certificate-Based) • How It Works • Benefits • Setup Instructions • Step 1: Generate Certificate Pair • Step 2: Register Certificate in Account Manager • Step 3: Configure CLI • Authentication Priority • Troubleshooting • Security Best Practices • OCAPI Configuration • Configuring OCAPI in Business Manager • Example OCAPI Configuration • Minimal Configuration by Feature • SCAPI Authentication • Required Setup • Scopes by Command • Configuration • WebDAV Access • Option A: Basic Authentication (user access) • Option B: OAuth-based WebDAV (API client access) • Managed Runtime API Key • Getting an MRT API Key • Configuring the API Key • Quick Start Example • 1. Create API Client in Account Manager • 2. Configure OCAPI (for code list/activate/delete, jobs, sites) • 3. Configure WebDAV Access (for code deploy/watch, webdav commands) • 4. Set Environment Variables • 5. Test the Configuration • Troubleshooting • \"Unauthorized\" errors • \"Forbidden\" on WebDAV operations • \"Invalid scope\" errors • Next Steps",
|
|
39
|
+
"preview": "Set up authentication for the B2C CLI including Account Manager API clients, OCAPI permissions, and WebDAV access keys."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "guide-ci-cd",
|
|
43
|
+
"title": "CI/CD with GitHub Actions",
|
|
44
|
+
"category": "tooling",
|
|
45
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/ci-cd.html",
|
|
46
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/ci-cd.md",
|
|
47
|
+
"headings": "Overview • Authentication • Quick Start: Deploy Cartridges • Actions Reference • Root Action • Setup • Run • Code Deploy • Data Import • MRT Deploy • Job Run • WebDAV Upload • Staging Environments (Two-Factor mTLS) • CLI Flags • GitHub Actions • Patterns • Data Import Pipeline • MRT Release Deploy • Using Outputs • Version Pinning • Plugins • Logging • CI Defaults",
|
|
48
|
+
"preview": "Automate B2C Commerce code deployment, data import, MRT bundles, and job execution with the official B2C CLI GitHub Actions for CI/CD pipelines."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "guide-commerce-apps",
|
|
52
|
+
"title": "Commerce Apps (CAPs)",
|
|
53
|
+
"category": "tooling",
|
|
54
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/commerce-apps.html",
|
|
55
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/commerce-apps.md",
|
|
56
|
+
"headings": "Develop CAPs with AI Agent Skills • Claude Code • CLI Workflow • Creating a Storefront Pull Request • Inspecting Installed State • VS Code Extension Integration • Authentication Requirements • CI/CD Integration • Reference",
|
|
57
|
+
"preview": "Use the B2C CLI and agent skills to validate, package, install, uninstall, and pull Commerce App Packages (CAPs). Links to the official Commerce Apps ISV Developer Guide for the full specification."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "guide-configuration",
|
|
61
|
+
"title": "Configuration",
|
|
62
|
+
"category": "tooling",
|
|
63
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/configuration.html",
|
|
64
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/configuration.md",
|
|
65
|
+
"headings": "CLI Flags • OAuth (SCAPI/OCAPI) • Client Credentials • JWT Bearer • Implicit Flow • Basic Authentication (WebDAV) • Environment Variables • .env File • Configuration File • Single Instance • Multiple Instances • Managing Instances with the CLI • Quick Setup • Switching Instances • Listing and Removing • Supported Fields • Two-Factor Authentication (mTLS) • Project Configuration (package.json) • Allowed Fields • Content Libraries Example • Resolution Priority • Credential Grouping • MRT API Key • Overriding Authentication Behavior • Available Auth Methods • Specifying Auth Methods • Debugging Configuration • Next Steps",
|
|
66
|
+
"preview": "Configure the B2C CLI with environment variables, dw.json files, and multi-instance setups for different environments."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "guide-extending",
|
|
70
|
+
"title": "Extending the CLI",
|
|
71
|
+
"category": "tooling",
|
|
72
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/extending.html",
|
|
73
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/extending.md",
|
|
74
|
+
"headings": "Available Hooks • Plugin Architecture • Installing Plugins • Custom Configuration Sources • Hook: `b2c:config-sources` • Priority Ordering • Example: Custom Config Source Plugin • Plugin Structure • package.json • Hook Implementation • ConfigSource Implementation • Instance Management Methods • Credential Storage Methods • Error Handling • Plugin Configuration • NormalizedConfig Fields • HTTP Middleware • Hook: `b2c:http-middleware` • HttpMiddlewareProvider Interface • Example: Request Logging Middleware • SDK Usage (without CLI) • B2C Operation Lifecycle Hooks • Hook: `b2c:operation-lifecycle` • Supported Operations • B2COperationLifecycleProvider Interface • B2COperationContext • B2COperationResult • Example: Audit Logging Plugin • Example: Deployment Freeze Policy • Cartridge Providers • Hook: `b2c:cartridge-providers` • CartridgeProvider Interface • CartridgeTransformer Interface • CartridgeDiscoveryOptions • Example: Manifest-Based Discovery • Example: Environment-Based Filtering • Scaffold Providers • Hook: `b2c:scaffold-providers` • ScaffoldProvider Interface • ScaffoldTransformer Interface • SDK Usage (without CLI) • Adding Custom Commands • Base Command Classes • Testing Plugins • Next Steps",
|
|
75
|
+
"preview": "Extend the B2C CLI with custom plugins, configuration sources, HTTP middleware, and lifecycle hooks."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "guide-ide-integration",
|
|
79
|
+
"title": "IDE Integration",
|
|
80
|
+
"category": "tooling",
|
|
81
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/ide-integration.html",
|
|
82
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/ide-integration.md",
|
|
83
|
+
"headings": "Script API IntelliSense • B2C DX VS Code Extension (recommended) • Standalone VS Code, WebStorm, or IntelliJ Ultimate • Neovim, Helix, Zed, Sublime, or other LSP-based editors • Notes • Prophet VS Code Extension • Benefits • Setup • Switching Active Instances • Manual `dw.js` Example • Fields Written by `setup ide prophet` • Notes • IntelliJ SFCC Plugin • Setup",
|
|
84
|
+
"preview": "Configure IDE tooling like Prophet VS Code extension and IntelliJ SFCC plugin to consume resolved B2C CLI configuration, plus enable Script API IntelliSense via TypeScript definitions."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "guide-installation",
|
|
88
|
+
"title": "Installation",
|
|
89
|
+
"category": "tooling",
|
|
90
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/installation.html",
|
|
91
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/installation.md",
|
|
92
|
+
"headings": "Prerequisites • Install via npm (Recommended) • Verify Installation • Install the SDK (Optional) • Next Steps",
|
|
93
|
+
"preview": "Install the B2C CLI via npm or GitHub releases, and optionally install the SDK for programmatic use."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "guide-mrt-utilities",
|
|
97
|
+
"title": "MRT Utilities",
|
|
98
|
+
"category": "tooling",
|
|
99
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/mrt-utilities.html",
|
|
100
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/mrt-utilities.md",
|
|
101
|
+
"headings": "When to use • Prerequisites • Installation • Package exports • Basic setup • Middleware • createMRTCommonMiddleware() • createMRTRequestProcessorMiddleware(requestProcessorPath, proxyConfigs) • createMRTProxyMiddlewares(proxyConfigs) • createMRTStaticAssetServingMiddleware(staticAssetDir) • createMRTCleanUpMiddleware() • Environment detection • Streaming (Lambda) • Metrics • Data Store In Development • Related",
|
|
102
|
+
"preview": "Use the mrt-utilities package to simulate a deployed Managed Runtime environment locally with Express middleware and streaming adapters."
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"id": "guide-safety",
|
|
106
|
+
"title": "Safety Mode",
|
|
107
|
+
"category": "tooling",
|
|
108
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/safety.html",
|
|
109
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/safety.md",
|
|
110
|
+
"headings": "Quick Start • Safety Levels • Setting a Level • Safety Rules • Rule Actions • Rule Matchers • HTTP Method + Path • Job ID • CLI Command ID • Evaluation Order • Confirmation Mode • Per-Instance Configuration • Global Safety Config • Configuration Merge • Example • Environment Variables Reference • SDK Usage",
|
|
111
|
+
"preview": "Configure Safety Mode to prevent accidental destructive operations with safety levels, per-instance rules, confirmation mode, and global policies."
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"id": "guide-scaffolding",
|
|
115
|
+
"title": "Scaffolding",
|
|
116
|
+
"category": "tooling",
|
|
117
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/scaffolding.html",
|
|
118
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/scaffolding.md",
|
|
119
|
+
"headings": "Quick Start • Built-in Scaffolds • Using Scaffolds • Interactive Mode • Non-Interactive Mode • Providing Parameters • Preview Changes • Output Directory • Scaffold Details • cartridge • controller • hook • service • custom-api • job-step • page-designer-component • Creating Custom Scaffolds • Scaffold Locations • Initialize a New Scaffold • Scaffold Manifest • Parameter Types • Dynamic Sources • Conditional Parameters • Template Files • Template Helpers • File Mappings • File Modifications • Post Instructions • Validation • Scaffold Discovery Priority • Programmatic Usage (SDK) • Discovery and Generation • Parameter Schema Discovery • Validation",
|
|
120
|
+
"preview": "Generate B2C Commerce cartridges, controllers, hooks, custom APIs, and more from templates using the scaffolding framework."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "guide-script-debugger",
|
|
124
|
+
"title": "Script Debugger",
|
|
125
|
+
"category": "tooling",
|
|
126
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/script-debugger.html",
|
|
127
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/script-debugger.md",
|
|
128
|
+
"headings": "Requirements • Choosing an interface • Server affinity (hitting breakpoints) • See Also",
|
|
129
|
+
"preview": "Debug server-side B2C Commerce scripts (controllers, hooks, jobs, custom APIs) with the Script Debugger — via the VS Code extension, the CLI DAP debug adapter, or the MCP diagnostics tools."
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": "guide-sdk-migration",
|
|
133
|
+
"title": "Migrating from sfcc-ci's JavaScript API",
|
|
134
|
+
"category": "tooling",
|
|
135
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/sdk-migration.html",
|
|
136
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/sdk-migration.md",
|
|
137
|
+
"headings": "Key Paradigm Shifts • Callbacks to async/await • Token Passing to Config-Based Auth • Untyped Objects to Typed Clients • Quick Start: Replacing a Typical sfcc-ci Script • API Mapping by Module • Authentication (`sfcc.auth`) • Code Management (`sfcc.code`) • Job Execution (`sfcc.job`) • Instance / WebDAV (`sfcc.instance`, `sfcc.webdav`) • Account Manager Users (`sfcc.user`) • Account Manager & BM Roles (`sfcc.role`) • Organizations (`sfcc.org`) • Using Typed Clients Directly • SLAS Client Management • Direct OCAPI Access • Comprehensive Mapping Table • What the SDK Adds Beyond sfcc-ci • Error Handling • Next Steps",
|
|
138
|
+
"preview": "Migrate from sfcc-ci's programmatic JavaScript API to @salesforce/b2c-tooling-sdk with side-by-side code examples and API mapping."
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"id": "guide-security",
|
|
142
|
+
"title": "Security",
|
|
143
|
+
"category": "tooling",
|
|
144
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/security.html",
|
|
145
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/security.md",
|
|
146
|
+
"headings": "Supply Chain Security • Minimum Release Age • Trust Policy • Restricting Build Scripts • NPM Trusted Publishing • Operational Security: Safety Mode • Best Practices • For Contributors • For Users",
|
|
147
|
+
"preview": "Security practices for the B2C Developer Tooling project including supply chain protections and dependency management."
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"id": "guide-sfcc-ci-migration",
|
|
151
|
+
"title": "Migrating from sfcc-ci",
|
|
152
|
+
"category": "tooling",
|
|
153
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/sfcc-ci-migration.html",
|
|
154
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/sfcc-ci-migration.md",
|
|
155
|
+
"headings": "Authentication • Stateful Auth (sfcc-ci Compatible) • Stateless Auth (Recommended for CI/CD) • Command Mapping • Code Management • Instance / Data • Cartridge Path • Jobs • Sandbox • SLAS • User / Org / Role • Environment Variables • Configuration • CI/CD Migration • Before (sfcc-ci) • After (b2c-cli — stateless) • After (b2c-cli — stateful, sfcc-ci compatible) • GitHub Actions • Next Steps",
|
|
156
|
+
"preview": "Migrate from sfcc-ci to @salesforce/b2c-cli with command mappings, environment variable compatibility, and CI/CD pipeline updates."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"id": "guide-storefront-next",
|
|
160
|
+
"title": "Storefront Next",
|
|
161
|
+
"category": "tooling",
|
|
162
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/storefront-next.html",
|
|
163
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/storefront-next.md",
|
|
164
|
+
"headings": "Prerequisites • Step 1: Create an On-Demand Sandbox (Optional) • Step 2: Create a SLAS Client • Step 3: Create an MRT Environment • Connect the B2C Commerce Instance • Step 4: Set Environment Variables • Variable Reference • Multi-Site Configuration • Step 5: Deploy • Step 6: Debugging with Log Tailing • Summary • Next Steps",
|
|
165
|
+
"preview": "Set up Storefront Next development environments using the B2C CLI to create sandboxes, SLAS clients, MRT environments, and deploy."
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"id": "guide-third-party-plugins",
|
|
169
|
+
"title": "3rd Party Plugins",
|
|
170
|
+
"category": "tooling",
|
|
171
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/third-party-plugins.html",
|
|
172
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/third-party-plugins.md",
|
|
173
|
+
"headings": "Installing Plugins • Available Plugins • IntelliJ SFCC Config Plugin • Installation • Features • Environment Variables • Usage • Password Store Plugin • Installation • Features • Storing Credentials • Environment Variables • Usage • macOS Keychain Plugin • Installation • Features • Storing Credentials • Environment Variables • Usage • Docs Viewer Plugin • Installation • Features • Usage • Catalog Reducer Plugin • Installation • Features • Usage • Pipeline Visualizer Plugin • Installation • Features • Usage • Creating Your Own Plugin • Submitting Plugins",
|
|
174
|
+
"preview": "Community plugins for the B2C CLI including IntelliJ SFCC config integration, credential storage, docs search, catalog reduction, and pipeline visualization."
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "mcp-configuration",
|
|
178
|
+
"title": "Configuration",
|
|
179
|
+
"category": "tooling",
|
|
180
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/configuration.html",
|
|
181
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/configuration.md",
|
|
182
|
+
"headings": "Credentials • `dw.json` (Recommended) {#dw-json} • `.env` File {#env-file} • MRT Credentials (`~/.mobify`) {#mrt-credentials} • Configuration Priority • Toolset Selection • Auto-Discovery (Default) • Manual Selection • Individual Tool Selection • Logging • Telemetry • MCP Server Flags Reference {#mcp-server-flags} • Documentation Tools Restriction • Environment Variables Reference {#environment-variables-reference} • MCP Server Environment Variables {#mcp-server-environment-variables} • Next Steps",
|
|
183
|
+
"preview": "Configure the B2C DX MCP Server with credentials, flags, environment variables, and toolset selection."
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"id": "mcp-figma-tools-setup",
|
|
187
|
+
"title": "Figma-to-Component Tools Setup",
|
|
188
|
+
"category": "tooling",
|
|
189
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/figma-tools-setup.html",
|
|
190
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/figma-tools-setup.md",
|
|
191
|
+
"headings": "Overview • Figma MCP Setup • Figma Design File • Verification • Related Documentation",
|
|
192
|
+
"preview": "Prerequisites and setup for Figma-to-component tools (workflow orchestrator, generate component, map tokens)."
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"id": "mcp-index",
|
|
196
|
+
"title": "MCP Server",
|
|
197
|
+
"category": "tooling",
|
|
198
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/index.html",
|
|
199
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/index.md",
|
|
200
|
+
"headings": "Quick Start • Project Type Detection • Plugins • Next Steps",
|
|
201
|
+
"preview": "MCP Server for Salesforce B2C Commerce - AI-assisted development tools for Claude, Cursor, and other AI assistants."
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"id": "mcp-installation",
|
|
205
|
+
"title": "Installation",
|
|
206
|
+
"category": "tooling",
|
|
207
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/installation.html",
|
|
208
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/installation.md",
|
|
209
|
+
"headings": "Prerequisites • Claude Code • Plugin Marketplace • CLI • Cursor • Project-Level Configuration (Recommended) • Quick Install (User-Level) • GitHub Copilot • After Installation • Troubleshooting • Server Not Starting • `spawn npx ENOENT` Error • \"Could not determine executable to run\" Error (Windows) • Tools Not Available • Configuration Not Loading • Next Steps",
|
|
210
|
+
"preview": "Install and configure the B2C DX MCP Server for Claude Code, Cursor, GitHub Copilot, and other MCP clients."
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"id": "mcp-toolsets",
|
|
214
|
+
"title": "Toolsets & Tools",
|
|
215
|
+
"category": "tooling",
|
|
216
|
+
"url": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets.html",
|
|
217
|
+
"sourceUrl": "https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets.md",
|
|
218
|
+
"headings": "CARTRIDGES • DIAGNOSTICS • MRT • PWAV3 • SCAPI • STOREFRONTNEXT • STOREFRONTNEXT_DEPRECATED • Next Steps",
|
|
219
|
+
"preview": "Available toolsets and tools in the B2C DX MCP Server for SCAPI, CARTRIDGES, DIAGNOSTICS, MRT, PWAV3, and STOREFRONTNEXT development."
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}
|
package/data/xsd/index.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encoding of OAuth client credentials for the HTTP Basic `Authorization` header.
|
|
3
|
+
*
|
|
4
|
+
* @module auth/client-credentials
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Builds the base64 payload for an `Authorization: Basic` header carrying OAuth
|
|
8
|
+
* client credentials, per RFC 6749 §2.3.1.
|
|
9
|
+
*
|
|
10
|
+
* The client identifier and client password are each form-url-encoded (RFC 6749
|
|
11
|
+
* Appendix B) *before* being joined with a colon and Base64-encoded (RFC 7617
|
|
12
|
+
* §2, the HTTP Basic scheme). Skipping the per-component encoding corrupts any
|
|
13
|
+
* credential containing characters the server form-url-decodes: a raw `+` is
|
|
14
|
+
* read as a space and a valid `%xx` escape is decoded to another byte (both
|
|
15
|
+
* yield `invalid_client` -- a wrong-but-valid secret), while an invalid escape
|
|
16
|
+
* such as `%zz` makes a strict decoder error out (`unauthorized_client` /
|
|
17
|
+
* "Unexpected error when authenticating client"). The same credential succeeds
|
|
18
|
+
* when sent in the request body, which is form-url-encoded by construction --
|
|
19
|
+
* the "body works, Basic fails" symptom.
|
|
20
|
+
*
|
|
21
|
+
* @param clientId - The OAuth client identifier
|
|
22
|
+
* @param clientSecret - The OAuth client password/secret
|
|
23
|
+
* @returns The Base64 string to place after `Basic ` in the `Authorization` header
|
|
24
|
+
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1
|
|
25
|
+
* @see https://datatracker.ietf.org/doc/html/rfc6749#appendix-B
|
|
26
|
+
*/
|
|
27
|
+
export declare function encodeBasicClientCredentials(clientId: string, clientSecret: string): 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
|
+
/**
|
|
7
|
+
* Encoding of OAuth client credentials for the HTTP Basic `Authorization` header.
|
|
8
|
+
*
|
|
9
|
+
* @module auth/client-credentials
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Form-url-encode a single value using the `application/x-www-form-urlencoded`
|
|
13
|
+
* escaping rules that RFC 6749 Appendix B references -- the W3C HTML form rules
|
|
14
|
+
* (UTF-8 first), NOT RFC 3986 percent-encoding. `URLSearchParams` implements
|
|
15
|
+
* exactly these rules.
|
|
16
|
+
*
|
|
17
|
+
* The two encodings differ only for a space (form rules -> `+`, RFC 3986 ->
|
|
18
|
+
* `%20`) and a few punctuation chars (`!`, `~`, `(`, `)`). They agree on every
|
|
19
|
+
* other byte, INCLUDING `+` and `%` -- the characters that actually trigger the
|
|
20
|
+
* auth failure this module fixes -- so the encoder choice does not affect that
|
|
21
|
+
* bug. We use the form rules (`URLSearchParams`) regardless because:
|
|
22
|
+
* 1. they are precisely the Appendix B algorithm -- its worked example encodes
|
|
23
|
+
* U+0020 (space) as `+`, which `URLSearchParams` reproduces; and
|
|
24
|
+
* 2. they are the same rules the token-request body uses, so a credential is
|
|
25
|
+
* byte-identical whether sent in the Basic header or in the body.
|
|
26
|
+
* The two are only interchangeable against a server that form-url-decodes (as
|
|
27
|
+
* Account Manager does); a strict RFC 3986 decoder would read a form-encoded
|
|
28
|
+
* space (`+`) as a literal `+`, so matching the algorithm the RFC names is the
|
|
29
|
+
* safe choice rather than a coincidence that happens to work.
|
|
30
|
+
*/
|
|
31
|
+
function formUrlEncodeComponent(value) {
|
|
32
|
+
// The name is empty, so the serialized "=value" is sliced to just the value.
|
|
33
|
+
return new URLSearchParams([['', value]]).toString().slice(1);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds the base64 payload for an `Authorization: Basic` header carrying OAuth
|
|
37
|
+
* client credentials, per RFC 6749 §2.3.1.
|
|
38
|
+
*
|
|
39
|
+
* The client identifier and client password are each form-url-encoded (RFC 6749
|
|
40
|
+
* Appendix B) *before* being joined with a colon and Base64-encoded (RFC 7617
|
|
41
|
+
* §2, the HTTP Basic scheme). Skipping the per-component encoding corrupts any
|
|
42
|
+
* credential containing characters the server form-url-decodes: a raw `+` is
|
|
43
|
+
* read as a space and a valid `%xx` escape is decoded to another byte (both
|
|
44
|
+
* yield `invalid_client` -- a wrong-but-valid secret), while an invalid escape
|
|
45
|
+
* such as `%zz` makes a strict decoder error out (`unauthorized_client` /
|
|
46
|
+
* "Unexpected error when authenticating client"). The same credential succeeds
|
|
47
|
+
* when sent in the request body, which is form-url-encoded by construction --
|
|
48
|
+
* the "body works, Basic fails" symptom.
|
|
49
|
+
*
|
|
50
|
+
* @param clientId - The OAuth client identifier
|
|
51
|
+
* @param clientSecret - The OAuth client password/secret
|
|
52
|
+
* @returns The Base64 string to place after `Basic ` in the `Authorization` header
|
|
53
|
+
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1
|
|
54
|
+
* @see https://datatracker.ietf.org/doc/html/rfc6749#appendix-B
|
|
55
|
+
*/
|
|
56
|
+
export function encodeBasicClientCredentials(clientId, clientSecret) {
|
|
57
|
+
const userPass = `${formUrlEncodeComponent(clientId)}:${formUrlEncodeComponent(clientSecret)}`;
|
|
58
|
+
return Buffer.from(userPass).toString('base64');
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=client-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-credentials.js","sourceRoot":"","sources":["../../../src/auth/client-credentials.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,sBAAsB,CAAC,KAAa;IAC3C,6EAA6E;IAC7E,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAAgB,EAAE,YAAoB;IACjF,MAAM,QAAQ,GAAG,GAAG,sBAAsB,CAAC,QAAQ,CAAC,IAAI,sBAAsB,CAAC,YAAY,CAAC,EAAE,CAAC;IAC/F,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/esm/auth/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
*/
|
|
57
57
|
export type { AuthStrategy, FetchInit, AccessTokenResponse, DecodedJWT, AuthConfig, BasicAuthConfig, OAuthAuthConfig, ApiKeyAuthConfig, AuthMethod, AuthCredentials, } from './types.js';
|
|
58
58
|
export { ALL_AUTH_METHODS } from './types.js';
|
|
59
|
+
export { encodeBasicClientCredentials } from './client-credentials.js';
|
|
59
60
|
export { BasicAuthStrategy } from './basic.js';
|
|
60
61
|
export { OAuthStrategy, decodeJWT } from './oauth.js';
|
|
61
62
|
export type { OAuthConfig } from './oauth.js';
|
package/dist/esm/auth/index.js
CHANGED
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
* @module auth
|
|
61
61
|
*/
|
|
62
62
|
export { ALL_AUTH_METHODS } from './types.js';
|
|
63
|
+
// Client credential encoding (RFC 6749 §2.3.1)
|
|
64
|
+
export { encodeBasicClientCredentials } from './client-credentials.js';
|
|
63
65
|
// Strategies
|
|
64
66
|
export { BasicAuthStrategy } from './basic.js';
|
|
65
67
|
export { OAuthStrategy, decodeJWT } from './oauth.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAeH,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAE5C,aAAa;AACb,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EA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AAE,yBAAyB,EAAC,MAAM,cAAc,CAAC;AAG5E,kBAAkB;AAClB,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
|
package/dist/esm/auth/oauth.js
CHANGED
|
@@ -3,6 +3,7 @@ import { wrapNetworkError } from '../errors/network-error.js';
|
|
|
3
3
|
import { getLogger } from '../logging/logger.js';
|
|
4
4
|
import { DEFAULT_ACCOUNT_MANAGER_HOST } from '../defaults.js';
|
|
5
5
|
import { globalAuthMiddlewareRegistry, applyAuthRequestMiddleware, applyAuthResponseMiddleware } from './middleware.js';
|
|
6
|
+
import { encodeBasicClientCredentials } from './client-credentials.js';
|
|
6
7
|
// Module-level token cache to support multiple instances with same clientId
|
|
7
8
|
const ACCESS_TOKEN_CACHE = new Map();
|
|
8
9
|
// In-flight token requests, keyed by cacheKey, so concurrent callers coalesce
|
|
@@ -233,7 +234,7 @@ export class OAuthStrategy {
|
|
|
233
234
|
if (this.config.scopes && this.config.scopes.length > 0) {
|
|
234
235
|
params.append('scope', this.config.scopes.join(' '));
|
|
235
236
|
}
|
|
236
|
-
const credentials =
|
|
237
|
+
const credentials = encodeBasicClientCredentials(this.config.clientId, this.config.clientSecret);
|
|
237
238
|
// Build request object for middleware
|
|
238
239
|
let request = new Request(url, {
|
|
239
240
|
method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/auth/oauth.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,4BAA4B,EAAC,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,4BAA4B,EAAE,0BAA0B,EAAE,2BAA2B,EAAC,MAAM,i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O,EAAE,UAAU;YACnB,MAAM;SACP,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -8,6 +8,34 @@ import type { SafetyEvaluation } from '../safety/types.js';
|
|
|
8
8
|
import { Telemetry, type TelemetryAttributes } from '../telemetry/index.js';
|
|
9
9
|
export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)['baseFlags'] & T['flags']>;
|
|
10
10
|
export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
|
|
11
|
+
/**
|
|
12
|
+
* Stable error-code values passed to oclif's `this.error(msg, {code})` so that
|
|
13
|
+
* {@link classifyError} can categorize the resulting telemetry without parsing
|
|
14
|
+
* error messages.
|
|
15
|
+
*
|
|
16
|
+
* - `VALIDATION` — user/config input error (missing flag, bad value). Expected,
|
|
17
|
+
* not a reliability defect.
|
|
18
|
+
* - `GUARDRAIL` — blocked by the user's own safety configuration. Working as
|
|
19
|
+
* intended, not a failure of the tool.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ERROR_CODE: {
|
|
22
|
+
readonly VALIDATION: "VALIDATION";
|
|
23
|
+
readonly GUARDRAIL: "GUARDRAIL";
|
|
24
|
+
};
|
|
25
|
+
/** Telemetry category recorded on COMMAND_ERROR (see {@link classifyError}). */
|
|
26
|
+
export type ErrorCategory = 'guardrail' | 'runtime' | 'validation';
|
|
27
|
+
/**
|
|
28
|
+
* Classify a thrown command error for telemetry so analytics can exclude
|
|
29
|
+
* expected validation/guardrail errors from reliability (defect-rate) metrics.
|
|
30
|
+
*
|
|
31
|
+
* Resolution order:
|
|
32
|
+
* 1. An explicit oclif `code` of {@link ERROR_CODE.VALIDATION} / `GUARDRAIL`
|
|
33
|
+
* (set at the throw site via `this.error(msg, {code})`).
|
|
34
|
+
* 2. Safety error class names thrown from HTTP/auth middleware that do not flow
|
|
35
|
+
* through `this.error` (`SafetyBlockedError`, `SafetyConfirmationRequired`).
|
|
36
|
+
* 3. Everything else is a genuine `runtime` error (the reliability signal).
|
|
37
|
+
*/
|
|
38
|
+
export declare function classifyError(err: unknown): ErrorCategory;
|
|
11
39
|
/**
|
|
12
40
|
* Base command class for B2C CLI tools.
|
|
13
41
|
*
|
|
@@ -105,6 +133,18 @@ export declare abstract class BaseCommand<T extends typeof Command> extends Comm
|
|
|
105
133
|
* COMMAND_EXCEPTION events include organizational context.
|
|
106
134
|
*/
|
|
107
135
|
protected addTelemetryContext(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Build a suffix appended to "X is required" config errors.
|
|
138
|
+
*
|
|
139
|
+
* When NO config source contributed any values (no dw.json found, no env
|
|
140
|
+
* vars, no flags — the dominant cause of these errors in telemetry), the user
|
|
141
|
+
* is almost certainly unconfigured rather than missing one specific field, so
|
|
142
|
+
* we point them at the configuration guide. When a source DID load, we stay
|
|
143
|
+
* quiet: the existing message already lists the precise flag/env var to set.
|
|
144
|
+
*
|
|
145
|
+
* @returns A "\n\nSee: <url>" suffix, or '' when config is already partially present.
|
|
146
|
+
*/
|
|
147
|
+
protected configDocsHint(): string;
|
|
108
148
|
/**
|
|
109
149
|
* Collects config sources from plugins via the `b2c:config-sources` hook.
|
|
110
150
|
*
|
|
@@ -19,6 +19,46 @@ import { initializeStatefulStore } from '../auth/stateful-store.js';
|
|
|
19
19
|
import { setUserAgent } from '../clients/user-agent.js';
|
|
20
20
|
import { createTelemetry, Telemetry } from '../telemetry/index.js';
|
|
21
21
|
const LOG_LEVELS = ['trace', 'debug', 'info', 'warn', 'error', 'silent'];
|
|
22
|
+
/**
|
|
23
|
+
* Stable error-code values passed to oclif's `this.error(msg, {code})` so that
|
|
24
|
+
* {@link classifyError} can categorize the resulting telemetry without parsing
|
|
25
|
+
* error messages.
|
|
26
|
+
*
|
|
27
|
+
* - `VALIDATION` — user/config input error (missing flag, bad value). Expected,
|
|
28
|
+
* not a reliability defect.
|
|
29
|
+
* - `GUARDRAIL` — blocked by the user's own safety configuration. Working as
|
|
30
|
+
* intended, not a failure of the tool.
|
|
31
|
+
*/
|
|
32
|
+
export const ERROR_CODE = {
|
|
33
|
+
VALIDATION: 'VALIDATION',
|
|
34
|
+
GUARDRAIL: 'GUARDRAIL',
|
|
35
|
+
};
|
|
36
|
+
/** Base URL for the online documentation site. */
|
|
37
|
+
const DOCS_BASE_URL = 'https://salesforcecommercecloud.github.io/b2c-developer-tooling';
|
|
38
|
+
/** Configuration guide — how to point the CLI at an instance and authenticate. */
|
|
39
|
+
const DOCS_CONFIGURATION_URL = `${DOCS_BASE_URL}/guide/configuration.html`;
|
|
40
|
+
/**
|
|
41
|
+
* Classify a thrown command error for telemetry so analytics can exclude
|
|
42
|
+
* expected validation/guardrail errors from reliability (defect-rate) metrics.
|
|
43
|
+
*
|
|
44
|
+
* Resolution order:
|
|
45
|
+
* 1. An explicit oclif `code` of {@link ERROR_CODE.VALIDATION} / `GUARDRAIL`
|
|
46
|
+
* (set at the throw site via `this.error(msg, {code})`).
|
|
47
|
+
* 2. Safety error class names thrown from HTTP/auth middleware that do not flow
|
|
48
|
+
* through `this.error` (`SafetyBlockedError`, `SafetyConfirmationRequired`).
|
|
49
|
+
* 3. Everything else is a genuine `runtime` error (the reliability signal).
|
|
50
|
+
*/
|
|
51
|
+
export function classifyError(err) {
|
|
52
|
+
const code = err?.code;
|
|
53
|
+
if (code === ERROR_CODE.VALIDATION)
|
|
54
|
+
return 'validation';
|
|
55
|
+
if (code === ERROR_CODE.GUARDRAIL)
|
|
56
|
+
return 'guardrail';
|
|
57
|
+
const name = err?.name;
|
|
58
|
+
if (name === 'SafetyBlockedError' || name === 'SafetyConfirmationRequired')
|
|
59
|
+
return 'guardrail';
|
|
60
|
+
return 'runtime';
|
|
61
|
+
}
|
|
22
62
|
/**
|
|
23
63
|
* Base command class for B2C CLI tools.
|
|
24
64
|
*
|
|
@@ -342,6 +382,25 @@ export class BaseCommand extends Command {
|
|
|
342
382
|
// Best-effort: telemetry context enrichment must never prevent command execution
|
|
343
383
|
}
|
|
344
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* Build a suffix appended to "X is required" config errors.
|
|
387
|
+
*
|
|
388
|
+
* When NO config source contributed any values (no dw.json found, no env
|
|
389
|
+
* vars, no flags — the dominant cause of these errors in telemetry), the user
|
|
390
|
+
* is almost certainly unconfigured rather than missing one specific field, so
|
|
391
|
+
* we point them at the configuration guide. When a source DID load, we stay
|
|
392
|
+
* quiet: the existing message already lists the precise flag/env var to set.
|
|
393
|
+
*
|
|
394
|
+
* @returns A "\n\nSee: <url>" suffix, or '' when config is already partially present.
|
|
395
|
+
*/
|
|
396
|
+
configDocsHint() {
|
|
397
|
+
// resolvedConfig may be unset if the error is thrown before loadConfiguration().
|
|
398
|
+
const sources = this.resolvedConfig?.sources;
|
|
399
|
+
if (sources && sources.length === 0) {
|
|
400
|
+
return t('base.configDocsHint', '\n\nNo configuration was found. See the configuration guide to connect an instance: {{url}}', { url: DOCS_CONFIGURATION_URL });
|
|
401
|
+
}
|
|
402
|
+
return '';
|
|
403
|
+
}
|
|
345
404
|
/**
|
|
346
405
|
* Collects config sources from plugins via the `b2c:config-sources` hook.
|
|
347
406
|
*
|
|
@@ -471,14 +530,16 @@ export class BaseCommand extends Command {
|
|
|
471
530
|
async catch(err) {
|
|
472
531
|
const exitCode = err.exitCode ?? 1;
|
|
473
532
|
const duration = this.commandStartTime ? Date.now() - this.commandStartTime : undefined;
|
|
533
|
+
const errorCategory = classifyError(err);
|
|
474
534
|
// Send exception and COMMAND_ERROR event so the error appears in custom events (same view as COMMAND_START)
|
|
475
535
|
// Flush explicitly before stop to ensure events are sent before process exits
|
|
476
536
|
if (this.telemetry) {
|
|
477
|
-
this.telemetry.sendException(err, { command: this.id, exitCode, duration });
|
|
537
|
+
this.telemetry.sendException(err, { command: this.id, errorCategory, exitCode, duration });
|
|
478
538
|
this.telemetry.sendEvent('COMMAND_ERROR', {
|
|
479
539
|
command: this.id,
|
|
480
540
|
exitCode,
|
|
481
541
|
duration,
|
|
542
|
+
errorCategory,
|
|
482
543
|
errorMessage: err.message,
|
|
483
544
|
...(err.cause ? { errorCause: String(err.cause) } : {}),
|
|
484
545
|
});
|
|
@@ -564,7 +625,7 @@ export class BaseCommand extends Command {
|
|
|
564
625
|
operation,
|
|
565
626
|
safetyLevel,
|
|
566
627
|
description: describeSafetyLevel(safetyLevel),
|
|
567
|
-
}), { exit: 1 });
|
|
628
|
+
}), { code: ERROR_CODE.GUARDRAIL, exit: 1 });
|
|
568
629
|
}
|
|
569
630
|
/**
|
|
570
631
|
* Parse extra params from --extra-query, --extra-body, and --extra-headers flags.
|
|
@@ -652,7 +713,7 @@ export class BaseCommand extends Command {
|
|
|
652
713
|
commandId: this.id,
|
|
653
714
|
});
|
|
654
715
|
if (evaluation.action === 'block' && evaluation.rule) {
|
|
655
|
-
this.error(evaluation.reason, { exit: 1 });
|
|
716
|
+
this.error(evaluation.reason, { code: ERROR_CODE.GUARDRAIL, exit: 1 });
|
|
656
717
|
}
|
|
657
718
|
if (evaluation.action === 'confirm' && evaluation.rule) {
|
|
658
719
|
await this.confirmOrBlock(evaluation);
|
|
@@ -671,11 +732,11 @@ export class BaseCommand extends Command {
|
|
|
671
732
|
if (!process.stdin.isTTY) {
|
|
672
733
|
this.error(`Your safety configuration requires confirmation for this operation, ` +
|
|
673
734
|
`but no interactive session is available.\n\n ${evaluation.reason}\n\n` +
|
|
674
|
-
`To change this, update the "safety" section in your dw.json or the SFCC_SAFETY_CONFIRM environment variable.`, { exit: 1 });
|
|
735
|
+
`To change this, update the "safety" section in your dw.json or the SFCC_SAFETY_CONFIRM environment variable.`, { code: ERROR_CODE.GUARDRAIL, exit: 1 });
|
|
675
736
|
}
|
|
676
737
|
const confirmed = await safetyConfirm(`Your safety configuration requires confirmation for this operation:\n ${evaluation.reason}\n Proceed?`);
|
|
677
738
|
if (!confirmed) {
|
|
678
|
-
this.error('Operation cancelled.', { exit: 1 });
|
|
739
|
+
this.error('Operation cancelled.', { code: ERROR_CODE.GUARDRAIL, exit: 1 });
|
|
679
740
|
}
|
|
680
741
|
}
|
|
681
742
|
/**
|