Skip to content

Commit 92e59da

Browse files
committed
documentation updates
1 parent b42df58 commit 92e59da

9 files changed

Lines changed: 1197 additions & 372 deletions

File tree

AGENTS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ pnpm --filter @salesforce/b2c-tooling-sdk run build
2020
# Run tests (includes linting)
2121
pnpm run test
2222

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+
2328
# Run tests for specific package
2429
pnpm --filter @salesforce/b2c-cli run test
2530
pnpm --filter @salesforce/b2c-tooling-sdk run test
@@ -29,9 +34,6 @@ pnpm run -r format
2934

3035
# Lint only (without tests)
3136
pnpm run -r lint
32-
33-
# Run CLI in development mode
34-
./packages/b2c-cli/bin/dev.js <command>
3537
```
3638

3739
## Setup/Packaging

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

docs/cli/auth.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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+
### OAuth Client Credentials
90+
91+
Most commands use OAuth client credentials authentication:
92+
93+
```bash
94+
export SFCC_CLIENT_ID=my-client
95+
export SFCC_CLIENT_SECRET=my-secret
96+
```
97+
98+
Required for:
99+
- Code management (`code list`, `code activate`, `code delete`)
100+
- Job operations (`job run`, `job search`, `job import`, `job export`)
101+
- Site operations (`sites list`)
102+
- ODS operations
103+
- SLAS operations
104+
- MRT operations
105+
106+
### Basic Auth (WebDAV)
107+
108+
WebDAV operations support Basic Auth for better performance:
109+
110+
```bash
111+
export SFCC_USERNAME=my-user
112+
export SFCC_PASSWORD=my-access-key
113+
```
114+
115+
Used by:
116+
- `code deploy` (file upload)
117+
- `code watch` (file upload)
118+
- `webdav` commands
119+
120+
### Mixed Authentication
121+
122+
Some commands (like `code deploy`) require both OAuth and WebDAV access. You can provide both:
123+
124+
```bash
125+
export SFCC_CLIENT_ID=my-client
126+
export SFCC_CLIENT_SECRET=my-secret
127+
export SFCC_USERNAME=my-user
128+
export SFCC_PASSWORD=my-access-key
129+
b2c code deploy --reload
130+
```
131+
132+
### Configuration File
133+
134+
Credentials can also be stored in a `dw.json` file:
135+
136+
```json
137+
{
138+
"client-id": "my-client",
139+
"client-secret": "my-secret",
140+
"username": "my-user",
141+
"password": "my-access-key"
142+
}
143+
```
144+
145+
Use `--config` to specify a custom config file path, or `--instance` to select a named instance configuration.

docs/cli/index.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ These flags are available on all commands that interact with B2C instances:
1111
| Flag | Short | Environment Variable | Description |
1212
|------|-------|---------------------|-------------|
1313
| `--server` | `-s` | `SFCC_SERVER` | B2C instance hostname |
14-
| `--webdav-server` | | `SFCC_WEBDAV_SERVER` | Separate WebDAV hostname (if different) |
14+
| `--webdav-server` | | `SFCC_WEBDAV_SERVER` | Secure WebDAV hostname |
1515
| `--code-version` | `-v` | `SFCC_CODE_VERSION` | Code version |
1616

1717
### Authentication Flags
@@ -25,14 +25,22 @@ These flags are available on all commands that interact with B2C instances:
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)