Commit e65bd15
authored
feat: B2C Commerce script debugger (SDAPI 2.0 DAP adapter) (#330)
* feat: add B2C Commerce script debugger (SDAPI 2.0 DAP adapter)
SDK layer (operations/debug/):
- SDAPI 2.0 REST client with Basic auth
- Debug session manager with thread polling and keepalive
- DAP adapter extending @vscode/debugadapter for stdio use
- Source mapping between local cartridge paths and server script paths
- Variable store bridging DAP references to SDAPI object paths
CLI command (b2c debug):
- Runs DAP adapter over stdio for use with nvim-dap and other DAP clients
- Resolves credentials from dw.json, auto-discovers cartridges
Key behaviors:
- InitializedEvent deferred until after SDAPI client creation
- Thread re-halt detection when poll catches same thread halted at new location
- Halt OutputEvent includes local path for click-through in editors
- DAP OutputEvent is primary debug output; SDK logger demoted to debug/trace
* feat: VS Code inline debug adapter, terminate request, and logpoints
VS Code extension:
- Register b2c-script debug type with DebugAdapterInlineImplementation
- Auto-discover cartridges and resolve credentials from dw.json
- launch.json snippet for quick configuration
DAP adapter enhancements:
- supportsTerminateRequest: clean session shutdown via terminate button
- supportsLogPoints: breakpoints with log messages eval {expressions}
server-side and auto-resume (note: briefly halts thread per hit)
- Richer OutputEvent messages: halt locations use local paths,
breakpoint set counts, continue confirmation
- Evaluate results are expandable when the expression has members
CLI: demote debug command callbacks to logger.debug (DAP OutputEvent
is the primary output channel)
* fix: improve debugger error messages for missing credentials and auth failures
- VS Code extension shows actionable error messages referencing
configuration (dw.json) when credentials are missing
- DAP adapter outputs friendly messages for 401 (auth failed) and
412 (debugger not enabled) to both the debug console and notification
* fix: widen sendDAP type to accept DebugProtocol.Request in test
CI's pretest runs tsc -p test which typechecks test files. The sendDAP
helper accepted only ProtocolMessage but callers passed Request objects
with command/arguments properties.1 parent fd1b1d0 commit e65bd15
19 files changed
Lines changed: 2810 additions & 4 deletions
File tree
- packages
- b2c-cli
- src/commands/debug
- b2c-tooling-sdk
- src/operations/debug
- test/operations/debug
- b2c-vs-extension
- src
- debugger
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
367 | 378 | | |
368 | 379 | | |
369 | 380 | | |
| |||
403 | 414 | | |
404 | 415 | | |
405 | 416 | | |
406 | | - | |
407 | 417 | | |
408 | 418 | | |
409 | 419 | | |
410 | 420 | | |
411 | 421 | | |
| 422 | + | |
412 | 423 | | |
413 | 424 | | |
414 | 425 | | |
| |||
438 | 449 | | |
439 | 450 | | |
440 | 451 | | |
| 452 | + | |
441 | 453 | | |
442 | | - | |
443 | 454 | | |
444 | 455 | | |
445 | 456 | | |
| |||
454 | 465 | | |
455 | 466 | | |
456 | 467 | | |
| 468 | + | |
457 | 469 | | |
458 | 470 | | |
459 | 471 | | |
| |||
0 commit comments