Skip to content

Commit 3a4aae9

Browse files
committed
Add sfcc-ci migration guide, command aliases, and env var compatibility
Add migration guide at docs/guide/sfcc-ci-migration.md covering authentication changes, command mapping tables, environment variable compatibility, and CI/CD migration patterns. Add hidden command aliases for sfcc-ci backward compatibility (client:auth, code:deploy, code:list, code:activate, code:delete, job:run, etc.). Add environment variable fallbacks for sfcc-ci names (SFCC_OAUTH_CLIENT_ID, SFCC_OAUTH_CLIENT_SECRET, SFCC_LOGIN_URL) in both CLI flags and SDK env source.
1 parent caa568e commit 3a4aae9

15 files changed

Lines changed: 255 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@salesforce/b2c-dx-docs': patch
3+
'@salesforce/b2c-tooling-sdk': patch
4+
'@salesforce/b2c-cli': patch
5+
---
6+
7+
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`).

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/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 auth client --client-id <id> --client-secret <secret>` |
26+
| `sfcc-ci client:auth:renew` | `b2c auth client renew` |
27+
| `sfcc-ci client:auth:token` | `b2c auth client 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 (`client:auth`, `client:auth:renew`, `client:auth:token`, `auth:login`, `auth:logout`) are also accepted as aliases.
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 uses space-separated commands instead of colons (e.g., `code deploy` instead of `code:deploy`). For the most commonly used commands, colon-separated aliases are also accepted for backward compatibility.
57+
58+
### Code Management
59+
60+
| sfcc-ci | b2c-cli | Notes |
61+
|---------|---------|-------|
62+
| `sfcc-ci code:list` | `b2c code list` | Also accepts `code:list` |
63+
| `sfcc-ci code:deploy <archive>` | `b2c code deploy` | Deploys from local cartridge source; also accepts `code:deploy` |
64+
| `sfcc-ci code:activate <version>` | `b2c code activate <version>` | Also accepts `code:activate` |
65+
| `sfcc-ci code:delete` | `b2c code delete` | Also accepts `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>` | Also accepts `job:run`; 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
199+
b2c auth client --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

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({

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {t} from '../../../i18n/index.js';
1919
* to client_credentials grant using the stored base64-encoded client:secret.
2020
*/
2121
export default class AuthClientRenew extends BaseCommand<typeof AuthClientRenew> {
22+
static hiddenAliases = ['client:auth:renew'];
23+
2224
static description = t('commands.auth.client.renew.description', 'Renew the client authentication token');
2325

2426
static examples = ['<%= config.bin %> <%= command.id %>'];
@@ -27,6 +29,7 @@ export default class AuthClientRenew extends BaseCommand<typeof AuthClientRenew>
2729
'account-manager-host': Flags.string({
2830
description: `Account Manager hostname for OAuth (default: ${DEFAULT_ACCOUNT_MANAGER_HOST})`,
2931
env: 'SFCC_ACCOUNT_MANAGER_HOST',
32+
default: async () => process.env.SFCC_LOGIN_URL || undefined,
3033
helpGroup: 'AUTH',
3134
}),
3235
};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ interface AuthClientTokenOutput {
2525
* Mirrors sfcc-ci `client:auth:token` command behavior.
2626
*/
2727
export default class AuthClientToken extends BaseCommand<typeof AuthClientToken> {
28+
static hiddenAliases = ['client:auth:token'];
29+
2830
static description = t(
2931
'commands.auth.client.token.description',
3032
'Return the current authentication token (stateful)',

packages/b2c-cli/src/commands/auth/login.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {t, withDocs} from '../../i18n/index.js';
1515
* until it expires or you run auth:logout.
1616
*/
1717
export default class AuthLogin extends BaseCommand<typeof AuthLogin> {
18+
static hiddenAliases = ['auth:login'];
19+
1820
static args = {
1921
clientId: Args.string({
2022
description: 'Client ID for OAuth (falls back to SFCC_CLIENT_ID env var)',
@@ -33,6 +35,7 @@ export default class AuthLogin extends BaseCommand<typeof AuthLogin> {
3335
'account-manager-host': Flags.string({
3436
description: `Account Manager hostname for OAuth (default: ${DEFAULT_ACCOUNT_MANAGER_HOST})`,
3537
env: 'SFCC_ACCOUNT_MANAGER_HOST',
38+
default: async () => process.env.SFCC_LOGIN_URL || undefined,
3639
helpGroup: 'AUTH',
3740
}),
3841
'auth-scope': Flags.string({

packages/b2c-cli/src/commands/auth/logout.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {t, withDocs} from '../../i18n/index.js';
1313
* (client credentials or implicit) when configured.
1414
*/
1515
export default class AuthLogout extends BaseCommand<typeof AuthLogout> {
16+
static hiddenAliases = ['auth:logout'];
17+
1618
static description = withDocs(
1719
t('commands.auth.logout.description', 'Clear stored session (stateful auth)'),
1820
'/cli/auth.html#b2c-auth-logout',

packages/b2c-cli/src/commands/code/activate.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {activateCodeVersion, reloadCodeVersion} from '@salesforce/b2c-tooling-sd
99
import {t, withDocs} from '../../i18n/index.js';
1010

1111
export default class CodeActivate extends InstanceCommand<typeof CodeActivate> {
12+
static hiddenAliases = ['code:activate'];
13+
1214
static args = {
1315
codeVersion: Args.string({
1416
description: 'Code version ID to activate',

packages/b2c-cli/src/commands/code/delete.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ async function confirm(message: string): Promise<boolean> {
2727
}
2828

2929
export default class CodeDelete extends InstanceCommand<typeof CodeDelete> {
30+
static hiddenAliases = ['code:delete'];
31+
3032
static args = {
3133
codeVersion: Args.string({
3234
description: 'Code version ID to delete',

0 commit comments

Comments
 (0)