Skip to content

Commit b74d199

Browse files
committed
Merge remote-tracking branch 'upstream/main' into W-21766978-Add-scheduling-user-email
2 parents 3148d6c + fd1b1d0 commit b74d199

63 files changed

Lines changed: 4041 additions & 336 deletions

Some content is hidden

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

.changeset/code-deploy-activate-flag.md

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

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
if: steps.release-type.outputs.type == 'nightly' || (steps.changesets.outputs.skip != 'true' && steps.quick-check.outputs.skip != 'true')
112112
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
113113
with:
114-
node-version: 22
114+
node-version: '22.22.1'
115115
cache: 'pnpm'
116116
registry-url: 'https://registry.npmjs.org'
117117

docs/.vitepress/config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const guidesSidebar = [
4949
{text: 'Analytics Reports (CIP/CCAC)', link: '/guide/analytics-reports-cip-ccac'},
5050
{text: 'IDE Integration', link: '/guide/ide-integration'},
5151
{text: 'Scaffolding', link: '/guide/scaffolding'},
52+
{text: 'Safety Mode', link: '/guide/safety'},
5253
{text: 'Security', link: '/guide/security'},
5354
{text: 'Storefront Next', link: '/guide/storefront-next'},
5455
{text: 'MRT Utilities', link: '/guide/mrt-utilities'},

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.13
4+
5+
### Patch Changes
6+
7+
- [#318](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/pull/318) [`6880a84`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/6880a846aacd029a1eb510023aa76f4b844ec26e) - Added per-instance safety configuration with rule-based actions (allow/block/confirm) and interactive confirmation mode. Safety can now be configured in `dw.json` with granular rules for HTTP paths, job IDs, and CLI commands. (Thanks [@clavery](https://github.com/clavery)!)
8+
39
## 0.2.12
410

511
### Patch Changes

docs/cli/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ b2c sandbox list # ✅ Allowed
5151
b2c sandbox create --realm test # ❌ Blocked
5252
```
5353

54-
Safety Mode operates at the HTTP layer and cannot be bypassed by command-line flags. See the [Security Guide](/guide/security#operational-security-safety-mode) for detailed information.
54+
Safety Mode operates at the HTTP layer and cannot be bypassed by command-line flags. See the [Safety Mode](/guide/safety) guide for detailed information.
5555

5656
### Other Environment Variables
5757

docs/cli/sandbox.md

Lines changed: 173 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,79 @@ If detailed usage data is present (granular history, profiles, etc.), the comman
615615

616616
---
617617

618+
## b2c sandbox settings
619+
620+
Show effective OCAPI and WebDAV settings for a specific sandbox.
621+
622+
### Usage
623+
624+
```bash
625+
b2c sandbox settings <SANDBOXID>
626+
```
627+
628+
### Arguments
629+
630+
| Argument | Description | Required |
631+
|----------|-------------|----------|
632+
| `SANDBOXID` | Sandbox ID (UUID or realm-instance, e.g., `zzzv-123`) | Yes |
633+
634+
### Examples
635+
636+
```bash
637+
# Show settings summary for a sandbox
638+
b2c sandbox settings zzzz-001
639+
640+
# Output full settings payload as JSON
641+
b2c sandbox settings zzzz-001 --json
642+
```
643+
644+
### Output
645+
646+
When not using `--json`, the command prints:
647+
648+
- Number of OCAPI client entries
649+
- Number of WebDAV client entries
650+
- A short per-client breakdown for each settings type
651+
652+
---
653+
654+
## b2c sandbox storage
655+
656+
Show filesystem storage usage for a specific sandbox.
657+
658+
### Usage
659+
660+
```bash
661+
b2c sandbox storage <SANDBOXID>
662+
```
663+
664+
### Arguments
665+
666+
| Argument | Description | Required |
667+
|----------|-------------|----------|
668+
| `SANDBOXID` | Sandbox ID (UUID or realm-instance, e.g., `zzzv-123`) | Yes |
669+
670+
### Examples
671+
672+
```bash
673+
# Show storage table for a sandbox
674+
b2c sandbox storage zzzz-001
675+
676+
# Output raw storage response as JSON
677+
b2c sandbox storage zzzz-001 --json
678+
```
679+
680+
### Output
681+
682+
When not using `--json`, the command prints a table with one row per filesystem:
683+
684+
- Filesystem name
685+
- Total space (MB)
686+
- Used space (MB)
687+
- Used percentage
688+
689+
---
690+
618691
## Sandbox Aliases
619692

620693
Sandbox aliases let you access a sandbox via a custom hostname instead of the default instance hostname.
@@ -976,56 +1049,86 @@ For the complete response including all metadata, use the `--json` flag.
9761049

9771050
## Realm-Level Commands
9781051

979-
Realm commands operate at the **realm** level rather than on an individual sandbox. They are available as both `realm` topic commands and as `sandbox realm` subcommands:
1052+
Realm commands operate at the **realm** level rather than on an individual sandbox. Use them under the existing sandbox topics:
9801053

981-
- `b2c realm list` (`b2c sandbox realm list`)
982-
- `b2c realm get` (`b2c sandbox realm get`)
983-
- `b2c realm update` (`b2c sandbox realm update`)
984-
- `b2c realm usage` (`b2c sandbox realm usage`)
1054+
- `b2c sandbox realm list` (or `b2c ods realm list`)
1055+
- `b2c sandbox realm configuration` (or `b2c ods realm configuration`)
1056+
- `b2c sandbox realm get` (or `b2c ods realm get`)
1057+
- `b2c sandbox realm update` (or `b2c ods realm update`)
1058+
- `b2c sandbox realm usage` (or `b2c ods realm usage`)
1059+
- `b2c sandbox realm usages` (or `b2c ods realm usages`)
9851060

9861061
### Required Access for Realm Commands
9871062

988-
To run `b2c realm` commands, your user or API client must have **realm‑level access** in Account Manager (typically a role ending in `_sbx` for sandbox management).
1063+
To run `b2c sandbox realm` (or `b2c ods realm`) commands, your user or API client must have **realm‑level access** in Account Manager (typically a role ending in `_sbx` for sandbox management).
9891064

990-
### b2c realm list
1065+
### b2c sandbox realm list
9911066

9921067
List realms eligible for sandbox management.
9931068

9941069
#### Usage
9951070

9961071
```bash
997-
b2c realm list [REALM]
1072+
b2c sandbox realm list [REALM]
9981073
```
9991074

10001075
#### Arguments
10011076

10021077
| Argument | Description | Required |
10031078
|----------|-------------|----------|
1004-
| `REALM` | Specific realm ID (four-letter ID) to get details for | No |
1079+
| `REALM` | Optional realm ID filter (four-letter ID) | No |
10051080

10061081
#### Examples
10071082

10081083
```bash
10091084
# List all realms you can manage
1010-
b2c realm list
1085+
b2c sandbox realm list
10111086

10121087
# List a single realm
1013-
b2c realm list zzzz
1088+
b2c sandbox realm list zzzz
10141089

10151090
# JSON output
1016-
b2c realm list --json
1091+
b2c sandbox realm list --json
10171092
```
10181093

1019-
When `REALM` is omitted, the command discovers realms from the `/me` endpoint and then fetches configuration for each.
1094+
When `REALM` is omitted, the command discovers realms from the `/me` endpoint.
1095+
1096+
### b2c sandbox realm configuration
10201097

1021-
### b2c realm get
1098+
Get sandbox configuration for a specific realm.
1099+
1100+
#### Usage
1101+
1102+
```bash
1103+
b2c sandbox realm configuration <REALM>
1104+
```
1105+
1106+
#### Arguments
1107+
1108+
| Argument | Description | Required |
1109+
|----------|-------------|----------|
1110+
| `REALM` | Realm ID (four-letter ID) | Yes |
1111+
1112+
#### Examples
1113+
1114+
```bash
1115+
# Get realm sandbox configuration
1116+
b2c sandbox realm configuration zzzz
1117+
1118+
# JSON output
1119+
b2c sandbox realm configuration zzzz --json
1120+
```
1121+
1122+
When not using `--json`, the command prints configuration details such as emails, sandbox limits, TTL values, and start/stop schedulers.
1123+
1124+
### b2c sandbox realm get
10221125

10231126
Get detailed information about a specific realm, including configuration.
10241127

10251128
#### Usage
10261129

10271130
```bash
1028-
b2c realm get <REALM>
1131+
b2c sandbox realm get <REALM>
10291132
```
10301133

10311134
#### Arguments
@@ -1038,10 +1141,10 @@ b2c realm get <REALM>
10381141

10391142
```bash
10401143
# Get realm details
1041-
b2c realm get zzzz
1144+
b2c sandbox realm get zzzz
10421145

10431146
# JSON output (includes configuration and account details when available)
1044-
b2c realm get zzzz --json
1147+
b2c sandbox realm get zzzz --json
10451148
```
10461149

10471150
#### Output
@@ -1058,14 +1161,14 @@ The command prints:
10581161
- Whether local users are allowed
10591162
- Start/stop scheduler definitions (as JSON) when present
10601163

1061-
### b2c realm update
1164+
### b2c sandbox realm update
10621165

10631166
Update realm‑level sandbox configuration for TTL and start/stop schedulers.
10641167

10651168
#### Usage
10661169

10671170
```bash
1068-
b2c realm update <REALM> [FLAGS]
1171+
b2c sandbox realm update <REALM> [FLAGS]
10691172
```
10701173

10711174
#### Arguments
@@ -1096,30 +1199,30 @@ The scheduler flags expect a JSON value or the literal string `"null"`:
10961199

10971200
```bash
10981201
# Set max TTL to unlimited and default TTL to 24 hours
1099-
b2c realm update zzzz --max-sandbox-ttl 0 --default-sandbox-ttl 24
1202+
b2c sandbox realm update zzzz --max-sandbox-ttl 0 --default-sandbox-ttl 24
11001203

11011204
# Configure weekday start/stop schedules
1102-
b2c realm update zzzz \
1205+
b2c sandbox realm update zzzz \
11031206
--start-scheduler '{"weekdays":["MONDAY","TUESDAY"],"time":"08:00:00Z"}' \
11041207
--stop-scheduler '{"weekdays":["MONDAY","TUESDAY"],"time":"19:00:00Z"}'
11051208

11061209
# Remove an existing stop scheduler
1107-
b2c realm update zzzz --stop-scheduler "null"
1210+
b2c sandbox realm update zzzz --stop-scheduler "null"
11081211

11091212
# Update realm emails and local user setting
11101213
b2c realm update zzzz --emails dev@example.com,ops@example.com --local-users-allowed
11111214
```
11121215

11131216
If no update flags are provided, the command fails with a helpful error explaining which flags can be used.
11141217

1115-
### b2c realm usage
1218+
### b2c sandbox realm usage
11161219

11171220
Show usage information for a realm across all sandboxes in that realm.
11181221

11191222
#### Usage
11201223

11211224
```bash
1122-
b2c realm usage <REALM> [FLAGS]
1225+
b2c sandbox realm usage <REALM> [FLAGS]
11231226
```
11241227

11251228
#### Arguments
@@ -1141,13 +1244,13 @@ b2c realm usage <REALM> [FLAGS]
11411244

11421245
```bash
11431246
# Realm usage for a recent window
1144-
b2c realm usage zzzz
1247+
b2c sandbox realm usage zzzz
11451248

11461249
# Realm usage for a specific range
1147-
b2c realm usage zzzz --from 2024-01-01 --to 2024-01-31
1250+
b2c sandbox realm usage zzzz --from 2024-01-01 --to 2024-01-31
11481251

11491252
# Daily granularity with full JSON response
1150-
b2c realm usage zzzz --granularity daily --detailed-report --json
1253+
b2c sandbox realm usage zzzz --granularity daily --detailed-report --json
11511254
```
11521255

11531256
When not using `--json`, the command prints a summary including:
@@ -1159,3 +1262,46 @@ When not using `--json`, the command prints a summary including:
11591262

11601263
If detailed usage is available, it prints a hint to re-run with `--json` for the full structure. If no usage data is returned for the requested period, it prints a friendly message instead of failing.
11611264

1265+
### b2c sandbox realm usages
1266+
1267+
Show usage information for multiple realms in one request.
1268+
1269+
#### Usage
1270+
1271+
```bash
1272+
b2c sandbox realm usages [FLAGS]
1273+
```
1274+
1275+
#### Flags
1276+
1277+
| Flag | Description |
1278+
|------|-------------|
1279+
| `--realm` | Realm IDs to include (repeat flag or provide comma-separated values) |
1280+
| `--from` | Earliest date to include in usage (ISO 8601) |
1281+
| `--to` | Latest date to include in usage (ISO 8601) |
1282+
| `--detailed-report` | Include detailed usage information in the response |
1283+
1284+
If `--realm` is omitted, the command auto-discovers realms from `/me` and queries usage for all discovered realms.
1285+
1286+
#### Examples
1287+
1288+
```bash
1289+
# Usage for all realms available to the current user
1290+
b2c sandbox realm usages
1291+
1292+
# Usage for two specific realms
1293+
b2c sandbox realm usages --realm zzzz --realm yyyy
1294+
1295+
# Usage for comma-separated realms and date range
1296+
b2c sandbox realm usages --realm zzzz,yyyy --from 2024-01-01 --to 2024-01-31
1297+
1298+
# Detailed report in JSON
1299+
b2c sandbox realm usages --detailed-report --json
1300+
```
1301+
1302+
When not using `--json`, the command prints one row per realm with summary metrics such as:
1303+
1304+
- Active / created / deleted sandbox counts
1305+
- Minutes up / minutes down
1306+
- Sandbox seconds
1307+

docs/guide/configuration.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ You can configure the CLI using environment variables:
8484
| `MRT_PROJECT` | MRT project slug (`SFCC_MRT_PROJECT` also supported) |
8585
| `MRT_ENVIRONMENT` | MRT environment name (`SFCC_MRT_ENVIRONMENT`, `MRT_TARGET` also supported) |
8686
| `MRT_CLOUD_ORIGIN` | MRT API origin URL override (`SFCC_MRT_CLOUD_ORIGIN` also supported) |
87-
| `SFCC_SAFETY_LEVEL` | Safety mode: `NONE`, `NO_DELETE`, `NO_UPDATE`, `READ_ONLY` (see [Safety Mode](/guide/security#operational-security-safety-mode)) |
87+
| `SFCC_SAFETY_LEVEL` | Safety mode: `NONE`, `NO_DELETE`, `NO_UPDATE`, `READ_ONLY` (see [Safety Mode](/guide/safety)) |
88+
| `SFCC_SAFETY_CONFIRM` | Enable confirmation mode for safety: `true` or `1` (see [Safety Mode](/guide/safety#confirmation-mode)) |
89+
| `SFCC_SAFETY_CONFIG` | Path to global safety config file (see [Safety Mode](/guide/safety#global-safety-config)) |
8890

8991
## .env File
9092

@@ -150,6 +152,8 @@ For projects that work with multiple instances, use the `configs` array:
150152
}
151153
```
152154

155+
Each instance can have its own `safety` configuration for per-instance operational safety. See [Safety Mode](/guide/safety#per-instance-configuration) for details.
156+
153157
Use the `-i` or `--instance` flag to select a specific configuration:
154158

155159
```bash

0 commit comments

Comments
 (0)