Skip to content

Commit 6ec60bc

Browse files
committed
Merge main into t/commerce/W-20590941/mcp-server
2 parents 6bfc23b + 06a9aa8 commit 6ec60bc

41 files changed

Lines changed: 2980 additions & 713 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ docs/.vitepress/cache
2525
docs/api/
2626

2727
dw.json
28+
dw.json*

AGENTS.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
1+
# B2C CLI
12

2-
- this is a monorepo project; packages:
3-
- ./packages/b2c-cli - the command line interface built with oclif
4-
- ./packages/b2c-tooling-sdk - the SDK/library for B2C Commerce operations; support the CLI and can be used standalone
3+
This is a monorepo project with the following packages:
4+
- `./packages/b2c-cli` - the command line interface built with oclif
5+
- `./packages/b2c-tooling-sdk` - the SDK/library for B2C Commerce operations; supports the CLI and can be used standalone
6+
7+
## Common Commands
8+
9+
```bash
10+
# Install dependencies
11+
pnpm install
12+
13+
# Build all packages
14+
pnpm run build
15+
16+
# Build specific package
17+
pnpm --filter @salesforce/b2c-cli run build
18+
pnpm --filter @salesforce/b2c-tooling-sdk run build
19+
20+
# Run tests (includes linting)
21+
pnpm run test
22+
23+
# Dev mode for CLI (uses source files directly)
24+
pnpm --filter @salesforce/b2c-cli run dev
25+
# or using convenience script
26+
./cli
27+
28+
# Run tests for specific package
29+
pnpm --filter @salesforce/b2c-cli run test
30+
pnpm --filter @salesforce/b2c-tooling-sdk run test
31+
32+
# Format code with prettier
33+
pnpm run -r format
34+
35+
# Lint only (without tests)
36+
pnpm run -r lint
37+
```
538

639
## Setup/Packaging
740

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![CI](https://github.com/SalesforceCommerceCloud/b2c-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/SalesforceCommerceCloud/b2c-cli/actions/workflows/ci.yml)
44

55
> [!NOTE]
6-
> This project is currently in **Developer Preview** and will be open sourced in the future.
6+
> 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.
77
88
Salesforce Commerce Cloud B2C Command Line Tools.
99

b2c_log_center_stream3.png

-46.8 KB
Binary file not shown.

docs/.vitepress/config.mts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const guideSidebar = [
77
items: [
88
{ text: 'Introduction', link: '/guide/' },
99
{ text: 'Installation', link: '/guide/installation' },
10+
{ text: 'Authentication Setup', link: '/guide/authentication' },
1011
{ text: 'Configuration', link: '/guide/configuration' },
1112
],
1213
},
@@ -15,9 +16,13 @@ const guideSidebar = [
1516
items: [
1617
{ text: 'Overview', link: '/cli/' },
1718
{ text: 'Code Commands', link: '/cli/code' },
19+
{ text: 'Job Commands', link: '/cli/jobs' },
1820
{ text: 'Sites Commands', link: '/cli/sites' },
19-
{ text: 'Sandbox Commands', link: '/cli/sandbox' },
21+
{ text: 'WebDAV Commands', link: '/cli/webdav' },
22+
{ text: 'ODS Commands', link: '/cli/ods' },
2023
{ text: 'MRT Commands', link: '/cli/mrt' },
24+
{ text: 'SLAS Commands', link: '/cli/slas' },
25+
{ text: 'Auth Commands', link: '/cli/auth' },
2126
{ text: 'Logging', link: '/cli/logging' },
2227
],
2328
},

docs/cli/auth.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# Auth Commands
2+
3+
Commands for authentication and token management.
4+
5+
## b2c auth token
6+
7+
Get an OAuth access token for use in scripts or other tools.
8+
9+
### Usage
10+
11+
```bash
12+
b2c auth token
13+
```
14+
15+
### Flags
16+
17+
| Flag | Environment Variable | Description |
18+
|------|---------------------|-------------|
19+
| `--client-id` | `SFCC_CLIENT_ID` | Client ID for OAuth |
20+
| `--client-secret` | `SFCC_CLIENT_SECRET` | Client Secret for OAuth |
21+
| `--scope` | `SFCC_OAUTH_SCOPES` | OAuth scopes to request (can be repeated) |
22+
| `--account-manager-host` | `SFCC_ACCOUNT_MANAGER_HOST` | Account Manager hostname (default: account.demandware.com) |
23+
24+
### Examples
25+
26+
```bash
27+
# Get a token with default scopes
28+
b2c auth token --client-id xxx --client-secret yyy
29+
30+
# Get a token with specific scopes
31+
b2c auth token --scope sfcc.orders --scope sfcc.products
32+
33+
# Output as JSON (useful for parsing)
34+
b2c auth token --json
35+
36+
# Using environment variables
37+
export SFCC_CLIENT_ID=my-client
38+
export SFCC_CLIENT_SECRET=my-secret
39+
b2c auth token
40+
```
41+
42+
### Output
43+
44+
The command outputs the access token:
45+
46+
```
47+
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
48+
```
49+
50+
With `--json`:
51+
52+
```json
53+
{"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...","expires_in":1799}
54+
```
55+
56+
### Use Cases
57+
58+
#### Scripting
59+
60+
Use the token in shell scripts:
61+
62+
```bash
63+
TOKEN=$(b2c auth token)
64+
curl -H "Authorization: Bearer $TOKEN" https://my-instance.demandware.net/s/-/dw/data/v24_3/sites
65+
```
66+
67+
#### CI/CD Pipelines
68+
69+
Get a token for use with other tools:
70+
71+
```bash
72+
export SFCC_TOKEN=$(b2c auth token --json | jq -r '.token')
73+
```
74+
75+
#### Testing API Calls
76+
77+
Quickly get a token for testing OCAPI or SCAPI:
78+
79+
```bash
80+
b2c auth token | pbcopy # macOS: copy to clipboard
81+
```
82+
83+
---
84+
85+
## Authentication Overview
86+
87+
The CLI supports multiple authentication methods depending on the operation.
88+
89+
### Account Manager API Client (OAuth)
90+
91+
Most instance operations require an Account Manager API Client. The CLI supports two authentication methods:
92+
93+
| Auth Method | When Used | Role Configuration |
94+
|-------------|-----------|-------------------|
95+
| User Authentication | Only `--client-id` provided | Roles on your **user account** |
96+
| Client Credentials | Both `--client-id` and `--client-secret` provided | Roles on the **API client** |
97+
98+
```bash
99+
# User Authentication (opens browser for login)
100+
b2c ods list --client-id xxx
101+
102+
# Client Credentials
103+
export SFCC_CLIENT_ID=my-client
104+
export SFCC_CLIENT_SECRET=my-secret
105+
b2c ods list
106+
```
107+
108+
Used by:
109+
- Code management (`code list`, `code activate`, `code delete`)
110+
- Job operations (`job run`, `job search`, `job import`, `job export`)
111+
- Site operations (`sites list`)
112+
- ODS operations (requires `Sandbox API User` role)
113+
- SLAS operations (requires `SLAS Organization Administrator` or `Sandbox API User` role depending on auth method)
114+
115+
### Basic Auth (WebDAV)
116+
117+
WebDAV operations support Basic Auth using your Business Manager username and WebDAV access key:
118+
119+
```bash
120+
export SFCC_USERNAME=my-user
121+
export SFCC_PASSWORD=my-webdav-access-key
122+
```
123+
124+
Used by:
125+
- `code deploy` (file upload)
126+
- `code watch` (file upload)
127+
- `webdav` commands
128+
129+
### MRT API Key
130+
131+
Managed Runtime commands use a separate API key obtained from the MRT dashboard:
132+
133+
```bash
134+
export SFCC_MRT_API_KEY=your-mrt-api-key
135+
```
136+
137+
See [MRT Commands](./mrt#authentication) for details.
138+
139+
### Mixed Authentication
140+
141+
Some commands (like `code deploy` with `--reload`) require both OAuth and WebDAV access:
142+
143+
```bash
144+
export SFCC_CLIENT_ID=my-client
145+
export SFCC_CLIENT_SECRET=my-secret
146+
export SFCC_USERNAME=my-user
147+
export SFCC_PASSWORD=my-access-key
148+
b2c code deploy --reload
149+
```
150+
151+
### Configuration File
152+
153+
Credentials can be stored in a `dw.json` file:
154+
155+
```json
156+
{
157+
"client-id": "my-client",
158+
"client-secret": "my-secret",
159+
"username": "my-user",
160+
"password": "my-access-key"
161+
}
162+
```
163+
164+
Use `--config` to specify a custom config file path, or `--instance` to select a named instance configuration.
165+
166+
### Tenant Scope
167+
168+
For ODS and SLAS operations, your API client must have tenant scope configured for the realm/organization you wish to manage. This is set up in Account Manager when creating or editing the API client.

docs/cli/code.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ b2c code deploy [CARTRIDGEPATH]
8080

8181
In addition to [global flags](./index#global-flags):
8282

83-
| Flag | Short | Description | Default |
84-
|------|-------|-------------|---------|
85-
| `--reload` | `-r` | Reload (re-activate) code version after deploy | `false` |
86-
| `--delete` | | Delete existing cartridges before upload | `false` |
87-
| `--cartridge` | `-c` | Include specific cartridge(s) (can be repeated) | |
88-
| `--exclude-cartridge` | `-x` | Exclude specific cartridge(s) (can be repeated) | |
83+
| Flag | Description | Default |
84+
|------|-------------|---------|
85+
| `--reload`, `-r` | Reload (re-activate) code version after deploy | `false` |
86+
| `--delete` | Delete existing cartridges before upload | `false` |
87+
| `--cartridge`, `-c` | Include specific cartridge(s) (can be repeated) | |
88+
| `--exclude-cartridge`, `-x` | Exclude specific cartridge(s) (can be repeated) | |
8989

9090
### Examples
9191

@@ -154,9 +154,9 @@ b2c code activate [CODEVERSION]
154154

155155
In addition to [global flags](./index#global-flags):
156156

157-
| Flag | Short | Description | Default |
158-
|------|-------|-------------|---------|
159-
| `--reload` | `-r` | Reload the code version (toggle activation to force reload) | `false` |
157+
| Flag | Description | Default |
158+
|------|-------------|---------|
159+
| `--reload`, `-r` | Reload the code version (toggle activation to force reload) | `false` |
160160

161161
### Examples
162162

@@ -207,9 +207,9 @@ b2c code delete CODEVERSION
207207

208208
In addition to [global flags](./index#global-flags):
209209

210-
| Flag | Short | Description | Default |
211-
|------|-------|-------------|---------|
212-
| `--force` | `-f` | Skip confirmation prompt | `false` |
210+
| Flag | Description | Default |
211+
|------|-------------|---------|
212+
| `--force`, `-f` | Skip confirmation prompt | `false` |
213213

214214
### Examples
215215

@@ -254,10 +254,10 @@ b2c code watch [CARTRIDGEPATH]
254254

255255
In addition to [global flags](./index#global-flags):
256256

257-
| Flag | Short | Description |
258-
|------|-------|-------------|
259-
| `--cartridge` | `-c` | Include specific cartridge(s) (can be repeated) |
260-
| `--exclude-cartridge` | `-x` | Exclude specific cartridge(s) (can be repeated) |
257+
| Flag | Description |
258+
|------|-------------|
259+
| `--cartridge`, `-c` | Include specific cartridge(s) (can be repeated) |
260+
| `--exclude-cartridge`, `-x` | Exclude specific cartridge(s) (can be repeated) |
261261

262262
### Examples
263263

docs/cli/index.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,39 @@ These flags are available on all commands that interact with B2C instances:
88

99
### Instance Flags
1010

11-
| Flag | Short | Environment Variable | Description |
12-
|------|-------|---------------------|-------------|
13-
| `--server` | `-s` | `SFCC_SERVER` | B2C instance hostname |
14-
| `--webdav-server` | | `SFCC_WEBDAV_SERVER` | Separate WebDAV hostname (if different) |
15-
| `--code-version` | `-v` | `SFCC_CODE_VERSION` | Code version |
11+
| Flag | Environment Variable | Description |
12+
|------|---------------------|-------------|
13+
| `--server`, `-s` | `SFCC_SERVER` | B2C instance hostname |
14+
| `--webdav-server` | `SFCC_WEBDAV_SERVER` | Secure WebDAV hostname |
15+
| `--code-version`, `-v` | `SFCC_CODE_VERSION` | Code version |
1616

1717
### Authentication Flags
1818

19-
| Flag | Short | Environment Variable | Description |
20-
|------|-------|---------------------|-------------|
21-
| `--client-id` | | `SFCC_CLIENT_ID` | OAuth client ID |
22-
| `--client-secret` | | `SFCC_CLIENT_SECRET` | OAuth client secret |
23-
| `--username` | `-u` | `SFCC_USERNAME` | Username for Basic Auth |
24-
| `--password` | `-p` | `SFCC_PASSWORD` | Password/access key for Basic Auth |
19+
| Flag | Environment Variable | Description |
20+
|------|---------------------|-------------|
21+
| `--client-id` | `SFCC_CLIENT_ID` | OAuth client ID |
22+
| `--client-secret` | `SFCC_CLIENT_SECRET` | OAuth client secret |
23+
| `--username`, `-u` | `SFCC_USERNAME` | Username for Basic Auth |
24+
| `--password`, `-p` | `SFCC_PASSWORD` | Password/access key for Basic Auth |
2525

2626
## Command Topics
2727

28+
### Instance Operations
29+
2830
- [Code Commands](./code) - Deploy cartridges and manage code versions
2931
- [Job Commands](./jobs) - Execute and monitor jobs, import/export site archives
3032
- [Sites Commands](./sites) - List and manage sites
31-
- [Sandbox Commands](./sandbox) - Create and manage sandboxes
32-
- [MRT Commands](./mrt) - Manage Managed Runtime environments
33+
- [WebDAV Commands](./webdav) - File operations on instance WebDAV
34+
35+
### Services
36+
37+
- [ODS Commands](./ods) - Create and manage On-Demand Sandboxes (ODS)
38+
- [MRT Commands](./mrt) - Manage Managed Runtime (MRT) projects and deployments
39+
- [SLAS Commands](./slas) - Manage Shopper Login and Access Service (SLAS) API clients
3340

34-
## Configuration
41+
### Utilities
3542

43+
- [Auth Commands](./auth) - Authentication and token management
3644
- [Logging](./logging) - Log levels, output formats, and environment variables
3745

3846
## Getting Help

0 commit comments

Comments
 (0)