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 and Unofficial Slack.
Salesforce Commerce Cloud B2C Command Line Tools.
- Separate CLI and SDK packages
- Structured logging with redaction
- Localization support (i18next)
- Supply chain security via pnpm
This is a pnpm monorepo with the following packages:
| Package | Description |
|---|---|
b2c-cli |
Command line interface built with oclif |
b2c-tooling-sdk |
SDK/library for B2C Commerce operations; supports the CLI and can be used standalone |
b2c-dx-mcp |
MCP server for B2C Commerce developer experience tools |
- Node.js >= 22.16.0
- pnpm 10.17.1+
pnpm installpnpm start
# or directly:
pnpm --filter @salesforce/b2c-cli run dev
# or using convenience script:
./cliThe dev mode uses Node.js --conditions=development to resolve TypeScript source files directly from @salesforce/b2c-tooling-sdk without needing to build first.
# Build all packages
pnpm -r run build
# Build individual packages
pnpm --filter @salesforce/b2c-cli run build
pnpm --filter @salesforce/b2c-tooling-sdk run buildTests use Mocha + Chai with c8 for coverage. HTTP mocking uses MSW.
# Run all tests with coverage (also runs linter after tests)
pnpm test
# Run tests for a specific package
pnpm --filter @salesforce/b2c-tooling-sdk run test
# Run tests without coverage (faster)
pnpm --filter @salesforce/b2c-tooling-sdk run test:unit
# Watch mode for TDD
pnpm --filter @salesforce/b2c-tooling-sdk run test:watch
# Run a specific test file
cd packages/b2c-tooling-sdk
pnpm mocha "test/clients/webdav.test.ts"
# Run tests matching a pattern
pnpm mocha --grep "uploads a file" "test/**/*.test.ts"Coverage reports are generated in each package's coverage/ directory:
coverage/index.html- HTML reportcoverage/lcov.info- LCOV format for CI integration
The SDK package has a 5% coverage threshold that will fail the build if not met.
# Run linter only
pnpm --filter @salesforce/b2c-cli run lint
pnpm --filter @salesforce/b2c-tooling-sdk run lintThis project uses Prettier for code formatting.
# Format all packages
pnpm -r run format
# Check formatting without modifying files
pnpm -r run format:checkDocumentation is built using TypeDoc for API reference generation and VitePress for the documentation site.
docs/- VitePress documentation sourceguide/- User guide and getting startedcli/- CLI command referenceapi/- Generated API documentation (do not edit manually)
typedoc.json- TypeDoc configuration with entry points for SDK modules
pnpm run docs:devThis runs typedoc to generate API docs, then starts VitePress in development mode with hot reload.
pnpm run docs:buildpnpm run docs:previewAPI documentation is auto-generated from JSDoc comments in the @salesforce/b2c-tooling-sdk package. The entry points are defined in typedoc.json:
See the documentation site for the generated API reference.
auth- Authentication strategies (OAuth, API Key, Basic)instance- B2C instance configurationplatform- MRT and ODS clientsoperations/code- Cartridge code operationsoperations/jobs- Job executionoperations/sites- Site managementi18n- Internationalization utilitieslogging- Structured logging
When adding new public APIs, ensure they have comprehensive JSDoc comments as these will appear in the generated documentation.
The @salesforce/b2c-tooling-sdk package uses the exports field in package.json to define its public API surface. Each module is available as a subpath export:
import { OAuthStrategy } from '@salesforce/b2c-tooling-sdk/auth';
import { B2CInstance } from '@salesforce/b2c-tooling-sdk/instance';
import { getLogger } from '@salesforce/b2c-tooling-sdk/logging';The development condition in exports enables direct TypeScript source resolution when using --conditions=development, which is how bin/dev.js works for local development.
We welcome contributions! Please see our Contributing Guide for details on how to get started, submit pull requests, and our code of conduct.
For security concerns, please review our Security Policy. Report any security issues to security@salesforce.com.
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.