Skip to content

Commit 30873b5

Browse files
authored
Merge branch 'main' into W-21112167-Replications-API
2 parents 71d4485 + e763a35 commit 30873b5

30 files changed

Lines changed: 370 additions & 25 deletions

File tree

.changeset/stateful-auth.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#GUSINFO:CC Cosmos,B2C CLI and Developer Tools
22
* @clavery
33
/packages/b2c-dx-mcp/ @yhsieh1 @patricksullivansf @wei-liu-sf
4+
/packages/b2c-dx-mcp/src/tools/storefrontnext/ @commerce-emu/cc-sharks
45
/packages/b2c-vs-extension/ @wei-liu-sf
56
/docs/mcp/ @wei-liu-sf @yhsieh1 @patricksullivansf
67
/docs/.vitepress/ @wei-liu-sf @yhsieh1 @patricksullivansf

docs/.vitepress/config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const guidesSidebar = [
4343
items: [
4444
{text: 'Authentication Setup', link: '/guide/authentication'},
4545
{text: 'CI/CD with GitHub Actions', link: '/guide/ci-cd'},
46+
{text: 'sfcc-ci Migration', link: '/guide/sfcc-ci-migration'},
4647
{text: 'Account Manager', link: '/guide/account-manager'},
4748
{text: 'Analytics Reports (CIP/CCAC)', link: '/guide/analytics-reports-cip-ccac'},
4849
{text: 'IDE Integration', link: '/guide/ide-integration'},

docs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @salesforce/b2c-dx-docs
22

3+
## 0.2.7
4+
5+
### Patch Changes
6+
7+
- [#272](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/pull/272) [`e919e50`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/e919e502a7a0a6102c4039d003da0d90ab3673dc) - Added sfcc-ci migration guide with command mappings and CI/CD migration instructions. Added backward-compatible sfcc-ci command aliases (`client:auth`, `code:deploy`, `code:list`, `code:activate`, `job:run`, etc.) and environment variable aliases (`SFCC_OAUTH_CLIENT_ID`, `SFCC_OAUTH_CLIENT_SECRET`, `SFCC_LOGIN_URL`). (Thanks [@clavery](https://github.com/clavery)!)
8+
39
## 0.2.6
410

511
### Patch Changes

docs/cli/docs.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ b2c docs schema [query]
134134

135135
### Flags
136136

137-
| Flag | Description | Default |
138-
| -------------- | -------------------------- | ------- |
139-
| `--list`, `-l` | List all available schemas | `false` |
137+
| Flag | Description | Default |
138+
| -------------- | -------------------------------------------------------------- | ------- |
139+
| `--list`, `-l` | List all available schemas | `false` |
140+
| `--path`, `-p` | Print the filesystem path to the schema instead of its content | `false` |
140141

141142
### Examples
142143

@@ -152,11 +153,22 @@ b2c docs schema --list
152153

153154
# JSON output
154155
b2c docs schema catalog --json
156+
157+
# Get the filesystem path to a schema
158+
b2c docs schema catalog --path
155159
```
156160

157161
### Output
158162

159-
Without `--json`, the command writes schema XML directly to stdout. With `--list`, it prints available schema IDs and a total count.
163+
Without `--json`, the command writes schema XML directly to stdout. With `--path`, it prints the resolved filesystem path (useful for passing to XML validation tools). With `--list`, it prints available schema IDs and a total count.
164+
165+
### Validating XML with xmllint
166+
167+
Use the `--path` flag to pass schema paths directly to `xmllint` for XML validation (requires installation of `xmllint`):
168+
169+
```bash
170+
xmllint --schema "$(b2c docs schema catalog --path)" catalog.xml --noout
171+
```
160172

161173
---
162174

docs/guide/sfcc-ci-migration.md

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
---
2+
description: Migrate from sfcc-ci to @salesforce/b2c-cli with command mappings, environment variable compatibility, and CI/CD pipeline updates.
3+
---
4+
5+
# Migrating from sfcc-ci
6+
7+
[sfcc-ci](https://github.com/SalesforceCommerceCloud/sfcc-ci) is deprecated. The `@salesforce/b2c-cli` package is its replacement, providing the same core capabilities plus additional features.
8+
9+
If you haven't installed the B2C CLI yet, see the [Installation guide](./installation).
10+
11+
## Authentication
12+
13+
The biggest change from sfcc-ci is how authentication works by default.
14+
15+
**sfcc-ci** uses **stateful auth** — you run `sfcc-ci client:auth` once to store a token, then all subsequent commands use it automatically.
16+
17+
**b2c-cli** defaults to **stateless auth** — credentials are provided per-command via environment variables or flags. This is more explicit and works better in CI/CD pipelines where each step is independent.
18+
19+
### Stateful Auth (sfcc-ci Compatible)
20+
21+
For users who prefer the sfcc-ci workflow, the B2C CLI includes a compatibility layer that mirrors the stateful auth pattern:
22+
23+
| sfcc-ci | b2c-cli |
24+
|---------|---------|
25+
| `sfcc-ci client:auth <id> <secret>` | `b2c client:auth --client-id <id> --client-secret <secret>` |
26+
| `sfcc-ci client:auth:renew` | `b2c client:auth:renew` |
27+
| `sfcc-ci client:auth:token` | `b2c client:auth:token` |
28+
| `sfcc-ci auth:login [client]` | `b2c auth:login [client]` |
29+
| `sfcc-ci auth:logout` | `b2c auth:logout` |
30+
31+
The colon-separated forms are aliases — the canonical commands are `b2c auth client`, `b2c auth login`, etc.
32+
33+
After authenticating, subsequent commands automatically use the stored token when it is valid. See [Auth Commands](/cli/auth) for full details.
34+
35+
### Stateless Auth (Recommended for CI/CD)
36+
37+
For automation and CI/CD, set credentials as environment variables and the CLI uses them directly — no separate auth step needed:
38+
39+
```bash
40+
export SFCC_CLIENT_ID=my-client-id
41+
export SFCC_CLIENT_SECRET=my-secret
42+
43+
# Commands authenticate automatically
44+
b2c code list
45+
b2c sandbox list
46+
```
47+
48+
See [Authentication Setup](./authentication) for the full guide including Account Manager configuration, OCAPI permissions, and WebDAV access.
49+
50+
::: tip
51+
Use **stateless auth** (environment variables) for CI/CD pipelines and **stateful auth** (`b2c auth client` or `b2c auth login`) for local development.
52+
:::
53+
54+
## Command Mapping
55+
56+
The B2C CLI's canonical syntax uses spaces instead of colons (e.g., `b2c code deploy`), but for the most commonly used commands, sfcc-ci's colon-separated syntax is also accepted (e.g., `b2c code:deploy`). The tables below show the drop-in colon form where available.
57+
58+
### Code Management
59+
60+
| sfcc-ci | b2c-cli | Notes |
61+
|---------|---------|-------|
62+
| `sfcc-ci code:list` | `b2c code:list` | |
63+
| `sfcc-ci code:deploy <archive>` | `b2c code:deploy` | Deploys from local cartridge source |
64+
| `sfcc-ci code:activate <version>` | `b2c code:activate <version>` | |
65+
| `sfcc-ci code:delete` | `b2c code:delete` | |
66+
67+
### Instance / Data
68+
69+
| sfcc-ci | b2c-cli | Notes |
70+
|---------|---------|-------|
71+
| `sfcc-ci instance:upload <file>` | `b2c webdav put <file> <remote-path>` | See [WebDAV commands](/cli/webdav) |
72+
| `sfcc-ci instance:import <archive>` | `b2c content import <archive>` | Or `b2c job run sfcc-site-archive-import` |
73+
| `sfcc-ci instance:export` | `b2c content export` | See [Content commands](/cli/content) |
74+
75+
### Jobs
76+
77+
| sfcc-ci | b2c-cli | Notes |
78+
|---------|---------|-------|
79+
| `sfcc-ci job:run <id>` | `b2c job:run <id>` | Supports `--wait` and `--timeout` |
80+
| `sfcc-ci job:status <id> <exec>` | `b2c job wait <id> --execution-id <exec>` | |
81+
82+
### Sandbox
83+
84+
Sandbox commands map directly, with spaces replacing colons:
85+
86+
| sfcc-ci | b2c-cli |
87+
|---------|---------|
88+
| `sfcc-ci sandbox:list` | `b2c sandbox list` |
89+
| `sfcc-ci sandbox:create` | `b2c sandbox create` |
90+
| `sfcc-ci sandbox:get` | `b2c sandbox get` |
91+
| `sfcc-ci sandbox:delete` | `b2c sandbox delete` |
92+
| `sfcc-ci sandbox:start` | `b2c sandbox start` |
93+
| `sfcc-ci sandbox:stop` | `b2c sandbox stop` |
94+
| `sfcc-ci sandbox:restart` | `b2c sandbox restart` |
95+
| `sfcc-ci sandbox:reset` | `b2c sandbox reset` |
96+
| `sfcc-ci sandbox:alias:list` | `b2c sandbox alias list` |
97+
| `sfcc-ci sandbox:alias:add` | `b2c sandbox alias create` |
98+
| `sfcc-ci sandbox:alias:delete` | `b2c sandbox alias delete` |
99+
100+
### SLAS
101+
102+
| sfcc-ci | b2c-cli |
103+
|---------|---------|
104+
| `sfcc-ci slas:client:add` | `b2c slas client create` |
105+
| `sfcc-ci slas:client:get` | `b2c slas client get` |
106+
| `sfcc-ci slas:client:list` | `b2c slas client list` |
107+
| `sfcc-ci slas:client:delete` | `b2c slas client delete` |
108+
109+
### User / Org / Role (Account Manager)
110+
111+
Account Manager operations are under the `am` topic:
112+
113+
| sfcc-ci | b2c-cli |
114+
|---------|---------|
115+
| `sfcc-ci user:list` | `b2c am users list` |
116+
| `sfcc-ci user:create` | `b2c am users create` |
117+
| `sfcc-ci user:delete` | `b2c am users delete` |
118+
| `sfcc-ci org:list` | `b2c am orgs list` |
119+
| `sfcc-ci role:list` | `b2c am roles list` |
120+
| `sfcc-ci role:grant` | `b2c am roles grant` |
121+
| `sfcc-ci role:revoke` | `b2c am roles revoke` |
122+
123+
## Environment Variables
124+
125+
Most sfcc-ci environment variables are supported directly or through backward-compatible aliases. Existing CI/CD configurations using these variables will continue to work.
126+
127+
| sfcc-ci | b2c-cli | Status |
128+
|---------|---------|--------|
129+
| `SFCC_OAUTH_CLIENT_ID` | `SFCC_CLIENT_ID` | Both accepted |
130+
| `SFCC_OAUTH_CLIENT_SECRET` | `SFCC_CLIENT_SECRET` | Both accepted |
131+
| `SFCC_LOGIN_URL` | `SFCC_ACCOUNT_MANAGER_HOST` | Both accepted |
132+
| `SFCC_OAUTH_USER_NAME` | `SFCC_OAUTH_USER_NAME` | Same |
133+
| `SFCC_OAUTH_USER_PASSWORD` | `SFCC_OAUTH_USER_PASSWORD` | Same |
134+
| `SFCC_SANDBOX_API_HOST` | `SFCC_SANDBOX_API_HOST` | Same |
135+
| `SFCC_SCAPI_SHORTCODE` | `SFCC_SHORTCODE` | Renamed |
136+
| `SFCC_SCAPI_TENANTID` | `SFCC_TENANT_ID` | Renamed |
137+
138+
The B2C CLI also introduces new environment variables not present in sfcc-ci:
139+
140+
| Variable | Purpose |
141+
|----------|---------|
142+
| `SFCC_SERVER` | B2C instance hostname |
143+
| `SFCC_USERNAME` | WebDAV / Basic auth username |
144+
| `SFCC_PASSWORD` | WebDAV / Basic auth password |
145+
| `SFCC_CODE_VERSION` | Code version for deployments |
146+
| `SFCC_AUTH_METHODS` | Auth method priority (comma-separated) |
147+
148+
See the [Configuration guide](./configuration) for the complete list of environment variables and configuration sources.
149+
150+
## Configuration
151+
152+
The `dw.json` configuration file is fully supported. Fields are normalized to camelCase (e.g., `client-id` in the file becomes `clientId` internally), but both kebab-case and camelCase are accepted.
153+
154+
The B2C CLI adds a layered configuration system with a clear priority order:
155+
156+
1. CLI flags (highest priority)
157+
2. Environment variables (`SFCC_*`)
158+
3. `dw.json` in the current directory
159+
4. Instance configuration (`b2c setup instance`)
160+
5. Defaults (lowest priority)
161+
162+
Instance management uses `b2c setup instance create` instead of `sfcc-ci instance:add`. See the [Configuration guide](./configuration) for details.
163+
164+
## CI/CD Migration
165+
166+
### Before (sfcc-ci)
167+
168+
sfcc-ci CI/CD pipelines typically authenticate first, then run commands:
169+
170+
```bash
171+
# Authenticate (stores token)
172+
sfcc-ci client:auth $SFCC_OAUTH_CLIENT_ID $SFCC_OAUTH_CLIENT_SECRET
173+
174+
# Deploy code
175+
sfcc-ci code:deploy build/code.zip -i $INSTANCE
176+
sfcc-ci code:activate v1 -i $INSTANCE
177+
```
178+
179+
### After (b2c-cli — stateless)
180+
181+
With the B2C CLI, set environment variables and run commands directly:
182+
183+
```bash
184+
# No separate auth step — credentials are used automatically
185+
export SFCC_CLIENT_ID=$SFCC_OAUTH_CLIENT_ID
186+
export SFCC_CLIENT_SECRET=$SFCC_OAUTH_CLIENT_SECRET
187+
export SFCC_SERVER=$INSTANCE
188+
189+
b2c code deploy
190+
b2c code activate v1
191+
```
192+
193+
### After (b2c-cli — stateful, sfcc-ci compatible)
194+
195+
If you prefer minimal changes to your existing pipeline scripts:
196+
197+
```bash
198+
# Same pattern as sfcc-ci — colon-separated aliases are supported
199+
b2c client:auth --client-id $SFCC_OAUTH_CLIENT_ID --client-secret $SFCC_OAUTH_CLIENT_SECRET
200+
201+
b2c code:deploy
202+
b2c code:activate v1 --server $INSTANCE
203+
```
204+
205+
### GitHub Actions
206+
207+
The B2C CLI provides official GitHub Actions that handle installation, credential configuration, and caching automatically. See the [CI/CD with GitHub Actions](./ci-cd) guide for complete examples and action reference.
208+
209+
## Next Steps
210+
211+
- [Installation](./installation) — install the B2C CLI
212+
- [Authentication Setup](./authentication) — configure API clients, OCAPI, and WebDAV
213+
- [Configuration](./configuration) — environment variables, dw.json, and instance management
214+
- [CI/CD with GitHub Actions](./ci-cd) — official GitHub Actions for automation
215+
- [CLI Reference](/cli/) — browse all available commands

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@salesforce/b2c-dx-docs",
3-
"version": "0.2.6",
3+
"version": "0.2.7",
44
"private": true,
55
"description": "Documentation for B2C Developer Tooling",
66
"scripts": {

packages/b2c-cli/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# @salesforce/b2c-cli
22

3+
## 0.9.0
4+
5+
### Minor Changes
6+
7+
- [#167](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/pull/167) [`caa568e`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/caa568e9de3e8c9d3f2e7b17e5f96c1a0ae3ca73) - Introduces stateful authentication: `auth login` (browser/implicit), `auth logout`, `auth client` (client_credentials/password), `auth client renew`, and `auth client token`. Sessions are stored as a JSON file in the CLI data directory; when a valid session exists, all OAuth commands use it automatically without requiring credentials on every invocation. (Thanks [@amit-kumar8-sf](https://github.com/amit-kumar8-sf)!)
8+
9+
**Note:** Sessions are not shared with `sfcc-ci`. Re-authenticate with `b2c auth login` or `b2c auth client` after upgrading. Existing stateless auth (env vars, `dw.json`) is unaffected.
10+
11+
### Patch Changes
12+
13+
- [`b30e427`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/b30e427f25807840dbcceef6c0005e2d9fd1be53) - Add `--path` flag to `b2c docs schema` to print the filesystem path to a schema file instead of its content, enabling use with tools like `xmllint` for XML validation. (Thanks [@clavery](https://github.com/clavery)!)
14+
15+
- [#272](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/pull/272) [`e919e50`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/e919e502a7a0a6102c4039d003da0d90ab3673dc) - Added sfcc-ci migration guide with command mappings and CI/CD migration instructions. Added backward-compatible sfcc-ci command aliases (`client:auth`, `code:deploy`, `code:list`, `code:activate`, `job:run`, etc.) and environment variable aliases (`SFCC_OAUTH_CLIENT_ID`, `SFCC_OAUTH_CLIENT_SECRET`, `SFCC_LOGIN_URL`). (Thanks [@clavery](https://github.com/clavery)!)
16+
17+
- Updated dependencies [[`b30e427`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/b30e427f25807840dbcceef6c0005e2d9fd1be53), [`e919e50`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/e919e502a7a0a6102c4039d003da0d90ab3673dc), [`caa568e`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/caa568e9de3e8c9d3f2e7b17e5f96c1a0ae3ca73)]:
18+
- @salesforce/b2c-tooling-sdk@0.10.0
19+
320
## 0.8.0
421

522
### Minor Changes

packages/b2c-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/b2c-cli",
33
"description": "A Salesforce B2C Commerce CLI",
4-
"version": "0.8.0",
4+
"version": "0.9.0",
55
"author": "Charles Lavery",
66
"bin": {
77
"b2c": "./bin/run.js"

packages/b2c-cli/src/commands/auth/client/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {t} from '../../../i18n/index.js';
2121
* Use --renew to enable automatic token renewal for later use with `auth client renew`.
2222
*/
2323
export default class AuthClient extends BaseCommand<typeof AuthClient> {
24+
static hiddenAliases = ['client:auth'];
25+
2426
static description = t('commands.auth.client.description', 'Authenticate an API client and save session');
2527

2628
static examples = [
@@ -34,16 +36,19 @@ export default class AuthClient extends BaseCommand<typeof AuthClient> {
3436
'client-id': Flags.string({
3537
description: 'Client ID for OAuth',
3638
env: 'SFCC_CLIENT_ID',
39+
default: async () => process.env.SFCC_OAUTH_CLIENT_ID || undefined,
3740
helpGroup: 'AUTH',
3841
}),
3942
'client-secret': Flags.string({
4043
description: 'Client secret for OAuth',
4144
env: 'SFCC_CLIENT_SECRET',
45+
default: async () => process.env.SFCC_OAUTH_CLIENT_SECRET || undefined,
4246
helpGroup: 'AUTH',
4347
}),
4448
'account-manager-host': Flags.string({
4549
description: `Account Manager hostname for OAuth (default: ${DEFAULT_ACCOUNT_MANAGER_HOST})`,
4650
env: 'SFCC_ACCOUNT_MANAGER_HOST',
51+
default: async () => process.env.SFCC_LOGIN_URL || undefined,
4752
helpGroup: 'AUTH',
4853
}),
4954
'auth-scope': Flags.string({

0 commit comments

Comments
 (0)