Salesforce Agentforce Commerce B2C CLI

[!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.
Installation
npm (Recommended)
npm install -g @salesforce/b2c-cli
Homebrew (macOS/Linux)
brew tap SalesforceCommerceCloud/tools
brew install b2c-cli
GitHub Release Tarball
For pre-release versions not yet published to npm, download the tarball from GitHub Releases and install:
npm install -g ./salesforce-b2c-cli-<version>.tgz
Usage
b2c COMMAND
b2c --help [COMMAND]
Configuration
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
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 |
Commands
Code Management
Deploy and manage code versions on B2C Commerce instances.
b2c code list
b2c code deploy --server my-sandbox.demandware.net --code-version v1
b2c code watch
b2c code activate v1
b2c code delete old-version
Jobs and Site Import/Export
Execute jobs and manage site archives.
b2c job run my-job --wait
b2c job import ./site-data.zip
b2c job export --global-data meta_data
b2c job search --status RUNNING
On-Demand Sandboxes (ODS)
Create and manage on-demand sandboxes.
b2c ods list
b2c ods create
b2c ods get <sandbox-id>
b2c ods start <sandbox-id>
b2c ods stop <sandbox-id>
b2c ods restart <sandbox-id>
b2c ods delete <sandbox-id>
Managed Runtime (MRT)
Manage MRT projects, environments, and deployments.
b2c mrt push --project my-storefront --environment staging
b2c mrt env create staging --project my-storefront --name "Staging"
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 staging
SLAS Client Management
Manage Shopper Login and API Security (SLAS) clients.
b2c slas client list
b2c slas client create --name "My App"
b2c slas client get <client-id>
b2c slas client update <client-id>
b2c slas client delete <client-id>
WebDAV Operations
File operations on instance WebDAV.
b2c webdav ls /cartridges
b2c webdav put local-file.txt /remote/path/
b2c webdav get /remote/path/file.txt
b2c webdav mkdir /remote/new-dir
b2c webdav rm /remote/path/file.txt
b2c webdav zip /remote/dir archive.zip
b2c webdav unzip /remote/archive.zip
Sites
List and inspect storefront sites.
b2c sites list
User Management (Account Manager)
Manage users in Account Manager.
b2c am users list --page 0 --size 20
b2c am users get user@example.com
b2c am users create --org org-id --mail user@example.com --first-name John --last-name Doe
b2c am users update user@example.com --first-name Jane
b2c am users reset user@example.com
b2c am users delete user@example.com
Role Management (Account Manager)
Manage roles and role assignments in Account Manager.
b2c am roles list --page 0 --size 20 --target-type User
b2c am roles get bm-admin
b2c am roles grant user@example.com --role bm-admin
b2c am roles grant user@example.com --role bm-admin --scope "tenant1,tenant2"
b2c am roles revoke user@example.com --role bm-admin
Organization Management (Account Manager)
Manage organizations in Account Manager.
b2c am orgs list --page 0 --size 25
b2c am orgs list --all
b2c am orgs get org-123
b2c am orgs get "My Organization"
b2c am orgs audit org-123
b2c am orgs audit org-123 --extended
Authentication
Get OAuth tokens for scripting.
b2c auth token
Logging
Control log output with flags or environment variables:
b2c code deploy --log-level debug
b2c code deploy -D
b2c code deploy --json
See the documentation for more logging options.
Documentation
Full documentation is available at: https://salesforcecommercecloud.github.io/b2c-developer-tooling/
License
This project is licensed under the Apache License 2.0. See LICENSE.txt for full details.
Disclaimer
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.