b2c-config
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseB2C Config Skill
B2C配置Skill
Use the command to view the resolved configuration and understand where each value comes from. Use the commands to manage named instance configurations.
b2c setup inspectb2c setup instanceTip:still works as an alias. Ifb2c setup configis not installed globally, useb2cinstead (e.g.,npx @salesforce/b2c-cli).npx @salesforce/b2c-cli setup inspect
使用命令查看已解析的配置,并了解每个值的来源。使用命令管理命名实例配置。
b2c setup inspectb2c setup instance提示:仍可用作别名。如果未全局安装b2c setup config,请改用b2c(例如:npx @salesforce/b2c-cli)。npx @salesforce/b2c-cli setup inspect
When to Use
使用场景
Use when you need to:
b2c setup inspect- Verify which configuration file is being used
- Check if environment variables are being read correctly
- Debug authentication failures by confirming credentials are loaded
- Understand credential source priority (dw.json vs env vars vs plugins)
- Identify hostname mismatch protection issues
- Verify MRT API key is loaded from ~/.mobify
Use commands when you need to:
b2c setup instance- List all configured instances
- Create a new instance configuration
- Switch between instances (set active)
- Remove an instance configuration
当你需要以下操作时,使用:
b2c setup inspect- 验证正在使用哪个配置文件
- 检查环境变量是否被正确读取
- 通过确认凭据已加载来调试身份验证失败问题
- 了解凭据来源的优先级(dw.json vs 环境变量 vs 插件)
- 识别主机名不匹配保护问题
- 验证MRT API密钥是否从~/.mobify加载
当你需要以下操作时,使用命令:
b2c setup instance- 列出所有已配置的实例
- 创建新的实例配置
- 在实例之间切换(设置为活动实例)
- 删除实例配置
Inspecting Configuration
检查配置
View Current Configuration
查看当前配置
bash
undefinedbash
undefinedDisplay resolved configuration (sensitive values masked by default)
显示已解析的配置(默认会屏蔽敏感值)
b2c setup inspect
b2c setup inspect
View configuration for a specific instance from dw.json
查看dw.json中特定实例的配置
b2c setup inspect -i staging
b2c setup inspect -i staging
View configuration with a specific config file
使用指定的配置文件查看配置
b2c setup inspect --config /path/to/dw.json
undefinedb2c setup inspect --config /path/to/dw.json
undefinedDebug Sensitive Values
调试敏感值
bash
undefinedbash
undefinedShow actual passwords, secrets, and API keys (use with caution)
显示完整的密码、密钥和API密钥(谨慎使用)
b2c setup inspect --unmask
undefinedb2c setup inspect --unmask
undefinedJSON Output for Scripting
用于脚本的JSON输出
bash
undefinedbash
undefinedOutput as JSON for parsing in scripts
以JSON格式输出,用于脚本解析
b2c setup inspect --json
b2c setup inspect --json
Pretty-print with jq
使用jq进行格式化输出
b2c setup inspect --json | jq '.config'
b2c setup inspect --json | jq '.config'
Check which sources are loaded
检查已加载的来源
b2c setup inspect --json | jq '.sources'
undefinedb2c setup inspect --json | jq '.sources'
undefinedIDE Integration (Prophet)
IDE集成(Prophet)
Use to generate a bridge script for the Prophet VS Code extension.
b2c setup ide prophetdw.jsbash
undefined使用为Prophet VS Code扩展生成桥接脚本。
b2c setup ide prophetdw.jsbash
undefinedGenerate ./dw.js in the current project
在当前项目中生成./dw.js
b2c setup ide prophet
b2c setup ide prophet
Overwrite existing file
覆盖现有文件
b2c setup ide prophet --force
b2c setup ide prophet --force
Custom path
指定自定义路径
b2c setup ide prophet --output .vscode/dw.js
The generated script runs `b2c setup inspect --json --unmask` at runtime, so Prophet sees the same resolved config as CLI commands, including configuration plugins. It maps values to `dw.json`-style keys and passes through Prophet fields like `cartridgesPath`, `siteID`, and `storefrontPassword` when present.b2c setup ide prophet --output .vscode/dw.js
生成的脚本会在运行时执行`b2c setup inspect --json --unmask`,因此Prophet会看到与CLI命令相同的已解析配置,包括配置插件。它会将值映射为dw.json风格的键,并在存在时传递Prophet字段,如`cartridgesPath`、`siteID`和`storefrontPassword`。Managing Instances
管理实例
List Configured Instances
列出已配置的实例
bash
undefinedbash
undefinedShow all instances from dw.json
显示dw.json中的所有实例
b2c setup instance list
b2c setup instance list
Output as JSON
以JSON格式输出
b2c setup instance list --json
undefinedb2c setup instance list --json
undefinedCreate a New Instance
创建新实例
bash
undefinedbash
undefinedInteractive mode - prompts for all values
交互模式 - 提示输入所有值
b2c setup instance create staging
b2c setup instance create staging
With hostname
指定主机名
b2c setup instance create staging --hostname staging.example.com
b2c setup instance create staging --hostname staging.example.com
Create and set as active
创建并设置为活动实例
b2c setup instance create staging --hostname staging.example.com --active
b2c setup instance create staging --hostname staging.example.com --active
Non-interactive mode (for scripts)
非交互模式(适用于脚本)
b2c setup instance create staging
--hostname staging.example.com
--username admin
--password secret
--force
--hostname staging.example.com
--username admin
--password secret
--force
undefinedb2c setup instance create staging
--hostname staging.example.com
--username admin
--password secret
--force
--hostname staging.example.com
--username admin
--password secret
--force
undefinedSwitch Active Instance
切换活动实例
bash
undefinedbash
undefinedSet staging as the default instance
将staging设置为默认实例
b2c setup instance set-active staging
b2c setup instance set-active staging
Now commands use staging by default
现在命令默认使用staging实例
b2c code list # Uses staging
undefinedb2c code list # 使用staging实例
undefinedRemove an Instance
删除实例
bash
undefinedbash
undefinedRemove with confirmation prompt
删除(带确认提示)
b2c setup instance remove staging
b2c setup instance remove staging
Remove without confirmation
直接删除(无确认提示)
b2c setup instance remove staging --force
undefinedb2c setup instance remove staging --force
undefinedUnderstanding the Output
理解输出内容
The command displays configuration organized by category:
setup inspect- Instance: hostname, webdavHostname, codeVersion
- Authentication (Basic): username, password (for WebDAV)
- Authentication (OAuth): clientId, clientSecret, scopes, authMethods
- TLS/mTLS: certificate, certificatePassphrase, selfSigned (for two-factor auth)
- SCAPI: shortCode
- Managed Runtime (MRT): mrtProject, mrtEnvironment, mrtApiKey
- Metadata: instanceName (from multi-instance configs)
- Sources: List of all configuration sources that were loaded
Each value shows its source in brackets:
- - Value from dw.json file
[DwJsonSource] - - Value from ~/.mobify file
[MobifySource] - - Value from environment variable
[SFCC_*] - - Value from a credential plugin
[password-store]
setup inspect- Instance:hostname、webdavHostname、codeVersion
- Authentication (Basic):username、password(用于WebDAV)
- Authentication (OAuth):clientId、clientSecret、scopes、authMethods
- TLS/mTLS:certificate、certificatePassphrase、selfSigned(用于双因素认证)
- SCAPI:shortCode
- Managed Runtime (MRT):mrtProject、mrtEnvironment、mrtApiKey
- Metadata:instanceName(来自多实例配置)
- Sources:所有已加载的配置来源列表
每个值都会在括号中显示其来源:
- - 来自dw.json文件的值
[DwJsonSource] - - 来自~/.mobify文件的值
[MobifySource] - - 来自环境变量的值
[SFCC_*] - - 来自凭据插件的值
[password-store]
Configuration Priority
配置优先级
Values are resolved with this priority (highest to lowest):
- CLI flags and environment variables
- Plugin sources (high priority)
- dw.json file
- ~/.mobify file (MRT API key only)
- Plugin sources (low priority)
- package.json b2c key
When troubleshooting, check the source column to understand which configuration is taking precedence.
值的解析优先级从高到低如下:
- CLI标志和环境变量
- 插件来源(高优先级)
- dw.json文件
- ~/.mobify文件(仅MRT API密钥)
- 插件来源(低优先级)
- package.json中的b2c键
排查问题时,请查看来源列以了解哪个配置具有更高的优先级。
Common Issues
常见问题
Missing Values
缺失值
If a value shows , it means no source provided that configuration. Check:
-- Is the field spelled correctly in dw.json?
- Is the environment variable set?
- Does the plugin provide that value?
如果某个值显示为,表示没有来源提供该配置。请检查:
-- dw.json中的字段拼写是否正确?
- 环境变量是否已设置?
- 插件是否提供了该值?
Wrong Source Taking Precedence
错误的来源优先级
If a value comes from an unexpected source:
- Higher priority sources override lower ones
- Credential groups (username+password, clientId+clientSecret) are atomic
- Hostname mismatch protection may discard values
如果值来自意外的来源:
- 高优先级来源会覆盖低优先级来源
- 凭据组(username+password、clientId+clientSecret)是原子性的
- 主机名不匹配保护可能会丢弃值
Sensitive Values Masked
敏感值被屏蔽
By default, passwords and secrets show partial values like . Use to see full values when debugging authentication issues.
admi...REDACTED--unmask默认情况下,密码和密钥会显示为部分值,例如。调试身份验证问题时,请使用查看完整值。
admi...REDACTED--unmaskGetting Admin OAuth Tokens
获取管理员OAuth令牌
Use to get an admin OAuth access token for Account Manager credentials (OCAPI and Admin APIs). This is useful for testing APIs, scripting, or CI/CD pipelines.
b2c auth tokenbash
undefined使用命令获取用于Account Manager凭据的管理员OAuth访问令牌(适用于OCAPI和Admin API)。这在测试API、编写脚本或CI/CD流水线中非常有用。
b2c auth tokenbash
undefinedGet access token (outputs raw token to stdout)
获取访问令牌(将原始令牌输出到标准输出)
b2c auth token
b2c auth token
Get token with specific scopes
获取具有特定权限范围的令牌
b2c auth token --auth-scope sfcc.orders --auth-scope sfcc.products
b2c auth token --auth-scope sfcc.orders --auth-scope sfcc.products
Get token as JSON (includes expiration and scopes)
以JSON格式获取令牌(包含过期时间和权限范围)
b2c auth token --json
b2c auth token --json
Use in curl for OCAPI calls
在curl中使用令牌调用OCAPI
curl -H "Authorization: Bearer $(b2c auth token)"
"https://your-instance.dx.commercecloud.salesforce.com/s/-/dw/data/v24_1/sites"
"https://your-instance.dx.commercecloud.salesforce.com/s/-/dw/data/v24_1/sites"
The token is obtained using the `clientId` and `clientSecret` from your configuration (dw.json or environment variables). If only `clientId` is configured, an implicit OAuth flow is used (browser-based).
**Note:** This command returns **admin** tokens for OCAPI/Admin APIs. For **shopper** tokens (SLAS), see the [b2c-slas skill](../b2c-slas/SKILL.md).curl -H "Authorization: Bearer $(b2c auth token)"
"https://your-instance.dx.commercecloud.salesforce.com/s/-/dw/data/v24_1/sites"
"https://your-instance.dx.commercecloud.salesforce.com/s/-/dw/data/v24_1/sites"
令牌是使用配置中的`clientId`和`clientSecret`(来自dw.json或环境变量)获取的。如果仅配置了`clientId`,则会使用隐式OAuth流(基于浏览器)。
**注意:** 此命令返回的是用于OCAPI/Admin API的**管理员**令牌。如需**购物者**令牌(SLAS),请查看[b2c-slas skill](../b2c-slas/SKILL.md)。More Commands
更多命令
See for other setup commands including for AI agent skill installation.
b2c setup --helpb2c setup skills请查看获取其他设置命令,包括用于AI agent skill安装的。
b2c setup --helpb2c setup skills