dap-mcp-server 0.1.12 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +25 -7
  2. package/SKILL.md +37 -186
  3. package/build/adapters/detect.d.ts +12 -0
  4. package/build/adapters/detect.js +91 -0
  5. package/build/adapters/detect.js.map +1 -1
  6. package/build/adapters/registry.js +35 -12
  7. package/build/adapters/registry.js.map +1 -1
  8. package/build/diagnostics/doctor.d.ts +64 -0
  9. package/build/diagnostics/doctor.js +209 -0
  10. package/build/diagnostics/doctor.js.map +1 -0
  11. package/build/server.js +305 -83
  12. package/build/server.js.map +1 -1
  13. package/build/session/inspect.d.ts +6 -2
  14. package/build/session/inspect.js +24 -8
  15. package/build/session/inspect.js.map +1 -1
  16. package/build/session/run.js +2 -9
  17. package/build/session/run.js.map +1 -1
  18. package/build/session/session.d.ts +16 -0
  19. package/build/session/session.js +63 -8
  20. package/build/session/session.js.map +1 -1
  21. package/integrations/claude/dap-debugging/.claude-plugin/plugin.json +9 -0
  22. package/integrations/claude/dap-debugging/.mcp.json +8 -0
  23. package/integrations/claude/dap-debugging/skills/dap-debugging/SKILL.md +49 -0
  24. package/package.json +8 -3
  25. package/.forgejo/workflows/publish.yml +0 -63
  26. package/CLAUDE.md +0 -71
  27. package/TODO.md +0 -32
  28. package/docs/plans/2026-03-05-dap-wrapper-mcp-design.md +0 -326
  29. package/docs/plans/2026-03-05-dap-wrapper-mcp-implementation.md +0 -2815
  30. package/src/adapters/builtin.ts +0 -75
  31. package/src/adapters/detect.test.ts +0 -36
  32. package/src/adapters/detect.ts +0 -36
  33. package/src/adapters/registry.test.ts +0 -74
  34. package/src/adapters/registry.ts +0 -86
  35. package/src/dap/dap-client.test.ts +0 -118
  36. package/src/dap/dap-client.ts +0 -588
  37. package/src/dap/protocol.test.ts +0 -82
  38. package/src/dap/protocol.ts +0 -78
  39. package/src/dap/ring-buffer.test.ts +0 -82
  40. package/src/dap/ring-buffer.ts +0 -64
  41. package/src/dap/types.ts +0 -115
  42. package/src/index.ts +0 -30
  43. package/src/integration/debug-lifecycle.test.ts +0 -131
  44. package/src/server.ts +0 -1096
  45. package/src/session/inspect.test.ts +0 -126
  46. package/src/session/inspect.ts +0 -160
  47. package/src/session/run.test.ts +0 -74
  48. package/src/session/run.ts +0 -144
  49. package/src/session/session-manager.test.ts +0 -74
  50. package/src/session/session-manager.ts +0 -67
  51. package/src/session/session.test.ts +0 -126
  52. package/src/session/session.ts +0 -482
  53. package/src/test-fixtures/crash-adapter.js +0 -23
  54. package/src/test-fixtures/mock-adapter.js +0 -164
  55. package/src/test-fixtures/no-stop-adapter.js +0 -77
  56. package/src/test-fixtures/silent-adapter.js +0 -24
  57. package/src/test-fixtures/tcp-mock-adapter.js +0 -87
  58. package/tsconfig.json +0 -16
package/README.md CHANGED
@@ -16,15 +16,18 @@ Any DAP-compliant debug adapter works. Built-in defaults for:
16
16
  |----------|---------|---------|
17
17
  | Python | debugpy | `pip install debugpy` |
18
18
  | Go | Delve | `go install github.com/go-delve/delve/cmd/dlv@latest` |
19
+ | Node.js / TypeScript | vscode-js-debug | Configure its `dapDebugServer.js` path or install it in the project |
19
20
  | C/C++ | lldb-dap | `apt install lldb` / `brew install llvm` |
20
21
 
21
- Additional adapters (e.g. Node.js via js-debug) can be registered via the `configure_adapter` tool or config files.
22
+ Additional adapters, and project-specific paths for the built-ins, can be registered via `configure_adapter` or config files.
22
23
 
23
24
  ## MCP Tools
24
25
 
25
26
  | Tool | Description |
26
27
  |------|-------------|
27
- | `debug_inspect` | **One-shot:** launch → run to breakpoint → evaluate expressions → disconnect. Use first when you just need a value at a line. |
28
+ | `debug_doctor` | **Start here:** detect the project, recommend an adapter, verify its complete command, and return setup remediation. |
29
+ | `debug_at` | **Primary debugging call:** infer the adapter, stop at a line, evaluate expressions, and clean up. |
30
+ | `debug_inspect` | **One-shot:** launch → run to breakpoint → evaluate expressions → disconnect when the adapter is already known. |
28
31
  | `debug_run` | **One-shot:** launch → run to completion → return all output. Combine with logpoints for printf-style debugging without editing source. |
29
32
  | `debug_launch` | Start an interactive debug session (launch a program with breakpoints) |
30
33
  | `debug_attach` | Attach to a running process |
@@ -57,7 +60,20 @@ npm run build
57
60
 
58
61
  ## Usage with Claude Code
59
62
 
60
- Add to your MCP configuration (`~/.claude/mcp.json` or project `.mcp.json`):
63
+ Register the server for the current user:
64
+
65
+ ```bash
66
+ claude mcp add --scope user dap -- npx -y dap-mcp-server
67
+ ```
68
+
69
+ The repository also contains a Claude Code plugin that bundles the MCP declaration and the activation skill. During local development, validate and load it with:
70
+
71
+ ```bash
72
+ claude plugin validate integrations/claude/dap-debugging
73
+ claude --plugin-dir ./integrations/claude/dap-debugging
74
+ ```
75
+
76
+ To configure MCP manually, use a project `.mcp.json`:
61
77
 
62
78
  ```json
63
79
  {
@@ -82,16 +98,18 @@ Or if installed globally:
82
98
  }
83
99
  ```
84
100
 
85
- A `SKILL.md` file is included in the package. Copy it to `.claude/skills/` in your project to teach Claude Code when and how to use the debugger:
101
+ A `SKILL.md` file is included in the package. After a local package install, copy it to the required skill directory layout:
86
102
 
87
103
  ```bash
88
- mkdir -p .claude/skills
89
- cp node_modules/dap-mcp-server/SKILL.md .claude/skills/dap-debugging.md
104
+ mkdir -p .claude/skills/dap-debugging
105
+ cp node_modules/dap-mcp-server/SKILL.md .claude/skills/dap-debugging/SKILL.md
90
106
  ```
91
107
 
108
+ For a global npm install, the source file is under `$(npm root -g)/dap-mcp-server/SKILL.md`, not the project's `node_modules`.
109
+
92
110
  ## Design
93
111
 
94
- Tools are deliberately coarse-grained. A single `get_state` call returns threads, stack trace, scopes, and variables — instead of requiring 4 separate calls. The `step` tool blocks synchronously until the debuggee stops again and returns the new state. This minimizes round-trips for AI agents that think in terms of "step forward and show me what happened."
112
+ Tools are deliberately coarse-grained. `debug_doctor` makes setup failures actionable and `debug_at` performs the common detect → launch → stop → inspect → cleanup workflow in one call. A single `get_state` call returns threads, stack trace, scopes, and variables. The `step` tool blocks until the debuggee stops again and returns the new state.
95
113
 
96
114
  Session IDs are optional when only one debug session is active. Breakpoints can be set inline with `debug_launch` for single-call debugging setup.
97
115
 
package/SKILL.md CHANGED
@@ -1,209 +1,60 @@
1
1
  ---
2
2
  name: dap-debugging
3
- description: Use when debugging a program — when you need to set breakpoints, step through code, inspect variables, or understand runtime behavior instead of guessing with print statements.
3
+ description: Use a real debugger for opaque test failures, crashes, swallowed exceptions, incorrect runtime state, or a bug that remains unexplained after static inspection or a failed fix. Prefer this over adding multiple print statements when actual values, branches, or call stacks are needed.
4
4
  ---
5
5
 
6
- # Debugging with DAP MCP Server
6
+ # Debug Code with DAP
7
7
 
8
- You have access to a real debugger via the `dap` MCP server. **Use it instead of adding print/log statements** whenever you need to understand runtime behavior, track down a bug, or verify a fix.
8
+ Use the `dap` MCP server as the default next step when static evidence is insufficient. It can stop a local program at a source line, inspect stack frames and variables, evaluate expressions, and collect output without editing the source.
9
9
 
10
- ## When to switch from print() to the debugger
10
+ Do not invoke a debugger for syntax errors, obvious type errors, or failures already explained completely by a short traceback. Debugging executes local code and may trigger the program's normal side effects; do not run untrusted targets.
11
11
 
12
- Reach for the debugger — don't keep guessing — when any of these are true:
12
+ ## Preferred Workflow
13
13
 
14
- - **Your first fix attempt was wrong.** Stop iterating on guesses. Inspect actual values.
15
- - **You're about to add 3+ print statements.** Use a logpoint instead (see below) — same information, no code edits.
16
- - **You need a value on iteration N of a loop.** Use `hitCondition: "N"` instead of conditional prints.
17
- - **A test fails with a non-obvious traceback.** Launch the test under the debugger; you'll see locals at the failure site.
18
- - **You're reasoning about state that's modified across many call sites.** A conditional breakpoint on the value beats grepping for assignments.
14
+ 1. Call `debug_doctor` with the project `cwd`. It detects project signals, recommends an adapter, validates the complete adapter command, and returns exact remediation if setup is incomplete.
15
+ 2. Select an executable code line close to where the first incorrect value is observable. Avoid comments, declarations without executable code, and lines that the failing path never reaches.
16
+ 3. Call `debug_at` with the source `file`, `line`, and only the expressions needed to test the current hypothesis. Omit `adapter` unless doctor recommends overriding detection.
19
17
 
20
- Print debugging is fine for: trivial one-line checks, scripts you'll throw away in the next message, or when you genuinely just want to see "did this code path execute?".
21
-
22
- ## Logpoints — print debugging without editing code
23
-
24
- A **logpoint** is a breakpoint that doesn't pause execution. It just emits a formatted message every time it's hit. This is the single most useful feature for AI agents.
25
-
26
- Set it via the `logMessage` field on a breakpoint:
27
-
28
- ```
29
- set_breakpoints({
30
- file: "/abs/path/src/foo.py",
31
- breakpoints: [
32
- { line: 42, logMessage: "x={x} y={y} state={self.state}" },
33
- { line: 88, logMessage: "iteration {i}: items={len(items)}" }
34
- ]
35
- })
36
- ```
37
-
38
- Then `step({ action: "continue" })` and let the program run. Retrieve every log with `get_output`. You get the same information as inserting `print(f"x={x} y={y}")` at five places — without touching the source file, without re-running, and with the program's natural execution preserved.
39
-
40
- **When to use logpoints over breakpoints**: when you want to *observe* values across many hits rather than *interrupt* execution to inspect one. They are the right tool ~70% of the time.
41
-
42
- Expression syntax inside `{...}` depends on the adapter (debugpy: Python; node: JS). The expression is evaluated in the breakpoint's scope.
43
-
44
- ## Debugging a failing test
45
-
46
- This is the dominant case. Use the test runner as the program, with the specific test as an argument.
47
-
48
- ### pytest
49
-
50
- ```
51
- debug_launch({
52
- adapter: "python",
53
- program: "/abs/path/.venv/bin/pytest",
54
- args: ["tests/test_foo.py::test_bar", "-x", "--no-header"],
55
- cwd: "/abs/path",
56
- breakpoints: [{ file: "/abs/path/src/foo.py", line: 42 }],
57
- stopOnEntry: false,
58
- })
59
- ```
60
-
61
- For pytest, also consider setting `exceptionBreakpoints: ["raised"]` — pytest swallows exceptions before you see them, but the debugger will stop at the raise site.
62
-
63
- ### vitest / jest (Node.js)
64
-
65
- Requires the `node` adapter configured (see "Node.js setup" below). Use the runner binary from `node_modules/.bin`:
66
-
67
- ```
68
- debug_launch({
69
- adapter: "node",
70
- program: "${cwd}/node_modules/.bin/vitest",
71
- args: ["run", "tests/foo.test.ts", "-t", "the failing test name"],
72
- cwd: "/abs/path",
73
- breakpoints: [{ file: "/abs/path/src/foo.ts", line: 42 }],
74
- stopOnEntry: false,
75
- })
18
+ ```json
19
+ {
20
+ "cwd": "/workspace/project",
21
+ "program": "/workspace/project/app.py",
22
+ "file": "/workspace/project/app.py",
23
+ "line": 42,
24
+ "expressions": ["request.user", "result", "len(items)"]
25
+ }
76
26
  ```
77
27
 
78
- ### go test
28
+ Interpret the result before changing code:
79
29
 
80
- ```
81
- debug_launch({
82
- adapter: "go",
83
- program: "${cwd}", // delve takes a package dir, not a binary
84
- args: ["-test.run", "TestFoo", "-test.v"],
85
- cwd: "/abs/path",
86
- breakpoints: [{ file: "/abs/path/foo.go", line: 42 }],
87
- stopOnEntry: false,
88
- })
89
- ```
90
-
91
- Delve uses `dlv test` semantics under the hood when the program is a package directory containing test files.
92
-
93
- ### Node.js setup
94
-
95
- If `list_adapters` shows no `node` entry, register it once (path depends on installed extension):
96
-
97
- ```
98
- configure_adapter({
99
- type: "node",
100
- runtime: "node",
101
- program: "/abs/path/to/js-debug/src/dapDebugServer.js",
102
- args: [],
103
- scope: "global",
104
- })
105
- ```
106
-
107
- `js-debug-dap` ships with the VS Code Node debugger extension. Alternatively use `@vscode/js-debug` from npm.
108
-
109
- ## Quick Start (single-file program)
30
+ - `hit: true` includes the stopped location, evaluated values, and captured output.
31
+ - `status: terminated` means execution finished before reaching the line; verify the program, arguments, path, and branch.
32
+ - `timedOut: true` means it neither stopped nor terminated in time; inspect output and narrow the target.
33
+ - With `hit: false`, `breakpoint.verified: false` means the adapter could not bind that source location; move to executable code or verify source mapping.
110
34
 
111
- 1. `list_adapters` — see what's installed.
112
- 2. Launch with breakpoints in one call:
35
+ Use `launchConfig` for adapter-specific DAP fields such as a module, request type, runtime executable, or source-map option.
113
36
 
114
- ```
115
- debug_launch({
116
- adapter: "python",
117
- program: "/abs/path/file.py",
118
- stopOnEntry: false,
119
- breakpoints: [{ file: "/abs/path/file.py", line: 42 }],
120
- })
121
- ```
122
-
123
- 3. The response already contains the full state (threads, stack, scopes, variables) when the breakpoint is hit. No follow-up `get_state` needed.
124
- 4. Step with `step({ action: "next" })` — response includes the new state.
125
- 5. `evaluate({ expression: "len(items)" })` for ad-hoc inspection.
126
- 6. `debug_disconnect` when done.
127
-
128
- ## Stepping strategy
129
-
130
- - **`next`** (step over) is the default choice. Use it unless you have a specific reason not to.
131
- - **`stepIn`** only when you suspect the bug is *inside* the function being called — not at the call site. Stepping into library code will get you lost fast.
132
- - **`stepOut`** to bail out of a function you stepped into by mistake.
133
- - **`continue`** to run to the next breakpoint. With logpoints set, this is how you collect runtime traces.
37
+ ## Failing Tests
134
38
 
135
- If you find yourself stepping line-by-line for more than ~10 steps, you're probably doing it wrong. Set a breakpoint at the next interesting location and continue to it.
136
-
137
- ## Worked example
138
-
139
- Bug: `compute_total(items)` returns `0` when items contain a tax-exempt entry.
140
-
141
- ```
142
- # Launch under pytest with a breakpoint at the suspect line
143
- debug_launch({
144
- adapter: "python",
145
- program: "/proj/.venv/bin/pytest",
146
- args: ["tests/test_billing.py::test_tax_exempt", "-x"],
147
- cwd: "/proj",
148
- breakpoints: [{ file: "/proj/src/billing.py", line: 57 }],
149
- stopOnEntry: false,
150
- })
151
-
152
- # Response (paraphrased):
153
- # {
154
- # sessionId: "s-1",
155
- # status: "stopped",
156
- # location: { file: ".../billing.py", line: 57, functionName: "compute_total" },
157
- # scopes: [{ name: "Locals", variables: [
158
- # { name: "items", value: "[{...}, {...}]", ... },
159
- # { name: "subtotal", value: "100", ... },
160
- # { name: "tax", value: "0", ... }
161
- # ] }]
162
- # }
163
-
164
- # Inspect the exempt item more closely
165
- evaluate({ expression: "[i for i in items if i.get('tax_exempt')]" })
166
- # → [{name: 'book', price: 100, tax_exempt: True}]
167
-
168
- # Step over to see what compute_total actually returns
169
- step({ action: "next" })
170
- # → see that `total = subtotal + tax` returns 100, not 0. Bug is upstream.
171
-
172
- # Continue to verify nothing else changes the return
173
- step({ action: "continue" })
174
-
175
- debug_disconnect()
176
- ```
39
+ Run the smallest failing test, not the full suite. Pass the test runner as `program` (or through adapter-specific `launchConfig`) and the test selector in `args`. Test-runner launch semantics vary by adapter, so use `debug_doctor` first and preserve known-good fields from `.vscode/launch.json` in `launchConfig`.
177
40
 
178
- Fix locally, re-run the test, done.
41
+ Choose a breakpoint in application code before the assertion or exception boundary. For exceptions hidden by a test framework, use an interactive launch and `set_exception_breakpoints`.
179
42
 
180
- ## Key Rules
43
+ ## Interactive Exploration
181
44
 
182
- - **Do NOT call `get_state` after `step`** — `step` already returns the new stopped state.
183
- - **Omit `sessionId`** when only one debug session is active.
184
- - **Use absolute paths** for `program` and breakpoint `file` parameters.
185
- - **Prefer `stopOnEntry: false` with breakpoints** — it gets you directly to the interesting code.
186
- - **Use `get_output`** for program stdout/stderr (including logpoint output).
45
+ Use `debug_launch` only when one-shot inspection is insufficient, such as multiple stops or step-by-step control. With breakpoints, it waits by default and explicitly reports stopped, terminated, or timeout.
187
46
 
188
- ## Debugging Strategies
47
+ 1. `debug_launch` with breakpoints and optional `launchConfig`.
48
+ 2. Inspect the returned state; do not immediately duplicate it with `get_state`.
49
+ 3. Use `evaluate` for a focused question.
50
+ 4. Use `step` with `next` by default; use `stepIn` only when the called function is suspect.
51
+ 5. Use `set_breakpoints` to move or add breakpoints.
52
+ 6. Always finish with `debug_disconnect`.
189
53
 
190
- ### Narrowing down a bug
191
- 1. Set a breakpoint where state is known good.
192
- 2. Set another where state is wrong.
193
- 3. Use `step` with `next` to walk between them, or set intermediate logpoints.
54
+ Omit `sessionId` when exactly one session is active. Use absolute paths for programs and source files.
194
55
 
195
- ### Understanding a crash
196
- 1. Launch with `exceptionBreakpoints: ["uncaughtExceptions"]` (or `"raised"` for any raise).
197
- 2. When stopped at the exception, inspect stack and locals.
56
+ ## Output-First Debugging
198
57
 
199
- ### Verifying a fix
200
- 1. Set a breakpoint at the fixed code.
201
- 2. Run to it, inspect variables, confirm new behavior.
202
- 3. Continue to verify the program completes successfully.
58
+ Use `debug_run` when completion status and stdout/stderr are sufficient. For repeated observations without pausing, create logpoints with `set_breakpoints` and `logMessage`, continue execution, then read `get_output`. This provides runtime traces without modifying source files.
203
59
 
204
- ### Observing a hot loop without stopping it
205
- 1. Set logpoints at the relevant lines with `{i}` and any state expression.
206
- 2. `continue`.
207
- 3. Read the trace via `get_output`. For long-running programs, poll incrementally:
208
- pass the `nextSince` value from each call as the `since` parameter of the next call
209
- to receive only newly-emitted entries.
60
+ If doctor reports an unavailable adapter, follow its `nextSteps` before retrying. Do not repeatedly launch a configuration that readiness checks have already rejected.
@@ -19,4 +19,16 @@
19
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
20
  * SOFTWARE.
21
21
  */
22
+ import { AdapterConfig } from "../dap/types.js";
22
23
  export declare function checkAdapterAvailable(command: string): Promise<boolean>;
24
+ export interface AdapterAvailability {
25
+ available: boolean;
26
+ command: string;
27
+ reason?: string;
28
+ }
29
+ /**
30
+ * Validate the complete adapter command, not just its runtime. This prevents
31
+ * configurations such as `node missing-adapter.js` from being reported as
32
+ * available merely because Node itself is installed.
33
+ */
34
+ export declare function inspectAdapterAvailability(config: AdapterConfig): Promise<AdapterAvailability>;
@@ -20,6 +20,8 @@
20
20
  * SOFTWARE.
21
21
  */
22
22
  import { execFile } from "node:child_process";
23
+ import fs from "node:fs/promises";
24
+ import path from "node:path";
23
25
  import { promisify } from "node:util";
24
26
  const execFileAsync = promisify(execFile);
25
27
  export async function checkAdapterAvailable(command) {
@@ -32,4 +34,93 @@ export async function checkAdapterAvailable(command) {
32
34
  return false;
33
35
  }
34
36
  }
37
+ async function fileExists(filePath) {
38
+ try {
39
+ await fs.access(filePath);
40
+ return true;
41
+ }
42
+ catch {
43
+ return false;
44
+ }
45
+ }
46
+ /**
47
+ * Validate the complete adapter command, not just its runtime. This prevents
48
+ * configurations such as `node missing-adapter.js` from being reported as
49
+ * available merely because Node itself is installed.
50
+ */
51
+ export async function inspectAdapterAvailability(config) {
52
+ const command = config.runtime || config.program;
53
+ if (config.transport === "tcp") {
54
+ if (!config.portMatcher) {
55
+ return {
56
+ available: false,
57
+ command,
58
+ reason: "TCP adapters require a portMatcher with one capture group for the listening port.",
59
+ };
60
+ }
61
+ try {
62
+ new RegExp(config.portMatcher);
63
+ }
64
+ catch {
65
+ return {
66
+ available: false,
67
+ command,
68
+ reason: `The configured portMatcher is not a valid regular expression: ${config.portMatcher}`,
69
+ };
70
+ }
71
+ }
72
+ if (!(await checkAdapterAvailable(command))) {
73
+ return {
74
+ available: false,
75
+ command,
76
+ reason: `Executable '${command}' was not found on PATH.`,
77
+ };
78
+ }
79
+ if (!config.runtime) {
80
+ return { available: true, command };
81
+ }
82
+ if (config.program === "-m") {
83
+ const moduleName = config.args?.[0];
84
+ if (!moduleName) {
85
+ return {
86
+ available: false,
87
+ command,
88
+ reason: "The adapter uses '-m' but no module name is configured.",
89
+ };
90
+ }
91
+ try {
92
+ await execFileAsync(config.runtime, [
93
+ "-c",
94
+ "import importlib.util,sys; sys.exit(0 if importlib.util.find_spec(sys.argv[1]) else 1)",
95
+ moduleName,
96
+ ]);
97
+ return { available: true, command: `${config.runtime} -m ${moduleName}` };
98
+ }
99
+ catch {
100
+ return {
101
+ available: false,
102
+ command: `${config.runtime} -m ${moduleName}`,
103
+ reason: `Python module '${moduleName}' is not installed for '${config.runtime}'.`,
104
+ };
105
+ }
106
+ }
107
+ const looksLikeScript = path.isAbsolute(config.program) ||
108
+ /[\\/]/.test(config.program) ||
109
+ /\.(?:cjs|js|mjs|py|jar)$/i.test(config.program);
110
+ if (!looksLikeScript) {
111
+ return { available: true, command };
112
+ }
113
+ const resolved = path.resolve(config.program);
114
+ if (await fileExists(resolved)) {
115
+ return { available: true, command: `${config.runtime} ${resolved}` };
116
+ }
117
+ if (await checkAdapterAvailable(config.program)) {
118
+ return { available: true, command: `${config.runtime} ${config.program}` };
119
+ }
120
+ return {
121
+ available: false,
122
+ command: `${config.runtime} ${config.program}`,
123
+ reason: `Adapter program '${config.program}' was not found.`,
124
+ };
125
+ }
35
126
  //# sourceMappingURL=detect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/adapters/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAe;IACzD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAClE,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/adapters/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAe;IACzD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,C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AE,GAAG,MAAM,CAAC,OAAO,IAAI,QAAQ,EAAE,EAAE,CAAC;IACvE,CAAC;IACD,IAAI,MAAM,qBAAqB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAChD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;IAC7E,CAAC;IACD,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE;QAC9C,MAAM,EAAE,oBAAoB,MAAM,CAAC,OAAO,kBAAkB;KAC7D,CAAC;AACJ,CAAC"}
@@ -34,24 +34,47 @@ export class AdapterRegistry {
34
34
  this.builtins = new Map(BUILTIN_ADAPTERS.map((a) => [a.type, a]));
35
35
  }
36
36
  get(type) {
37
- return this.project.get(type) ?? this.global.get(type) ?? this.builtins.get(type);
37
+ const builtin = this.builtins.get(type);
38
+ const global = this.global.get(type);
39
+ const project = this.project.get(type);
40
+ if (!builtin && !global && !project)
41
+ return undefined;
42
+ const merged = {};
43
+ for (const layer of [builtin, global, project]) {
44
+ if (!layer)
45
+ continue;
46
+ for (const [key, value] of Object.entries(layer)) {
47
+ if (value !== undefined && key !== "launchDefaults") {
48
+ merged[key] = value;
49
+ }
50
+ }
51
+ }
52
+ merged.launchDefaults = {
53
+ ...builtin?.launchDefaults,
54
+ ...global?.launchDefaults,
55
+ ...project?.launchDefaults,
56
+ };
57
+ return merged;
38
58
  }
39
59
  register(config, scope = "project") {
40
60
  const map = scope === "global" ? this.global : this.project;
41
61
  map.set(config.type, config);
42
62
  }
43
63
  listAll() {
44
- const result = new Map();
45
- for (const [type, config] of this.builtins) {
46
- result.set(type, { ...config, source: "builtin" });
47
- }
48
- for (const [type, config] of this.global) {
49
- result.set(type, { ...config, source: "global" });
50
- }
51
- for (const [type, config] of this.project) {
52
- result.set(type, { ...config, source: "project" });
53
- }
54
- return Array.from(result.values());
64
+ const types = new Set([
65
+ ...this.builtins.keys(),
66
+ ...this.global.keys(),
67
+ ...this.project.keys(),
68
+ ]);
69
+ return Array.from(types, (type) => {
70
+ const config = this.get(type);
71
+ const source = this.project.has(type)
72
+ ? "project"
73
+ : this.global.has(type)
74
+ ? "global"
75
+ : "builtin";
76
+ return { ...config, source };
77
+ });
55
78
  }
56
79
  async load() {
57
80
  this.global = await this.loadFile(path.join(this.globalDir, "adapters.json"));
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/adapters/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,OAAO,eAAe;IAClB,QAAQ,CAA6B;IACrC,MAAM,GAA+B,IAAI,GAAG,EAAE,CAAC;IAC/C,OAAO,GAA+B,IAAI,GAAG,EAAE,CAAC;IAChD,SAAS,CAAS;IAClB,UAAU,CAAS;IAE3B,YAAY,SAAiB,EAAE,UAAkB;QAC/C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpF,CA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 /**
2
+ * Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import { AdapterRegistry } from "../adapters/registry.js";
23
+ import { AdapterConfig } from "../dap/types.js";
24
+ export interface ProjectSignals {
25
+ languages: string[];
26
+ testFrameworks: string[];
27
+ packageManager?: string;
28
+ pythonPath?: string;
29
+ launchJson?: string;
30
+ }
31
+ export interface DoctorAdapter {
32
+ type: string;
33
+ source: "builtin" | "global" | "project";
34
+ selected: boolean;
35
+ available: boolean;
36
+ command: string;
37
+ reason?: string;
38
+ installHint?: string;
39
+ runtime?: string;
40
+ program: string;
41
+ transport: "stdio" | "tcp";
42
+ }
43
+ export interface DoctorResult {
44
+ cwd: string;
45
+ ready: boolean;
46
+ recommendedAdapter?: string;
47
+ detected: ProjectSignals;
48
+ adapters: DoctorAdapter[];
49
+ nextSteps: string[];
50
+ }
51
+ export interface ResolvedProjectAdapter {
52
+ result: DoctorResult;
53
+ config?: AdapterConfig;
54
+ }
55
+ export declare function detectProjectSignals(cwd: string, sourceFile?: string): Promise<ProjectSignals>;
56
+ export declare function resolveProjectAdapter(registry: AdapterRegistry, options?: {
57
+ cwd?: string;
58
+ adapter?: string;
59
+ sourceFile?: string;
60
+ }): Promise<ResolvedProjectAdapter>;
61
+ export declare function runDebugDoctor(registry: AdapterRegistry, options?: {
62
+ cwd?: string;
63
+ adapter?: string;
64
+ }): Promise<DoctorResult>;