Skip to content

Commit 1b89924

Browse files
authored
Merge branch 'main' into W-21112167-Replications-API
2 parents aec6304 + 0c4e288 commit 1b89924

102 files changed

Lines changed: 2362 additions & 2407 deletions

File tree

Some content is hidden

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

.changeset/job-log-command.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@salesforce/b2c-cli': minor
3+
---
4+
5+
Add `job log` command to retrieve and display job execution logs. Supports fetching logs for a specific execution or automatically finding the most recent (or most recent failed) execution with a log file.

.claude/skills/testing/SKILL.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,29 @@ const customAuth = new MockAuthStrategy('custom-token');
324324

325325
## Silencing Test Output
326326

327-
Commands may produce console output (tables, formatted displays) even in tests. Use these helpers to keep test output clean.
327+
Commands produce console output (tables, formatted displays) during tests. **All test helpers are designed to keep test output clean by default** — no extra work needed in most cases.
328328

329-
### Using runSilent for Output Capture
329+
### stubCommandConfigAndLogger Silences Output Automatically
330330

331-
The `runSilent` helper uses oclif's `captureOutput` to suppress stdout/stderr:
331+
The `stubCommandConfigAndLogger` helper (used by AM and sandbox command tests) automatically stubs `command.log`, `command.logToStderr`, and `ux.stdout` so no output leaks to the console:
332+
333+
```typescript
334+
import { stubCommandConfigAndLogger } from '../../../helpers/test-setup.js';
335+
336+
it('displays client details in non-JSON mode', async () => {
337+
const command = new ClientGet([], {} as any);
338+
stubCommandConfigAndLogger(command); // stdout is silenced automatically
339+
stubJsonEnabled(command, false);
340+
// ... setup ...
341+
342+
const result = await command.run(); // No console noise
343+
expect(result.id).to.equal('client-123');
344+
});
345+
```
346+
347+
### Using runSilent for Other Cases
348+
349+
For commands that don't use `stubCommandConfigAndLogger`, use `runSilent` to capture stdout/stderr:
332350

333351
```typescript
334352
import { runSilent } from '../../helpers/test-setup.js';
@@ -344,24 +362,22 @@ it('returns data in non-JSON mode', async () => {
344362
});
345363
```
346364

347-
Use `runSilent` when:
348-
- Testing non-JSON output modes (tables, formatted displays)
349-
- The test doesn't need to verify console output content
350-
- You want clean test output with only pass/fail summary
351-
352365
### When Output Verification is Needed
353366

354-
If you need to verify console output, stub `ux.stdout` directly:
367+
If you need to verify console output content, stub `ux.stdout` directly **before** calling `stubCommandConfigAndLogger` (which checks if the stub already exists):
355368

356369
```typescript
357370
import { ux } from '@oclif/core';
358371

359372
it('prints table in non-JSON mode', async () => {
360373
const stdoutStub = sinon.stub(ux, 'stdout');
374+
stubCommandConfigAndLogger(command); // won't double-stub ux.stdout
361375

362376
await command.run();
363377

364378
expect(stdoutStub.called).to.be.true;
379+
const text = stdoutStub.firstCall.args[0];
380+
expect(text).to.include('expected content');
365381
});
366382
```
367383

.github/workflows/changesets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2323

2424
- name: Setup pnpm
25-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
25+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
2626

2727
- name: Setup Node.js
2828
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ jobs:
6060
- name: Build packages
6161
run: pnpm -r run build
6262

63-
- name: Build documentation
64-
run: pnpm run docs:build
65-
6663
- name: Run SDK tests
6764
id: sdk-test
6865
working-directory: packages/b2c-tooling-sdk

.github/workflows/docs.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Docs Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'docs/**'
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
build-docs:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 22.x
29+
30+
- name: Setup pnpm
31+
uses: pnpm/action-setup@v4
32+
with:
33+
version: 10.17.1
34+
35+
- name: Get pnpm store directory
36+
shell: bash
37+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
38+
39+
- name: Setup pnpm cache
40+
uses: actions/cache@v4
41+
with:
42+
path: ${{ env.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
46+
47+
- name: Install dependencies
48+
run: pnpm install --frozen-lockfile
49+
50+
- name: Build packages
51+
run: pnpm -r run build
52+
53+
- name: Build documentation
54+
run: pnpm run docs:build

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
106106
- name: Setup pnpm
107107
if: steps.release-type.outputs.type == 'nightly' || (steps.changesets.outputs.skip != 'true' && steps.quick-check.outputs.skip != 'true')
108-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
108+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
109109

110110
- name: Setup Node.js
111111
if: steps.release-type.outputs.type == 'nightly' || (steps.changesets.outputs.skip != 'true' && steps.quick-check.outputs.skip != 'true')

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ This catches prettier formatting, import ordering, class member ordering (`perfe
161161

162162
See [testing skill](./.claude/skills/testing/SKILL.md) for patterns on writing tests with Mocha, Chai, and MSW.
163163

164+
**Stdout in tests**: Command tests must not leak output to the console. `stubCommandConfigAndLogger()` silences `command.log`, `command.logToStderr`, and `ux.stdout` automatically. For other cases, use `runSilent()` from `test/helpers/test-setup.ts`.
165+
164166
## Changesets
165167

166168
This project uses [Changesets](https://github.com/changesets/changesets) for version management with **independent per-package versioning**. Each package versions independently based on its own changesets.

docs/cli/jobs.md

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ Configure these resources in Business Manager under **Administration** > **Site
1717
| Resource | Methods | Commands |
1818
|----------|---------|----------|
1919
| `/jobs/*/executions` | POST | `job run` |
20-
| `/jobs/*/executions/*` | GET | `job run --wait`, `job wait` |
21-
| `/job_execution_search` | POST | `job search` |
20+
| `/jobs/*/executions/*` | GET | `job run --wait`, `job wait`, `job log` |
21+
| `/job_execution_search` | POST | `job search`, `job log` |
2222

2323
### WebDAV Access
2424

25-
The `job import` and `job export` commands also require WebDAV access for file transfer.
25+
The `job import`, `job export`, and `job log` commands also require WebDAV access for file transfer.
2626

2727
### Configuration
2828

@@ -199,6 +199,59 @@ The command displays a table of job executions with:
199199

200200
---
201201

202+
## b2c job log
203+
204+
Retrieve the log for a job execution. When no execution ID is provided, the command finds the most recent execution that has a log file.
205+
206+
### Usage
207+
208+
```bash
209+
b2c job log JOBID [EXECUTIONID]
210+
```
211+
212+
### Arguments
213+
214+
| Argument | Description | Required |
215+
|----------|-------------|----------|
216+
| `JOBID` | Job ID | Yes |
217+
| `EXECUTIONID` | Execution ID (if omitted, finds the most recent execution with a log) | No |
218+
219+
### Flags
220+
221+
In addition to [global flags](./index#global-flags):
222+
223+
| Flag | Description | Default |
224+
|------|-------------|---------|
225+
| `--failed` | Find the most recent failed execution with a log | `false` |
226+
227+
### Examples
228+
229+
```bash
230+
# Get the most recent log for a job
231+
b2c job log my-custom-job
232+
233+
# Get the most recent failed log
234+
b2c job log my-custom-job --failed
235+
236+
# Get the log for a specific execution
237+
b2c job log my-custom-job abc123-def456
238+
239+
# Output as JSON (includes execution metadata and log content)
240+
b2c job log my-custom-job --json
241+
242+
# Pipe log to a file
243+
b2c job log my-custom-job > job.log
244+
```
245+
246+
### Notes
247+
248+
- Not all job executions produce log files. The command will skip executions without logs when searching.
249+
- Log content is written to stdout, making it easy to pipe to a file or other tools.
250+
- Status messages are written to stderr so they don't interfere with piped output.
251+
- The `job log` command requires WebDAV access to retrieve log files.
252+
253+
---
254+
202255
## b2c job import
203256

204257
Import a site archive to a B2C Commerce instance using the `sfcc-site-archive-import` system job.

packages/b2c-cli/CHANGELOG.md

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

3+
## 0.7.4
4+
5+
### Patch Changes
6+
7+
- [`4cf7249`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/4cf72497f5e01d627de7aae80290d072f4c914f6) - Add `cartridges` config option to specify which cartridges to deploy/watch. Supports comma or colon-separated strings, or arrays in dw.json. Also accepts `cartridgesPath` as an alias. The `-c` flag still takes precedence when provided. (Thanks [@clavery](https://github.com/clavery)!)
8+
9+
- [#264](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/pull/264) [`9996eba`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/9996eba2a8fe53a27bf52fb208eb722d618cd282) - Fix multiple issues with the hook scaffold (#247): (Thanks [@clavery](https://github.com/clavery)!)
10+
11+
- Updated dependencies [[`16bd9d6`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/16bd9d6a1c658d6ba3de04fa3acf89295e1e5e06), [`4cf7249`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/4cf72497f5e01d627de7aae80290d072f4c914f6), [`9996eba`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/9996eba2a8fe53a27bf52fb208eb722d618cd282), [`d50bf6b`](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/commit/d50bf6b91dcd40314f10c8c97a28805039161213)]:
12+
- @salesforce/b2c-tooling-sdk@0.9.0
13+
314
## 0.7.3
415

516
### Patch Changes

packages/b2c-cli/package.json

Lines changed: 2 additions & 2 deletions
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.7.3",
4+
"version": "0.7.4",
55
"author": "Charles Lavery",
66
"bin": {
77
"b2c": "./bin/run.js"
@@ -311,7 +311,7 @@
311311
"build": "shx rm -rf dist && tsc -p tsconfig.build.json",
312312
"lint": "eslint",
313313
"lint:agent": "eslint --quiet",
314-
"typecheck:agent": "tsc --noEmit --pretty false",
314+
"typecheck:agent": "tsc --noEmit -p test --pretty false",
315315
"format": "prettier --write src",
316316
"format:check": "prettier --check src",
317317
"postpack": "shx rm -f oclif.manifest.json",

0 commit comments

Comments
 (0)