Skip to content

Commit b72ed8c

Browse files
committed
Document VS Code extension and expand test coverage
Add a /vscode-extension/ docs section (overview, installation with dynamic VSIX download link, configuration, features) parallel to the MCP Server section. Replace the placeholder activation test with a real Extension Host integration suite, fix the rootDir trap so unit tests can import production code directly, and add unit tests for WebDavMappingsProvider and SandboxConfigProvider. Extend ci-vs-extension.yml to also run on SDK changes and cache the .vscode-test binary.
1 parent f1a4ac0 commit b72ed8c

42 files changed

Lines changed: 997 additions & 130 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@salesforce/b2c-dx-docs': patch
3+
---
4+
5+
Document the B2C DX VS Code Extension. New `/vscode-extension/` section with overview, installation (with a dynamic download link to the latest VSIX release), configuration reference, and a feature tour covering Sandbox Realm Explorer, Cartridge Code Sync, WebDAV Browser, Content Libraries, SCAPI API Browser, B2C Script Debugger, scaffold/CAP install, log tailing, and B2C CLI plugin support.

.github/workflows/ci-vs-extension.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@ on:
66
- main
77
paths:
88
- 'packages/b2c-vs-extension/**'
9+
- 'packages/b2c-tooling-sdk/**'
10+
- 'pnpm-lock.yaml'
11+
- 'pnpm-workspace.yaml'
12+
- '.github/workflows/ci-vs-extension.yml'
913
pull_request:
1014
branches:
1115
- main
1216
paths:
1317
- 'packages/b2c-vs-extension/**'
18+
- 'packages/b2c-tooling-sdk/**'
19+
- 'pnpm-lock.yaml'
20+
- 'pnpm-workspace.yaml'
21+
- '.github/workflows/ci-vs-extension.yml'
1422

1523
permissions:
1624
contents: read
@@ -51,6 +59,14 @@ jobs:
5159
restore-keys: |
5260
${{ runner.os }}-pnpm-store-
5361
62+
- name: Cache VS Code test binary
63+
uses: actions/cache@v5
64+
with:
65+
path: packages/b2c-vs-extension/.vscode-test
66+
key: ${{ runner.os }}-vscode-test-${{ hashFiles('packages/b2c-vs-extension/.vscode-test.mjs') }}
67+
restore-keys: |
68+
${{ runner.os }}-vscode-test-
69+
5470
- name: Install dependencies
5571
run: pnpm install --frozen-lockfile
5672

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ docs/.vitepress/cache
2727
docs/api/
2828

2929
*dw.json*
30+
!packages/b2c-vs-extension/src/test/fixtures/**/dw.json
3031
.env
3132
.config/wt.toml
3233
.b2c/

docs/.vitepress/config.mts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ const guidesSidebar = [
8686
{text: 'Figma Tools Setup', link: '/mcp/figma-tools-setup'},
8787
],
8888
},
89+
{
90+
text: 'VS Code Extension',
91+
items: [
92+
{text: 'Overview', link: '/vscode-extension/'},
93+
{text: 'Installation', link: '/vscode-extension/installation'},
94+
{text: 'Configuration', link: '/vscode-extension/configuration'},
95+
{text: 'Features', link: '/vscode-extension/features'},
96+
],
97+
},
8998
{
9099
text: 'Extending',
91100
items: [
@@ -197,7 +206,7 @@ document.addEventListener('click', (e) => {
197206

198207
export default defineConfig({
199208
title: 'B2C Developer Toolkit',
200-
description: 'Agentic B2C Developer Toolkit — CLI, Agent Skills, MCP Server, SDK, and IDE extensions for Salesforce B2C Commerce',
209+
description: 'Agentic B2C Developer Toolkit — CLI, Agent Skills, MCP Server, SDK, and the B2C DX VS Code Extension for Salesforce B2C Commerce',
201210
base: basePath,
202211

203212
head: [['script', {}, versionSwitchScript]],
@@ -264,6 +273,7 @@ export default defineConfig({
264273
{text: 'Guides', link: '/guide/'},
265274
{text: 'Skills', link: '/guide/agent-skills'},
266275
{text: 'MCP', link: '/mcp/'},
276+
{text: 'VS Code', link: '/vscode-extension/'},
267277
{text: 'Reference', link: '/cli/'},
268278
{text: 'SDK', link: '/api/'},
269279
{
@@ -280,6 +290,7 @@ export default defineConfig({
280290
sidebar: {
281291
'/mcp/tools/': referenceSidebar,
282292
'/mcp/': guidesSidebar,
293+
'/vscode-extension/': guidesSidebar,
283294
'/cli/': referenceSidebar,
284295
'/guide/': guidesSidebar,
285296
'/api/': [

docs/guide/ide-integration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ description: Configure IDE tooling like Prophet VS Code extension and IntelliJ S
44

55
# IDE Integration
66

7-
This guide explains how to connect IDE extensions to your B2C CLI configuration.
7+
This guide explains how to connect third-party IDE extensions (Prophet, IntelliJ SFCC) to your B2C CLI configuration.
8+
9+
> Looking for the **Salesforce-published B2C DX VS Code Extension**? See the dedicated [VS Code Extension](../vscode-extension/) section — it consumes `dw.json` and the active instance directly, no bridge script required.
810
911
## Prophet VS Code Extension
1012

docs/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ renameNotice:
1010
hero:
1111
name: Agentic B2C Developer Toolkit
1212
text: ""
13-
tagline: CLI, Agent Skills, MCP Server, and IDE extensions for Salesforce Agentforce Commerce — everything you and your coding agent need to build, deploy, and operate B2C Commerce together.
13+
tagline: CLI, Agent Skills, MCP Server, and the B2C DX VS Code Extension for Salesforce Agentforce Commerce — everything you and your coding agent need to build, deploy, and operate B2C Commerce together.
1414
image:
1515
src: /hero-collage.png
1616
alt: Agentic B2C Developer Toolkit — CLI, Agentforce Vibes, and Claude Code
@@ -53,6 +53,14 @@ features:
5353
details: A focused set of MCP tools that complement the CLI for agent-driven workflows. Pairs naturally with skills.
5454
link: /mcp/
5555
linkText: MCP Server
56+
- icon:
57+
src: /icons/cli.svg
58+
width: 48
59+
height: 48
60+
title: VS Code Extension (Developer Preview)
61+
details: B2C DX activity-bar containers for sandbox lifecycle, cartridge code sync, WebDAV, content libraries, SCAPI, and a B2C script debugger — all driven by the same dw.json the CLI uses.
62+
link: /vscode-extension/
63+
linkText: VS Code Extension
5664
---
5765

5866
## Install the CLI
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
description: Configure the B2C DX VS Code Extension — feature toggles, log level, sandbox polling, and project root pinning.
3+
---
4+
5+
# Configuration
6+
7+
The extension reads B2C Commerce credentials from the same sources as the [B2C CLI](../guide/configuration) (`dw.json`, `SFCC_*` environment variables, `~/.dw.json`, etc.). This page covers the **VS Code-specific** settings under the `b2c-dx.*` namespace, configurable via **Settings** (Cmd+,) → search for `b2c-dx`, or directly in `settings.json`.
8+
9+
<!-- TODO(screenshot): settings.png — Settings UI filtered to b2c-dx -->
10+
![B2C DX settings](./images/settings.png)
11+
12+
## Feature Toggles
13+
14+
Each feature is enabled by default. Disable any toggle to hide its tree views, commands, and context-menu entries — useful when you want a leaner UI or are debugging activation issues.
15+
16+
| Setting | Default | What it controls |
17+
| ------- | ------- | ---------------- |
18+
| `b2c-dx.features.sandboxExplorer` | `true` | Sandbox Realm Explorer view + lifecycle commands |
19+
| `b2c-dx.features.webdavBrowser` | `true` | WebDAV Browser tree + `b2c-webdav://` filesystem provider |
20+
| `b2c-dx.features.contentLibraries` | `true` | Content Libraries tree + export/import commands |
21+
| `b2c-dx.features.codeSync` | `true` | Cartridges view, watch/deploy, code-version commands |
22+
| `b2c-dx.features.logTailing` | `true` | Log tail commands + B2C DX log output channel |
23+
| `b2c-dx.features.scaffold` | `true` | "New from Scaffold..." command and file/newFile menu entry |
24+
| `b2c-dx.features.apiBrowser` | `true` | SCAPI API Browser view + Swagger UI panel |
25+
| `b2c-dx.features.cap` | `true` | Commerce App Package install command + file decorations |
26+
27+
```jsonc
28+
// .vscode/settings.json
29+
{
30+
"b2c-dx.features.sandboxExplorer": true,
31+
"b2c-dx.features.codeSync": true,
32+
"b2c-dx.features.apiBrowser": false
33+
}
34+
```
35+
36+
The B2C Script Debugger registers regardless of these toggles — it activates only when a `b2c-script` launch configuration is used.
37+
38+
## Log Level
39+
40+
| Setting | Default | Description |
41+
| ------- | ------- | ----------- |
42+
| `b2c-dx.logLevel` | `info` | Verbosity for the **B2C DX** output channel |
43+
44+
Allowed values: `trace`, `debug`, `info`, `warn`, `error`, `silent`. The setting is applied immediately on change — no reload needed.
45+
46+
<!-- TODO(screenshot): output-channel.png — B2C DX output channel showing log stream -->
47+
![B2C DX output channel](./images/output-channel.png)
48+
49+
The output channel surfaces SDK logs (request/response summaries, safety-mode evaluations, polling events) plus extension lifecycle events. Drop to `debug` or `trace` when filing a bug report.
50+
51+
## Sandbox Polling Interval
52+
53+
| Setting | Default | Range | Description |
54+
| ------- | ------- | ----- | ----------- |
55+
| `b2c-dx.sandbox.pollingInterval` | `10` | 2–300 | Seconds between polls while a sandbox is in a transitional state |
56+
57+
The Sandbox Realm Explorer auto-polls a realm only when at least one sandbox is in a transitional state (`creating`, `starting`, `stopping`, `deleting`, `cloning`). Once the realm is fully settled, polling stops.
58+
59+
```jsonc
60+
{
61+
"b2c-dx.sandbox.pollingInterval": 5
62+
}
63+
```
64+
65+
## Project Root Pinning
66+
67+
In a multi-root workspace, the extension auto-detects the project root by walking up from the active editor (or the first workspace folder) looking for `dw.json` / `package.json` markers. Two commands let you override the auto-detected root:
68+
69+
- **B2C DX: Use as B2C Commerce Root** — right-click any folder in the Explorer and select this command to pin it. The status bar shows a `$(pinned)` indicator while a pin is active.
70+
- **B2C DX: Reset B2C Commerce Root to Auto-Detect** — clears the pin and returns to auto-detection.
71+
72+
The pin is workspace-scoped (stored in workspace state). Pin a specific folder when you have multiple cartridge projects in a single workspace and want to keep CLI commands targeting one of them.
73+
74+
## Next Steps
75+
76+
- [Features](./features) — full feature tour.
77+
- [Authentication Setup](../guide/authentication) — credential formats, OAuth scopes, MRT API keys.

docs/vscode-extension/features.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
description: B2C DX VS Code Extension feature tour — sandbox explorer, code sync, WebDAV, content libraries, SCAPI API browser, debugger, scaffold, CAP install, and CLI plugin support.
3+
---
4+
5+
# Features
6+
7+
A guided tour of what the extension can do. All commands are reachable from the Command Palette under the **B2C DX** category — this page focuses on what each feature is *for* and the actions you can only reach through tree-view right-clicks.
8+
9+
## Sandbox Realm Explorer
10+
11+
Browse and manage on-demand sandboxes (ODS) for one or more realms in a dedicated activity-bar container (**B2C-DX Sandboxes**). The tree groups sandboxes by realm, and each row carries a state-derived context value (`sandbox-started`, `sandbox-stopped`, `sandbox-cloning`, `sandbox-settingup-cloned`, etc.) so the right-click menu only offers actions that make sense for the current state.
12+
13+
**Lifecycle commands** (palette + right-click): create, start, stop, restart, clone, view details, view clone details, extend expiration, open Business Manager, delete.
14+
15+
**Cloned sandbox indicators** — clones are tagged in the tree (the source sandbox shows as `cloning` while a target is being set up; the target shows as `setting up` until it stabilizes). The display logic is identical to the CLI's: see `computeSandboxDisplay` in the package source for the precise rules.
16+
17+
<!-- TODO(screenshot): sandbox-explorer.png — started + cloned sandbox in the tree -->
18+
![Sandbox Realm Explorer](./images/sandbox-explorer.png)
19+
20+
<!-- TODO(screenshot): sandbox-context-menu.png — right-click context menu over a started sandbox -->
21+
![Sandbox context menu](./images/sandbox-context-menu.png)
22+
23+
Polling cadence is controlled by [`b2c-dx.sandbox.pollingInterval`](./configuration#sandbox-polling-interval).
24+
25+
## WebDAV Browser
26+
27+
A tree of WebDAV catalogs and libraries plus a registered file-system provider (`b2c-webdav://`) so you can mount a remote folder as a workspace folder.
28+
29+
**Tree-only actions** (right-click on a catalog, library, or directory):
30+
31+
- **New File / New Folder / Upload File** — create or push directly to the instance.
32+
- **Open as Workspace Folder** — adds the WebDAV path as a workspace folder backed by the `b2c-webdav://` filesystem provider so it behaves like a local folder.
33+
- **Drag & drop** — drag files from your local Explorer into a WebDAV directory to upload.
34+
- **Add Catalog / Add Library** — register additional virtual roots for browsing.
35+
36+
<!-- TODO(screenshot): webdav-browser.png — catalogs and libraries expanded -->
37+
![WebDAV Browser](./images/webdav-browser.png)
38+
39+
<!-- TODO(screenshot): webdav-mounted.png — "Open as Workspace Folder" result -->
40+
![WebDAV mounted as workspace folder](./images/webdav-mounted.png)
41+
42+
## Content Libraries
43+
44+
A focused view for Page Designer pages and components stored in your content libraries — filtered, exportable, and importable without leaving the editor.
45+
46+
**Tree-only actions**:
47+
48+
- **Export / Export without Assets / Export Assets Only** — three single-click exports for any page, content asset, or component.
49+
- **Filter / Clear Filter** — quick filter across the library tree when you have hundreds of pages.
50+
- **Browse in WebDAV** — jump from a library entry to the corresponding WebDAV path.
51+
- **Import Site Archive** — right-click a folder in the Explorer to import it as a site archive.
52+
53+
<!-- TODO(screenshot): content-libraries.png — content tree with the export context menu -->
54+
![Content Libraries](./images/content-libraries.png)
55+
56+
## Cartridge Code Sync
57+
58+
A **Cartridges** tree view (under the **B2C-DX** activity-bar container) lists every cartridge detected in your workspace. From there you can watch, deploy, and manage code versions per-cartridge — no all-or-nothing sync.
59+
60+
**Title-bar actions**: **Refresh Cartridges**, **Deploy Cartridges**, **Code Versions** (list / create / activate).
61+
62+
**Per-cartridge right-click actions**: **Upload Cartridge**, **Download from Instance**, **Compare with Instance** (diff view), **Add to Site Cartridge Path**, **Remove from Site Cartridge Path**.
63+
64+
**Workspace toggles**: **Toggle Code Sync** / **Start Code Sync** / **Stop Code Sync** start a watcher that uploads on save. **Upload to Instance** is also available from the file Explorer's context menu when a code-sync session is active.
65+
66+
<!-- TODO(screenshot): code-sync.png — Cartridges view with code-version dropdown -->
67+
![Cartridge Code Sync](./images/code-sync.png)
68+
69+
<!-- TODO(screenshot): code-sync-diff.png — Compare with Instance result -->
70+
![Code Sync diff](./images/code-sync-diff.png)
71+
72+
## SCAPI API Browser
73+
74+
Browse SCAPI OpenAPI schemas for your instance and open a Swagger UI panel for any endpoint. Requires OAuth credentials (`clientId`, `clientSecret`) and `shortCode` in `dw.json` — see the [Authentication Setup guide](../guide/authentication).
75+
76+
The view lives in its own activity-bar container (**B2C-DX: SCAPI**). Use **Refresh** to reload schemas after changing instances, and **Open API Documentation** to launch the Swagger UI panel.
77+
78+
<!-- TODO(screenshot): api-browser.png — Swagger UI panel -->
79+
![SCAPI API Browser](./images/api-browser.png)
80+
81+
## B2C Script Debugger
82+
83+
Registered as debug type `b2c-script`. Add a launch configuration to `.vscode/launch.json` to step through server-side B2C scripts:
84+
85+
```jsonc
86+
{
87+
"version": "0.2.0",
88+
"configurations": [
89+
{
90+
"type": "b2c-script",
91+
"request": "launch",
92+
"name": "B2C Script Debugger"
93+
}
94+
]
95+
}
96+
```
97+
98+
`cartridgePath` is auto-detected from the workspace; override it explicitly only if the cartridges live outside the workspace root.
99+
100+
<!-- TODO(screenshot): script-debugger.png — paused on a breakpoint -->
101+
![B2C Script Debugger](./images/script-debugger.png)
102+
103+
## Scaffold & CAP install
104+
105+
**Scaffold** (`b2c-dx.scaffold.generate`) — quick-pick over the SDK's scaffold templates; appears in the **File → New File...** picker and as **New from Scaffold...** when you right-click a folder in the Explorer.
106+
107+
**CAP install** (`b2c-dx.cap.install`) — appears on the right-click menu of a folder in the Explorer when the folder contains a `commerce-app.json`. Activation is also wired to `workspaceContains:**/commerce-app.json` so the extension auto-activates when you open a CAP project.
108+
109+
<!-- TODO(screenshot): scaffold-picker.png — "New from Scaffold..." quick-pick -->
110+
![Scaffold quick-pick](./images/scaffold-picker.png)
111+
112+
## Page Designer Assistant
113+
114+
`b2c-dx.openUI` opens a guided webview UI for scaffolding a Storefront Next page (PageType + Region definitions). The generated `.tsx` file is written to your workspace's `routes/` folder when one exists, or to a path you pick when the workspace has no routes folder.
115+
116+
<!-- TODO(screenshot): page-designer-assistant.png -->
117+
![Page Designer Assistant](./images/page-designer-assistant.png)
118+
119+
## Log Tailing
120+
121+
**Start Tailing Logs** / **Stop Tailing Logs** stream B2C log files into the editor (instance-side error/warn/info logs from `error-*.log`, `warn-*.log`, etc.). Output goes to a dedicated VS Code output channel; use [`b2c-dx.logLevel`](./configuration#log-level) to control extension log verbosity separately.
122+
123+
## Active Instance Status Bar
124+
125+
A status-bar item in the bottom-left shows the active B2C instance name, hostname, and a `$(pinned)` icon when project-root pinning is active. Clicking it runs **Switch Active Instance** — a quick-pick over instances declared in `dw.json` that updates the active instance and refreshes every view.
126+
127+
## B2C CLI Plugin Support
128+
129+
The extension uses the [B2C CLI](../guide/) under the hood for most of its operations. As a side effect, **any plugin you've installed via `b2c plugins install` propagates into the extension's behavior automatically** — there's no separate VS Code-side plugin registry. A plugin that adds a custom config source, a sandbox subcommand, or a middleware hook is honored by the corresponding extension features the next time the workspace loads.
130+
131+
This mirrors the same plugin propagation already documented for the [MCP server](../mcp/#plugins).
132+
133+
See:
134+
135+
- [Custom Plugins](../guide/extending) — author your own CLI plugin.
136+
- [3rd Party Plugins](../guide/third-party-plugins) — community plugins (e.g., `b2c-plugin-intellij-sfcc-config`).
69 Bytes
Loading
69 Bytes
Loading

0 commit comments

Comments
 (0)