Przejdź do treści
Biblioteka skilli
Programowanie · Analiza

b2c-debug

/b2c-debug

Debuguje skrypty serwerowe B2C Commerce przez b2c CLI: punkty przerwania, praca krokowa, podgląd zmiennych, wyrażenia i debugger sterowany ze skryptu.

Licencja
Apache-2.0
Ostatnia zmiana repozytorium
23.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 23.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Debuguje skrypty serwerowe B2C Commerce przez b2c CLI: punkty przerwania, praca krokowa, podgląd zmiennych, wyrażenia i debugger sterowany ze skryptu.

Wyzwalacze z opisu

debug this controllerwhat
Oryginalny opis (EN)

Debug B2C Commerce server-side scripts using the b2c CLI. Use this skill whenever the user needs to set breakpoints, step through code, inspect variables, evaluate expressions, or investigate runtime behavior on a B2C Commerce instance. Also use when the user wants to understand what a script is doing at runtime, capture state at a specific line, or drive the debugger from a headless script — even if they just say "debug this controller" or "what's the value of basket at line 42".

Jak działa

  1. Configuration & Authentication
  2. Prerequisites
  3. Interactive Debugging
  4. RPC Mode (Headless / Agent Use)
  5. DAP Mode (IDE Integration)
  6. Related Skills
Sekcje z nagłówków SKILL.md, w oryginale · 135 linii, 752 słów
Podgląd SKILL.md
---
name: b2c-debug
description: Debug B2C Commerce server-side scripts using the b2c CLI. Use this skill whenever the user needs to set breakpoints, step through code, inspect variables, evaluate expressions, or investigate runtime behavior on a B2C Commerce instance. Also use when the user wants to understand what a script is doing at runtime, capture state at a specific line, or drive the debugger from a headless script — even if they just say "debug this controller" or "what's the value of basket at line 42".
---

# B2C Debug Skill

Debug server-side scripts on Salesforce B2C Commerce instances — set breakpoints, step through code, and inspect variables in SFRA controllers, hooks, jobs, and custom APIs.

> Prefer MCP debugging when available: `debug_control` resumes/steps; `debug_inspect` reads stacks and variables; `debug_evaluate` evaluates expressions. See `skill://mcp/b2c-mcp-debugger/SKILL.md` for the MCP workflow. Use the CLI for a requested terminal session or when MCP is unavailable.

`b2c debug` provides a Debug Adapter Protocol (DAP) debug adapter for IDEs. For terminal or headless use without the MCP tools, `b2c debug cli` also offers an interactive REPL and a JSONL `--rpc` mode.

> **Tip:** If `b2c` is not installed globally, use `npx @salesforce/b2c-cli` instead (e.g., `npx @salesforce/b2c-cli debug cli`).

## Configuration & Authentication

The CLI resolves the target instance and debugger credentials from environment variables (including project `.env`), the selected project-local or shared `dw.json`, and configuration plugins. It does not search parent directories. `package.json` supplies only non-sensitive defaults; `~/.mobify` supplies MRT credentials, not debugger credentials. **Flags like `--server`, `--username`, and `--password` are usually unnecessary** — only pass them to override what's auto-detected.

Run `b2c setup inspect` to see the resolved configuration and which source provided each value (use `--json` for scripting; keep secrets masked unless the user explicitly requests their values). For precedence rules and troubleshooting, see the `b2c-cli:b2c-config` skill.

For MCP debugging, pass `projectDirectory` to `debug_start_session` whenever the MCP server may have been launched outside the project. The tool uses that root to load the project's `.env` and default `dw.json`; pass `configPath` to select a different primary `dw.json`-format file and `instanceName` to select a named instance from the primary or shared default file. Cartridge discovery and local/server source mapping default to `projectDirectory`; pass `cartridgeDirectory` only when the cartridges live under a different root. The start call captures this information in `resolution`, which `debug_list_sessions` returns without requiring the caller to repeat it. The MCP server controls its SDAPI client identity internally, so callers do not pass a debugger client ID.

## Prerequisites

- Basic Auth credentials for a BM user with `WebDAV_Manage_Customization`: a username and a `WebDAV File Access and UX Studio` access key used as the password (not the Account Manager password)

## Interactive Debugging

### Start a Debug Session

```bash
# Start interactive debugger
b2c debug cli

# Specify cartridge directory for source mapping
b2c debug cli --cartridge-path ./cartridges

# Use a custom client ID (for concurrent sessions)
b2c debug cli --client-id my-session
```

### Set Breakpoints

In the REPL:

```
break Cart.js:42
break Checkout.js:100 if basket.totalGrossPrice > 100
breakpoints
delete 1
```

### Inspect State When Halted

```
stack
vars
members basket.productLineItems
eval basket.productLineItems.length
eval request.httpParameterMap.get("pid").stringValue
```

### Control Execution

```
continue
step
stepin
stepout
```

### Thread Management

```
threads
thread 5
frame 2
```

## RPC Mode (Headless / Agent Use)

For headless scripts, agents, and programmatic integration, use `--rpc` mode. Commands and responses are JSONL (one JSON object per line) on stdin/stdout.

```bash
b2c debug cli --rpc
```

### Send Commands

```json
{"id": 1, "command": "set_breakpoints", "args": {"breakpoints": [{"file": "Cart.js", "line": 42}]}}
{"id": 2, "command": "get_stack"}
{"id": 3, "command": "get_variables", "args": {"scope": "local"}}
{"id": 4, "command": "evaluate", "args": {"expression": "basket.totalGrossPrice"}}
{"id": 5, "command": "continue"}
```

### Receive Responses and Events

```json
{"event": "ready", "data": {}}
{"id": 1, "result": {"breakpoints": [{"id": 1, "file": "Cart.js", "line": 42, "script_path": "/app_storefront/cartridge/controllers/Cart.js"}]}}
{"event": "thread_stopped", "data": {"thread_id": 5, "location": {"file": "Cart.js", "line": 42, "function_name": "show"}}}
```

### Available RPC Commands

| Command            | Key Args                                         | Description              |
| ------------------ | ------------------------------------------------ | ------------------------ |
| `set_breakpoints`  | `breakpoints: [{file, line, condition?}]`        | Replace all breakpoints  |
| `list_breakpoints` |                                                  | List current breakpoints |
| `continue`         | `thread_id?`                                     | Resume halted thread     |
| `step_over`        | `thread_id?`                                     | Step to next line        |
| `step_into`        | `thread_id?`                                     | Step into function       |
| `step_out`         | `thread_id?`                                     | Step out of function     |
| `get_stack`        | `thread_id?`                                     | Get call stack           |
| `get_variables`    | `thread_id?, frame_index?, scope?, object_path?` | Get variables            |
| `evaluate`         | `expression, thread_id?, frame_index?`           | Evaluate expression      |
| `list_threads`     |                                                  | List threads             |
| `select_thread`    | `thread_id`                                      | Switch thread            |
| `select_frame`     | `index`                                          | Switch frame             |

## DAP Mode (IDE Integration)

For VS Code and other DAP-compatible IDEs:

```bash
b2c debug
```

This starts a DAP debug adapter over stdio, used by IDE launch configurations.

## Related Skills

- `b2c-cli:b2c-logs` - Retrieve server logs for investigating errors found during debugging
- `b2c-cli:b2c-code` - Deploy code changes before debugging
- `b2c-cli:b2c-config` - Verify instance configuration and credentials
Pliki w paczce (2)
  • SKILL.md 6 KB
  • evals/trigger-evals.json 1 KB

Wersje

W bazie nie ma innych skilli o nazwie b2c-debug.

Migawka bazy z 28.10.2026 · wersja paczki 13bd3d9e93e6 (skrót SHA-256 całej paczki)

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100lens-js-debugger
    Debuguje działający Lens JS: wylicza wyrażenia, ustawia punkty przerwania, wstrzymuje i wznawia wykonanie oraz sprawdza stan w podglądzie Lens Studio lub na urządzeniu Specs.
  • 90Debroid CLI Debugger
    Orkiestruje bezgłowe debugowanie Androida przez JDWP: breakpointy liniowe i wyjątków, inspekcja zmiennych i stanu Jetpack Compose, krokowanie, ewaluacja wyrażeń i diagnoza awarii.
  • 95jdb-debugger
    Debuguje aplikacje Java w czasie rzeczywistym przez JDB: punkty przerwania, krokowanie, wątki i wyjątki w działających JVM.
  • 95dbg
    Debuguje aplikacje w Node.js, Bun, Pythonie, Javie i kodzie natywnym przez CLI dbg: punkty przerwania, zmienne i wyrażenia.
  • 100bun-debug
    Uruchamia debugger Bun przez --inspect do interaktywnego debugowania pliku TS lub JS: zatrzymanie na pierwszej linii, oczekiwanie na podłączenie i debugowanie testów przez --inspect-brk.
  • 100jdb-debugger
    Debuguje aplikacje Javy na żywo w JDB: dołącza się do działających JVM lub uruchamia nowe, ustawia breakpointy, krokuje kod, sprawdza zmienne i wątki oraz diagnozuje wyjątki.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.