Skip to content

Commit d540502

Browse files
authored
Merge pull request #106 from microsoft/ozzafar/reduce_vsce_package_files
make skill registration harness generic
2 parents 2f3d0f7 + b44e07c commit d540502

19 files changed

Lines changed: 768 additions & 79 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,4 +420,5 @@ FodyWeavers.xsd
420420

421421
node_modules/*
422422
out/*
423+
dist/*
423424
.vscode-test/*

.vscodeignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
.vscode/**
22
.vscode-test/**
3+
.github/**
34
src/**
5+
out/**
6+
node_modules/**
7+
docs/**
8+
debugmcp-ad/**
9+
.pytest_cache/**
410
.gitignore
511
.yarnrc
12+
esbuild.js
613
vsc-extension-quickstart.md
714
**/tsconfig.json
815
**/eslint.config.mjs
916
**/*.map
1017
**/*.ts
1118
**/.vscode-test.*
12-
debugmcp-ad/**

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Let AI agents debug your code inside VS Code - set breakpoints, step through exe
44

55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66
[![VS Code](https://img.shields.io/badge/VS%20Code-1.104.0+-blue.svg)](https://code.visualstudio.com/)
7-
[![Version](https://img.shields.io/badge/version-2.2.0-green.svg)](https://github.com/microsoft/DebugMCP)
7+
[![Version](https://img.shields.io/badge/version-2.2.1-green.svg)](https://github.com/microsoft/DebugMCP)
88
[![VS Marketplace](https://img.shields.io/badge/VS%20Marketplace-Install-blue.svg)](https://marketplace.visualstudio.com/items?itemName=ozzafar.debugmcpextension)
99

1010
> **If you find DebugMCP useful, please [star the repo on GitHub](https://github.com/microsoft/DebugMCP)!** It helps others discover the project and motivates continued development.
@@ -17,11 +17,12 @@ Let AI agents debug your code inside VS Code - set breakpoints, step through exe
1717
<img src="assets/DebugMCP.gif" width="800">
1818
</p>
1919

20-
## ✨ What's New in 2.2.0
20+
## ✨ What's New
2121

22-
- **`/debug-live` Agent Skill** — DebugMCP now ships a companion [Agent Skill](./skills/debug-live/SKILL.md) that is auto-installed into each configured harness's personal skills directory (e.g. `~/.copilot/skills/debug-live/`). Invoke it with `/debug-live` in supporting agents to load the systematic debugging workflow and trigger DebugMCP tools with the right context.
23-
- **Robust debugging via the VS Code Testing API**`start_debugging` with a `testName` now uses the VS Code Testing API to discover and launch the test, replacing the previous best-effort path. This works reliably across language test runners that integrate with the Testing API (pytest, Jest/Vitest, Java, .NET, Go, etc.) and produces consistent breakpoint hits inside individual test cases.
24-
- **Concurrent debugging** - supports multiple concurrent debug sessions, allowing effective parallel agentic debugging.
22+
### 2.2
23+
- **Cross-agent `debug-live` skill install** — the systematic debugging workflow ships as an [Agent Skill](https://agentskills.io) and is now installed into the **standard skills directories**`~/.agents/skills/` (the cross-agent location honored by skills-compatible harnesses, including VS Code agent mode) and `~/.copilot/skills/` when present — so it's discoverable everywhere instead of being copied next to each agent's config where nothing scans it (fixes [#105](https://github.com/microsoft/DebugMCP/issues/105), where VS Code never loaded the skill). The server also advertises MCP `instructions` and the `start_debugging` tool points at the skill for the full workflow.
24+
- **Pause running programs** — new `pause_execution` tool interrupts a freely-running program and stops at its current location, even with no breakpoint set (great for busy loops and embedded/bare-metal targets), so you can then inspect state or step from there.
25+
- **Robust debugging via the VS Code Testing API**`start_debugging` with a `testName` uses the VS Code Testing API to discover and launch the test, producing consistent breakpoint hits inside individual test cases across language test runners (pytest, Jest/Vitest, Java, .NET, Go, etc.).
2526

2627
## 🚀 Quick Install
2728

@@ -57,6 +58,7 @@ DebugMCP is an MCP server that gives AI coding agents full control over the VS C
5758
| **step_into** | Step into function calls | None |
5859
| **step_out** | Step out of the current function | None |
5960
| **continue_execution** | Continue until next breakpoint | None |
61+
| **pause_execution** | Interrupt a freely-running program and stop at its current location (no breakpoint needed) | None |
6062
| **restart_debugging** | Restart the current debug session | None |
6163
| **add_breakpoint** | Add a breakpoint at a specific line (optionally conditional) | `fileFullPath` (required)<br>`lineContent` (required)<br>`condition` (optional) |
6264
| **remove_breakpoint** | Remove a breakpoint from a specific line | `fileFullPath` (required)<br>`line` (required) |
@@ -65,11 +67,13 @@ DebugMCP is an MCP server that gives AI coding agents full control over the VS C
6567
| **get_variables_values** | Get variables and their values at current execution point | `scope` (optional: 'local', 'global', 'all') |
6668
| **evaluate_expression** | Evaluate an expression in debug context | `expression` (required) |
6769

68-
> **Note:** The MCP server intentionally exposes **tools only** — no procedural
69-
> instructions, no documentation resources. Workflow guidance (when to debug, how to
70-
> structure a root-cause investigation, language-specific quirks) lives in the companion
71-
> [DebugMCP Agent Skill](./skills/debug-live/SKILL.md) so it can be loaded into an
72-
> agent's prompt context independently of the MCP capability surface.
70+
> **Note:** The MCP server exposes **tools** for debugger actions, while the procedural
71+
> workflow guidance (when to debug, how to structure a root-cause investigation,
72+
> language-specific quirks) lives in the companion [Agent Skill](./skills/debug-live/SKILL.md).
73+
> Tool descriptions stay terse and behavioral; the extension installs the `debug-live` skill
74+
> into the standard skills directories (`~/.agents/skills/`, plus `~/.copilot/skills/` when
75+
> present) so skills-compatible harnesses load the full workflow on demand. The server also
76+
> advertises MCP `instructions` pointing agents at it before debugging.
7377
7478
### 🎯 Debugging Best Practices
7579

docs/architecture/agentConfigurationManager.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,22 @@ url = "http://localhost:3001/mcp"
7373

7474
Uses VS Code's `globalState` to track whether the onboarding popup has been shown, preventing repeated prompts on every activation.
7575

76+
### Skill delivery — standard skills directories
77+
78+
The `debug-live` Agent Skill is installed into the **standard personal skills directories** defined by the Agent Skills open standard (agentskills.io), rather than being copied next to each agent's config file:
79+
- **`~/.agents/skills/debug-live/`** — the cross-agent location honored by skills-compatible harnesses, including VS Code agent mode and Copilot CLI. Always installed.
80+
- **`~/.copilot/skills/debug-live/`** — Copilot's own skills path; also installed when a Copilot home directory (`~/.copilot`, or `$COPILOT_HOME`) exists.
81+
82+
`installDebugMCPSkill()` copies the one bundled source (`skills/debug-live/SKILL.md`) into each target with `force: true` (idempotent refresh) and removes stale legacy copies (`debug`, `really-debug`). It is agent-independent — a single shared install covers every skills-compatible harness.
83+
84+
This fixes issue #105: earlier builds copied the skill next to each agent's config (e.g. `Code/User/skills/` for VS Code Copilot), a directory no harness scans, so the skill never loaded. Installing to `~/.agents/skills/` — which VS Code agent mode does scan — makes it discoverable.
85+
7686
## Key Code Locations
7787

7888
- Class definition: `src/utils/agentConfigurationManager.ts`
7989
- Agent definitions: `getSupportedAgents()`
8090
- Config writing: `addDebugMCPToAgent()`
91+
- Skill install: `installDebugMCPSkill()` / `getSkillInstallTargets()` / `ensureSkillRegistered()`
8192
- Codex TOML upsert: `upsertCodexDebugMCPConfig()`
8293
- Path detection: `getConfigBasePath()`
8394
- Popup logic: `shouldShowPopup()`, `showAgentSelectionPopup()`
@@ -91,6 +102,8 @@ Uses VS Code's `globalState` to track whether the onboarding popup has been show
91102
5. Show success message with option to open config file
92103
6. Mark popup as shown
93104

105+
The bundled `debug-live` skill is installed into the standard skills directories (`~/.agents/skills/`, plus `~/.copilot/skills/` when present) during step 4, so every skills-compatible harness discovers it from one shared location.
106+
94107
## Commands
95108

96109
- `debugmcp.showAgentSelectionPopup`: Manually trigger agent setup

docs/architecture/debugMCPServer.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,26 @@ extension. To avoid debugging the wrong workspace when several windows are open:
5454
`DebugMCPServer` builds one handler **per MCP session** via a handler factory, which is
5555
what lets concurrent agent sessions drive debuggers in different repos simultaneously.
5656

57-
### Tools only — no resources, no instructions
57+
### Tools & debug-live skill
5858

59-
`DebugMCPServer` exposes **tools only**. Procedural workflow guidance (when to debug,
60-
how to structure a root-cause investigation, language-specific quirks) lives in the
61-
companion Agent Skill at `skills/debug-live/SKILL.md`, not in tool descriptions or MCP
62-
resources. This separation matches modern agent ecosystems where MCP servers provide
63-
*capabilities* and skills provide *procedural knowledge* an agent loads as context.
59+
`DebugMCPServer` exposes **tools** for debugger capabilities. Detailed procedural guidance
60+
(when to debug, how to structure a root-cause investigation, language-specific quirks) lives
61+
in the companion Agent Skill at `skills/debug-live/SKILL.md`, which `AgentConfigurationManager`
62+
installs into the standard personal skills directories (`~/.agents/skills/`, and
63+
`~/.copilot/skills/` when present) so skills-compatible harnesses load it on demand. This
64+
separation matches modern agent ecosystems where MCP servers provide *capabilities* and
65+
skills provide *procedural knowledge* an agent loads as context.
6466

6567
Tool descriptions are intentionally terse and behavioral — they describe *what* the
6668
tool does, not *when* or *how* to use it in a multi-step workflow.
6769

70+
### Ensuring the workflow is loaded
71+
72+
The server `instructions` (passed to the `McpServer` constructor and returned to the client
73+
at `initialize`) and the `start_debugging` tool description both point agents at the
74+
`debug-live` skill for the full step-through workflow, so the pointer is visible even before
75+
the skill activates.
76+
6877
### Streamable HTTP Transport
6978

7079
Uses stateless HTTP POST requests for MCP communication. The express server exposes:
@@ -96,7 +105,7 @@ error wins:
96105
- Per-window control server: `src/controlServer.ts`
97106
- Cross-window routing handler: `src/routingDebuggingHandler.ts`
98107
- Shared window registry: `src/utils/workspaceRegistry.ts`
99-
- Agent Skill (companion, not part of the MCP surface): `skills/debug-live/SKILL.md`
108+
- Agent Skill (procedural workflow): `skills/debug-live/SKILL.md`
100109

101110
## Exposed Tools
102111

@@ -106,6 +115,7 @@ error wins:
106115
| `stop_debugging` | Stop current session |
107116
| `step_over/into/out` | Stepping commands |
108117
| `continue_execution` | Continue to next breakpoint |
118+
| `pause_execution` | Interrupt a running program (no breakpoint needed) |
109119
| `restart_debugging` | Restart session |
110120
| `add/remove_breakpoint` | Breakpoint management |
111121
| `clear_all_breakpoints` | Remove all breakpoints |

docs/architecture/debuggingExecutor.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Stepping and control operations use VS Code's command system:
4545
- `workbench.action.debug.stepInto`
4646
- `workbench.action.debug.stepOut`
4747
- `workbench.action.debug.continue`
48+
- `workbench.action.debug.pause`
4849
- `workbench.action.debug.restart`
4950

5051
### DAP Custom Requests

esbuild.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright (c) Microsoft Corporation.
2+
3+
const esbuild = require('esbuild');
4+
5+
const production = process.argv.includes('--production');
6+
const watch = process.argv.includes('--watch');
7+
8+
/**
9+
* Bundles the extension into a single CommonJS file so the published VSIX ships
10+
* one JS file instead of the entire production node_modules tree. `vscode` is
11+
* kept external because it is provided by the host at runtime.
12+
* @type {import('esbuild').Plugin}
13+
*/
14+
const esbuildProblemMatcherPlugin = {
15+
name: 'esbuild-problem-matcher',
16+
setup(build) {
17+
build.onStart(() => {
18+
console.log('[esbuild] build started');
19+
});
20+
build.onEnd((result) => {
21+
result.errors.forEach(({ text, location }) => {
22+
console.error(`✘ [ERROR] ${text}`);
23+
if (location) {
24+
console.error(` ${location.file}:${location.line}:${location.column}`);
25+
}
26+
});
27+
console.log('[esbuild] build finished');
28+
});
29+
},
30+
};
31+
32+
async function main() {
33+
const ctx = await esbuild.context({
34+
entryPoints: ['src/extension.ts'],
35+
bundle: true,
36+
format: 'cjs',
37+
minify: production,
38+
sourcemap: !production,
39+
sourcesContent: false,
40+
platform: 'node',
41+
outfile: 'dist/extension.js',
42+
external: ['vscode'],
43+
logLevel: 'silent',
44+
plugins: [esbuildProblemMatcherPlugin],
45+
});
46+
if (watch) {
47+
await ctx.watch();
48+
} else {
49+
await ctx.rebuild();
50+
await ctx.dispose();
51+
}
52+
}
53+
54+
main().catch((e) => {
55+
console.error(e);
56+
process.exit(1);
57+
});

0 commit comments

Comments
 (0)