Skip to content

Latest commit

 

History

History
291 lines (193 loc) · 6.3 KB

README.md

File metadata and controls

291 lines (193 loc) · 6.3 KB

Salesforce Agentforce Commerce B2C CLI

oclif

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

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

Commands

Code Management

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-version

Jobs and Site Import/Export

Execute 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 RUNNING

On-Demand Sandboxes (ODS)

Create 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>

Managed Runtime (MRT)

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 staging

SLAS Client Management

Manage 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>

WebDAV Operations

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.zip

Sites

List and inspect storefront sites.

b2c sites list

User Management (Account Manager)

Manage 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.com

Role Management (Account Manager)

Manage 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-admin

Organization Management (Account Manager)

Manage 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 --extended

Authentication

Get OAuth tokens for scripting.

b2c auth token

Logging

Control 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 --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.