debug-run 0.5.5 → 0.5.7
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.
- package/.claude/skills/debug-run/SKILL.md +6 -2
- package/.gitattributes +3 -0
- package/dist/index.cjs +59 -16
- package/package.json +2 -2
|
@@ -18,10 +18,14 @@ Use the `debug-run` CLI tool to programmatically debug applications via the Debu
|
|
|
18
18
|
|
|
19
19
|
## Prerequisites
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
debug-run is available via npx (no installation required) or can be installed globally:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
|
|
24
|
+
# Run directly with npx
|
|
25
|
+
npx debug-run --help
|
|
26
|
+
|
|
27
|
+
# Or install globally
|
|
28
|
+
npm install -g debug-run
|
|
25
29
|
```
|
|
26
30
|
|
|
27
31
|
Check available adapters:
|
package/.gitattributes
ADDED
package/dist/index.cjs
CHANGED
|
@@ -5217,7 +5217,20 @@ var OutputFormatter = class {
|
|
|
5217
5217
|
|
|
5218
5218
|
// src/session/breakpoints.ts
|
|
5219
5219
|
var path10 = __toESM(require("node:path"), 1);
|
|
5220
|
-
function
|
|
5220
|
+
function resolveBreakpointPath(file, options = {}) {
|
|
5221
|
+
if (path10.isAbsolute(file)) {
|
|
5222
|
+
return file;
|
|
5223
|
+
}
|
|
5224
|
+
if (options.cwd) {
|
|
5225
|
+
return path10.resolve(options.cwd, file);
|
|
5226
|
+
}
|
|
5227
|
+
if (options.programPath) {
|
|
5228
|
+
const programDir = path10.dirname(options.programPath);
|
|
5229
|
+
return path10.resolve(programDir, file);
|
|
5230
|
+
}
|
|
5231
|
+
return path10.resolve(file);
|
|
5232
|
+
}
|
|
5233
|
+
function parseBreakpointSpec(spec, pathOptions = {}) {
|
|
5221
5234
|
const match = spec.match(/^(.+):(\d+)(?:\?(.+)|#(\d+))?$/);
|
|
5222
5235
|
if (!match) {
|
|
5223
5236
|
throw new Error(
|
|
@@ -5230,13 +5243,13 @@ function parseBreakpointSpec(spec) {
|
|
|
5230
5243
|
throw new Error(`Invalid line number: ${lineStr}`);
|
|
5231
5244
|
}
|
|
5232
5245
|
return {
|
|
5233
|
-
file:
|
|
5246
|
+
file: resolveBreakpointPath(file, pathOptions),
|
|
5234
5247
|
line,
|
|
5235
5248
|
condition: condition || void 0,
|
|
5236
5249
|
hitCondition: hitCount || void 0
|
|
5237
5250
|
};
|
|
5238
5251
|
}
|
|
5239
|
-
function parseLogpointSpec(spec) {
|
|
5252
|
+
function parseLogpointSpec(spec, pathOptions = {}) {
|
|
5240
5253
|
const match = spec.match(/^(.+):(\d+)\|(.+)$/);
|
|
5241
5254
|
if (!match) {
|
|
5242
5255
|
throw new Error(`Invalid logpoint format: "${spec}". Expected "file:line|log message"`);
|
|
@@ -5247,7 +5260,7 @@ function parseLogpointSpec(spec) {
|
|
|
5247
5260
|
throw new Error(`Invalid line number: ${lineStr}`);
|
|
5248
5261
|
}
|
|
5249
5262
|
return {
|
|
5250
|
-
file:
|
|
5263
|
+
file: resolveBreakpointPath(file, pathOptions),
|
|
5251
5264
|
line,
|
|
5252
5265
|
logMessage: logMessage.trim()
|
|
5253
5266
|
};
|
|
@@ -5257,15 +5270,17 @@ var BreakpointManager = class {
|
|
|
5257
5270
|
formatter;
|
|
5258
5271
|
breakpoints = /* @__PURE__ */ new Map();
|
|
5259
5272
|
nextId = 1;
|
|
5260
|
-
|
|
5273
|
+
pathOptions;
|
|
5274
|
+
constructor(client, formatter, pathOptions = {}) {
|
|
5261
5275
|
this.client = client;
|
|
5262
5276
|
this.formatter = formatter;
|
|
5277
|
+
this.pathOptions = pathOptions;
|
|
5263
5278
|
}
|
|
5264
5279
|
/**
|
|
5265
5280
|
* Add a breakpoint from a spec string
|
|
5266
5281
|
*/
|
|
5267
5282
|
addBreakpoint(spec) {
|
|
5268
|
-
const bp = parseBreakpointSpec(spec);
|
|
5283
|
+
const bp = parseBreakpointSpec(spec, this.pathOptions);
|
|
5269
5284
|
this.addBreakpointSpec(bp);
|
|
5270
5285
|
return bp;
|
|
5271
5286
|
}
|
|
@@ -5273,7 +5288,7 @@ var BreakpointManager = class {
|
|
|
5273
5288
|
* Add a logpoint from a spec string
|
|
5274
5289
|
*/
|
|
5275
5290
|
addLogpoint(spec) {
|
|
5276
|
-
const lp = parseLogpointSpec(spec);
|
|
5291
|
+
const lp = parseLogpointSpec(spec, this.pathOptions);
|
|
5277
5292
|
this.addBreakpointSpec(lp);
|
|
5278
5293
|
return lp;
|
|
5279
5294
|
}
|
|
@@ -5437,7 +5452,8 @@ var VariableInspector = class {
|
|
|
5437
5452
|
timeout: options.timeout ?? 5e3,
|
|
5438
5453
|
deduplicateByContent: options.deduplicateByContent ?? true,
|
|
5439
5454
|
compactServices: options.compactServices ?? true,
|
|
5440
|
-
omitNullProperties: options.omitNullProperties ?? true
|
|
5455
|
+
omitNullProperties: options.omitNullProperties ?? true,
|
|
5456
|
+
captureClosures: options.captureClosures ?? false
|
|
5441
5457
|
};
|
|
5442
5458
|
}
|
|
5443
5459
|
/**
|
|
@@ -5449,14 +5465,38 @@ var VariableInspector = class {
|
|
|
5449
5465
|
const contentHashes = /* @__PURE__ */ new Map();
|
|
5450
5466
|
try {
|
|
5451
5467
|
const scopesResponse = await this.client.scopes({ frameId });
|
|
5468
|
+
let foundPrimaryLocals = false;
|
|
5452
5469
|
for (const scope of scopesResponse.scopes) {
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5470
|
+
const scopeLower = scope.name.toLowerCase();
|
|
5471
|
+
const isPrimaryLocals = scopeLower === "locals" || scopeLower === "local" || scopeLower.startsWith("local:") || scopeLower.startsWith("local ");
|
|
5472
|
+
const isArguments = scopeLower === "arguments" || scopeLower.startsWith("arg");
|
|
5473
|
+
const isBlockOrClosure = scopeLower === "block" || scopeLower === "closure";
|
|
5474
|
+
const shouldInclude = isPrimaryLocals || isArguments || isBlockOrClosure && (this.options.captureClosures || !foundPrimaryLocals);
|
|
5475
|
+
if (!shouldInclude) continue;
|
|
5476
|
+
if (isPrimaryLocals) {
|
|
5477
|
+
foundPrimaryLocals = true;
|
|
5478
|
+
}
|
|
5479
|
+
const vars = await this.client.variables({
|
|
5480
|
+
variablesReference: scope.variablesReference,
|
|
5481
|
+
count: this.options.maxCollectionItems
|
|
5482
|
+
});
|
|
5483
|
+
for (const v of vars.variables) {
|
|
5484
|
+
let varName = v.name;
|
|
5485
|
+
if (varName in result) {
|
|
5486
|
+
const existingValue = result[varName];
|
|
5487
|
+
const newValue = await this.expandVariable(
|
|
5488
|
+
v,
|
|
5489
|
+
this.options.maxDepth,
|
|
5490
|
+
visited,
|
|
5491
|
+
contentHashes,
|
|
5492
|
+
v.name
|
|
5493
|
+
);
|
|
5494
|
+
if (!this.valuesEqual(existingValue, newValue)) {
|
|
5495
|
+
varName = `${v.name} (${scope.name})`;
|
|
5496
|
+
result[varName] = newValue;
|
|
5497
|
+
}
|
|
5498
|
+
} else {
|
|
5499
|
+
result[varName] = await this.expandVariable(
|
|
5460
5500
|
v,
|
|
5461
5501
|
this.options.maxDepth,
|
|
5462
5502
|
visited,
|
|
@@ -6150,7 +6190,10 @@ var DebugSession = class {
|
|
|
6150
6190
|
await this.client.initialize({
|
|
6151
6191
|
adapterID: this.config.adapter.id
|
|
6152
6192
|
});
|
|
6153
|
-
this.breakpointManager = new BreakpointManager(this.client, this.formatter
|
|
6193
|
+
this.breakpointManager = new BreakpointManager(this.client, this.formatter, {
|
|
6194
|
+
cwd: this.config.cwd,
|
|
6195
|
+
programPath: this.config.program
|
|
6196
|
+
});
|
|
6154
6197
|
this.variableInspector = new VariableInspector(this.client, {
|
|
6155
6198
|
compactServices: !this.config.expandServices,
|
|
6156
6199
|
omitNullProperties: !this.config.showNullProps,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "debug-run",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "CLI tool enabling AI agents to programmatically debug code via DAP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"prettier": "^3.8.0",
|
|
38
38
|
"tsx": "^4.21.0",
|
|
39
39
|
"typescript": "^5.3.0",
|
|
40
|
-
"vitest": "^
|
|
40
|
+
"vitest": "^4.0.17"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=18.0.0"
|