Note
This project is currently in Developer Preview. Not all features are implemented, and the API may change in future releases. Please provide feedback via GitHub issues.
A command-line interface for Salesforce Agentforce Commerce (formerly Commerce Cloud) B2C instances and platform services.
npm install -g @salesforce/b2c-clibrew tap SalesforceCommerceCloud/tools
brew install b2c-cliFor pre-release versions not yet published to npm, download the tarball from GitHub Releases and install:
npm install -g ./salesforce-b2c-cli-<version>.tgzb2c COMMAND
b2c --help [COMMAND]The CLI can be configured via command-line flags or environment variables:
See the documentation for full configuration options: https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/configuration.html
| Environment Variable | Description |
|---|---|
SFCC_SERVER |
B2C instance hostname |
SFCC_CODE_VERSION |
Code version |
SFCC_CLIENT_ID |
OAuth client ID |
SFCC_CLIENT_SECRET |
OAuth client secret |
SFCC_USERNAME |
Username for WebDAV |
SFCC_PASSWORD |
Password/access key for WebDAV |
Deploy and manage code versions on B2C Commerce instances.
# List code versions
b2c code list
# Deploy cartridges
b2c code deploy --server my-sandbox.demandware.net --code-version v1
# Watch and sync changes during development
b2c code watch
# Activate a code version
b2c code activate v1
# Delete a code version
b2c code delete old-versionExecute jobs and manage site archives.
# Run a job
b2c job run my-job --wait
# Import a site archive
b2c job import ./site-data.zip
# Export site data
b2c job export --global-data meta_data
# Search job executions
b2c job search --status RUNNINGCreate and manage on-demand sandboxes.
# List sandboxes
b2c ods list
# Create a new sandbox
b2c ods create
# Get sandbox details
b2c ods get <sandbox-id>
# Start/stop/restart a sandbox
b2c ods start <sandbox-id>
b2c ods stop <sandbox-id>
b2c ods restart <sandbox-id>
# Delete a sandbox
b2c ods delete <sandbox-id>Manage MRT projects, environments, and deployments.
# Push a bundle
b2c mrt push --project my-storefront --environment staging
# Create an environment
b2c mrt env create staging --project my-storefront --name "Staging"
# Manage environment variables
b2c mrt env var list -p my-project -e staging
b2c mrt env var set API_KEY=secret -p my-project -e staging
b2c mrt env var delete OLD_KEY -p my-project -e stagingManage Shopper Login and API Security (SLAS) clients.
# List SLAS clients
b2c slas client list
# Create a client
b2c slas client create --name "My App"
# Get client details
b2c slas client get <client-id>
# Update a client
b2c slas client update <client-id>
# Delete a client
b2c slas client delete <client-id>File operations on instance WebDAV.
# List files
b2c webdav ls /cartridges
# Upload/download files
b2c webdav put local-file.txt /remote/path/
b2c webdav get /remote/path/file.txt
# Create directory
b2c webdav mkdir /remote/new-dir
# Delete files
b2c webdav rm /remote/path/file.txt
# Archive operations
b2c webdav zip /remote/dir archive.zip
b2c webdav unzip /remote/archive.zipList and inspect storefront sites.
b2c sites listManage users in Account Manager.
# List users with pagination
b2c am users list --page 0 --size 20
# Get user details by email
b2c am users get user@example.com
# Create a new user
b2c am users create --org org-id --mail user@example.com --first-name John --last-name Doe
# Update a user
b2c am users update user@example.com --first-name Jane
# Reset a user to INITIAL state
b2c am users reset user@example.com
# Delete (disable) a user
b2c am users delete user@example.comManage roles and role assignments in Account Manager.
# List roles with pagination
b2c am roles list --page 0 --size 20 --target-type User
# Get role details
b2c am roles get bm-admin
# Grant a role to a user
b2c am roles grant user@example.com --role bm-admin
# Grant a role with tenant scope
b2c am roles grant user@example.com --role bm-admin --scope "tenant1,tenant2"
# Revoke a role from a user
b2c am roles revoke user@example.com --role bm-adminManage organizations in Account Manager.
# List organizations with pagination
b2c am orgs list --page 0 --size 25
# List all organizations
b2c am orgs list --all
# Get organization details by ID
b2c am orgs get org-123
# Get organization details by name
b2c am orgs get "My Organization"
# Get audit logs for an organization
b2c am orgs audit org-123
# Get audit logs with extended columns
b2c am orgs audit org-123 --extendedGet OAuth tokens for scripting.
b2c auth tokenControl log output with flags or environment variables:
# Debug logging
b2c code deploy --log-level debug
b2c code deploy -D # shorthand
# JSON output for scripting
b2c code deploy --jsonSee the documentation for more logging options.
Full documentation is available at: https://salesforcecommercecloud.github.io/b2c-developer-tooling/
This project is licensed under the Apache License 2.0. See LICENSE.txt for full details.
This project is currently in Developer Preview and is provided "as-is" without warranty of any kind. It is not yet generally available (GA) and should not be used in production environments. Features, APIs, and functionality may change without notice in future releases.