agent-dbg 0.1.0 → 0.1.2

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 (71) hide show
  1. package/.claude/settings.local.json +7 -5
  2. package/.claude/skills/agent-dbg/SKILL.md +116 -0
  3. package/.claude/skills/agent-dbg/references/commands.md +173 -0
  4. package/.vscode/launch.json +19 -0
  5. package/CLAUDE.md +2 -2
  6. package/PROGRESS.md +91 -91
  7. package/README.md +45 -17
  8. package/{ndbg-spec.md → SPEC.md} +152 -152
  9. package/dist/main.js +12500 -0
  10. package/package.json +3 -3
  11. package/src/cdp/client.ts +18 -4
  12. package/src/cdp/logger.ts +69 -0
  13. package/src/cli/parser.ts +54 -43
  14. package/src/commands/attach.ts +2 -2
  15. package/src/commands/blackbox-ls.ts +1 -1
  16. package/src/commands/blackbox-rm.ts +3 -3
  17. package/src/commands/blackbox.ts +2 -2
  18. package/src/commands/break-ls.ts +3 -2
  19. package/src/commands/break-rm.ts +2 -2
  20. package/src/commands/break-toggle.ts +2 -2
  21. package/src/commands/break.ts +46 -17
  22. package/src/commands/breakable.ts +2 -2
  23. package/src/commands/catch.ts +2 -2
  24. package/src/commands/console.ts +1 -1
  25. package/src/commands/continue.ts +5 -18
  26. package/src/commands/eval.ts +2 -2
  27. package/src/commands/exceptions.ts +1 -1
  28. package/src/commands/hotpatch.ts +2 -2
  29. package/src/commands/launch.ts +7 -11
  30. package/src/commands/logpoint.ts +7 -6
  31. package/src/commands/logs.ts +116 -0
  32. package/src/commands/pause.ts +5 -18
  33. package/src/commands/print-state.ts +85 -0
  34. package/src/commands/props.ts +2 -2
  35. package/src/commands/restart-frame.ts +1 -1
  36. package/src/commands/restart.ts +42 -0
  37. package/src/commands/run-to.ts +7 -20
  38. package/src/commands/scripts.ts +1 -1
  39. package/src/commands/search.ts +4 -3
  40. package/src/commands/set-return.ts +2 -2
  41. package/src/commands/set.ts +3 -3
  42. package/src/commands/source.ts +3 -2
  43. package/src/commands/sourcemap.ts +1 -1
  44. package/src/commands/stack.ts +1 -1
  45. package/src/commands/state.ts +3 -73
  46. package/src/commands/status.ts +3 -2
  47. package/src/commands/step.ts +5 -18
  48. package/src/commands/vars.ts +3 -1
  49. package/src/daemon/entry.ts +16 -6
  50. package/src/daemon/paths.ts +6 -2
  51. package/src/daemon/server.ts +1 -1
  52. package/src/daemon/session-breakpoints.ts +7 -2
  53. package/src/daemon/session-inspection.ts +6 -10
  54. package/src/daemon/session-state.ts +6 -5
  55. package/src/daemon/session.ts +23 -3
  56. package/src/formatter/logs.ts +110 -0
  57. package/src/formatter/path.ts +27 -0
  58. package/src/formatter/stack.ts +5 -2
  59. package/src/formatter/variables.ts +48 -1
  60. package/src/main.ts +2 -0
  61. package/src/protocol/messages.ts +3 -0
  62. package/tests/fixtures/async-app.js +1 -1
  63. package/tests/fixtures/error-app.js +1 -1
  64. package/tests/fixtures/simple-app.js +1 -1
  65. package/tests/fixtures/ts-app/src/app.ts +4 -0
  66. package/tests/integration/state.test.ts +7 -7
  67. package/tests/unit/daemon.test.ts +1 -1
  68. package/tests/unit/formatter.test.ts +8 -4
  69. package/.bin/ndbg +0 -0
  70. package/.claude/skills/ndbg-debugger/ndbg-debugger/SKILL.md +0 -116
  71. package/.claude/skills/ndbg-debugger/ndbg-debugger/references/commands.md +0 -173
@@ -4,18 +4,20 @@
4
4
  "Bash(python3:*)",
5
5
  "Bash(npx tsx:*)",
6
6
  "Bash(bun run build:*)",
7
- "Bash(timeout 15 ./dist/ndbg launch tsx:*)",
7
+ "Bash(timeout 15 ./dist/agent-dbg launch tsx:*)",
8
8
  "Bash(echo:*)",
9
9
  "Bash(timeout:*)",
10
- "Bash(./dist/ndbg stop:*)",
10
+ "Bash(./dist/agent-dbg stop:*)",
11
11
  "Bash(npm install:*)",
12
12
  "Bash(tsx:*)",
13
- "Bash(./dist/ndbg state:*)",
14
- "Bash(./dist/ndbg:*)",
13
+ "Bash(./dist/agent-dbg state:*)",
14
+ "Bash(./dist/agent-dbg:*)",
15
15
  "Bash(bun test:*)",
16
16
  "Bash(bun:*)",
17
17
  "Bash(grep:*)",
18
- "Bash(npm view:*)"
18
+ "Bash(npm view:*)",
19
+ "Bash(find:*)",
20
+ "Bash(xargs sed:*)"
19
21
  ]
20
22
  }
21
23
  }
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: agent-dbg
3
+ description: >
4
+ Debug Node.js/TypeScript/JavaScript applications using the agent-dbg CLI debugger.
5
+ Use when: (1) investigating runtime bugs by stepping through code, (2) inspecting
6
+ variable values at specific execution points, (3) setting breakpoints and conditional
7
+ breakpoints, (4) evaluating expressions in a paused context, (5) hot-patching code
8
+ without restarting, (6) debugging test failures by attaching to a running process,
9
+ (7) any task where understanding runtime behavior requires a debugger.
10
+ Triggers: "debug this", "set a breakpoint", "step through", "inspect variables",
11
+ "why is this value wrong", "trace execution", "attach debugger", "runtime error".
12
+ ---
13
+
14
+ # agent-dbg Debugger
15
+
16
+ `agent-dbg` is a CLI debugger for Node.js wrapping the V8 Inspector (CDP). It uses short `@refs` for all entities -- use them instead of long IDs.
17
+
18
+ ## Core Debug Loop
19
+
20
+ ```bash
21
+ # 1. Launch with breakpoint at first line
22
+ agent-dbg launch --brk node app.js
23
+
24
+ # 2. Set breakpoints at suspicious locations
25
+ agent-dbg break src/handler.ts:42
26
+ agent-dbg break src/utils.ts:15 --condition "count > 10"
27
+
28
+ # 3. Run to breakpoint
29
+ agent-dbg continue
30
+
31
+ # 4. Inspect state (shows location, source, locals, stack)
32
+ agent-dbg state
33
+
34
+ # 5. Drill into values
35
+ agent-dbg props @v1 # expand object
36
+ agent-dbg props @v1 --depth 3 # expand nested 3 levels
37
+ agent-dbg eval "items.filter(x => x.active)"
38
+
39
+ # 6. Fix and verify
40
+ agent-dbg set count 0 # change variable
41
+ agent-dbg hotpatch src/utils.js # live-edit (reads file from disk)
42
+ agent-dbg continue # verify fix
43
+ ```
44
+
45
+ ## Debugging Strategies
46
+
47
+ ### Bug investigation -- narrow down with breakpoints
48
+ ```bash
49
+ agent-dbg launch --brk node app.js
50
+ agent-dbg break src/api.ts:50 # suspect line
51
+ agent-dbg break src/api.ts:60 --condition "!user" # conditional
52
+ agent-dbg continue
53
+ agent-dbg vars # check locals
54
+ agent-dbg eval "JSON.stringify(req.body)" # inspect deeply
55
+ agent-dbg step over # advance one line
56
+ agent-dbg state # see new state
57
+ ```
58
+
59
+ ### Attach to running/test process
60
+ ```bash
61
+ # Start node with inspector
62
+ node --inspect app.js
63
+ # Or attach by PID
64
+ agent-dbg attach 12345
65
+ agent-dbg state
66
+ ```
67
+
68
+ ### Trace execution flow with logpoints (no pause)
69
+ ```bash
70
+ agent-dbg logpoint src/auth.ts:20 "login attempt: ${username}"
71
+ agent-dbg logpoint src/auth.ts:45 "auth result: ${result}"
72
+ agent-dbg continue
73
+ agent-dbg console # see logged output
74
+ ```
75
+
76
+ ### Exception debugging
77
+ ```bash
78
+ agent-dbg catch uncaught # pause on uncaught exceptions
79
+ agent-dbg continue # runs until exception
80
+ agent-dbg state # see where it threw
81
+ agent-dbg eval "err.message" # inspect the error
82
+ agent-dbg stack # full call stack
83
+ ```
84
+
85
+ ### TypeScript source map support
86
+ agent-dbg automatically resolves `.ts` paths via source maps. Set breakpoints using `.ts` paths, see `.ts` source in output. Use `--generated` to see compiled `.js` if needed.
87
+
88
+ ## Ref System
89
+
90
+ Every output assigns short refs. Use them everywhere:
91
+ - `@v1..@vN` -- variables: `agent-dbg props @v1`, `agent-dbg set @v2 true`
92
+ - `@f0..@fN` -- stack frames: `agent-dbg eval --frame @f1 "this"`
93
+ - `BP#1..N` -- breakpoints: `agent-dbg break-rm BP#1`, `agent-dbg break-toggle BP#1`
94
+ - `LP#1..N` -- logpoints: `agent-dbg break-rm LP#1`
95
+
96
+ Refs `@v`/`@f` reset on each pause. `BP#`/`LP#` persist until removed.
97
+
98
+ ## Key Flags
99
+
100
+ - `--json` -- machine-readable JSON output on any command
101
+ - `--session NAME` -- target a specific session (default: "default")
102
+ - `--generated` -- bypass source maps, show compiled JS (on state/source/stack)
103
+
104
+ ## Command Reference
105
+
106
+ See [references/commands.md](references/commands.md) for full command details and options.
107
+
108
+ ## Tips
109
+
110
+ - `agent-dbg state` after stepping always shows location + source + locals -- usually enough context
111
+ - `agent-dbg state -c` for source only, `-v` for vars only, `-s` for stack only -- save tokens
112
+ - `agent-dbg eval` supports `await` -- useful for async inspection
113
+ - `agent-dbg blackbox "node_modules/**"` -- skip stepping into dependencies
114
+ - `agent-dbg hotpatch file` reads the file from disk -- edit the file first, then hotpatch
115
+ - Execution commands (`continue`, `step`, `pause`, `run-to`) auto-return status
116
+ - `agent-dbg stop` kills the debugged process and daemon
@@ -0,0 +1,173 @@
1
+ # agent-dbg Command Reference
2
+
3
+ ## Table of Contents
4
+ - [Session](#session)
5
+ - [Execution](#execution)
6
+ - [Inspection](#inspection)
7
+ - [Breakpoints](#breakpoints)
8
+ - [Mutation](#mutation)
9
+ - [Blackboxing](#blackboxing)
10
+ - [Source Maps](#source-maps)
11
+ - [Global Flags](#global-flags)
12
+
13
+ ## Session
14
+
15
+ ```bash
16
+ agent-dbg launch [--brk] <command...> # Start + attach debugger (--brk pauses at first line)
17
+ agent-dbg attach <pid|ws-url|port> # Attach to running process
18
+ agent-dbg stop # Kill process + daemon
19
+ agent-dbg sessions [--cleanup] # List active sessions
20
+ agent-dbg status # Session info (pid, state, pause location)
21
+ ```
22
+
23
+ ## Execution
24
+
25
+ All execution commands automatically return session status (state + pause info).
26
+
27
+ ```bash
28
+ agent-dbg continue # Resume to next breakpoint or completion
29
+ agent-dbg step [over|into|out] # Step one statement (default: over)
30
+ agent-dbg run-to <file>:<line> # Continue to specific location
31
+ agent-dbg pause # Interrupt running process
32
+ agent-dbg restart-frame [@fN] # Re-execute frame from beginning
33
+ ```
34
+
35
+ ## Inspection
36
+
37
+ ### state -- composite snapshot
38
+ ```bash
39
+ agent-dbg state # Full snapshot: location, source, locals, stack, breakpoints
40
+ agent-dbg state -v # Locals only
41
+ agent-dbg state -s # Stack only
42
+ agent-dbg state -c # Source code only
43
+ agent-dbg state -b # Breakpoints only
44
+ agent-dbg state --depth 3 # Expand object values to depth 3
45
+ agent-dbg state --lines 10 # Show 10 lines of source context
46
+ agent-dbg state --frame @f1 # Inspect a different stack frame
47
+ agent-dbg state --all-scopes # Include closure scope variables
48
+ agent-dbg state --compact # Compact output
49
+ agent-dbg state --generated # Show compiled JS paths instead of TS
50
+ ```
51
+
52
+ ### vars -- local variables
53
+ ```bash
54
+ agent-dbg vars # All locals in current frame
55
+ agent-dbg vars name1 name2 # Filter specific variables
56
+ agent-dbg vars --frame @f1 # Variables from a different frame
57
+ agent-dbg vars --all-scopes # Include closure scope
58
+ ```
59
+
60
+ ### stack -- call stack
61
+ ```bash
62
+ agent-dbg stack # Full call stack
63
+ agent-dbg stack --async-depth 5 # Include async frames
64
+ agent-dbg stack --generated # Show compiled JS paths
65
+ ```
66
+
67
+ ### eval -- evaluate expression
68
+ ```bash
69
+ agent-dbg eval <expression> # Evaluate in current frame
70
+ agent-dbg eval "await fetchUser(id)" # Await supported
71
+ agent-dbg eval --frame @f1 "this" # Evaluate in different frame
72
+ agent-dbg eval --silent "setup()" # No output (side effects only)
73
+ agent-dbg eval --side-effect-free "x + 1" # Abort if side effects detected
74
+ agent-dbg eval --timeout 5000 "slowFn()" # Custom timeout in ms
75
+ ```
76
+
77
+ ### props -- expand object
78
+ ```bash
79
+ agent-dbg props @v1 # Expand object properties
80
+ agent-dbg props @v1 --depth 3 # Nested expansion
81
+ agent-dbg props @v1 --own # Own properties only
82
+ agent-dbg props @v1 --private # Include private fields
83
+ agent-dbg props @v1 --internal # Include internal slots
84
+ ```
85
+
86
+ ### source -- view source code
87
+ ```bash
88
+ agent-dbg source # Source around current line
89
+ agent-dbg source --lines 20 # 20 lines of context
90
+ agent-dbg source --file src/app.ts # Source of a specific file
91
+ agent-dbg source --all # Entire file
92
+ agent-dbg source --generated # Show compiled JS
93
+ ```
94
+
95
+ ### Other inspection
96
+ ```bash
97
+ agent-dbg search "query" # Search loaded scripts
98
+ agent-dbg search "pattern" --regex # Regex search
99
+ agent-dbg search "text" --case-sensitive # Case-sensitive search
100
+ agent-dbg search "text" --file <id> # Search in specific script
101
+ agent-dbg scripts # List loaded scripts
102
+ agent-dbg scripts --filter "src/" # Filter by pattern
103
+ agent-dbg console # Show console output
104
+ agent-dbg console --since 5 # Last 5 messages
105
+ agent-dbg console --level error # Filter by level
106
+ agent-dbg console --clear # Clear console buffer
107
+ agent-dbg exceptions # Show captured exceptions
108
+ agent-dbg exceptions --since 3 # Last 3 exceptions
109
+ ```
110
+
111
+ ## Breakpoints
112
+
113
+ ```bash
114
+ agent-dbg break <file>:<line> # Set breakpoint
115
+ agent-dbg break src/app.ts:42 --condition "x > 10" # Conditional
116
+ agent-dbg break src/app.ts:42 --hit-count 5 # Break on Nth hit
117
+ agent-dbg break src/app.ts:42 --continue # Log but don't pause
118
+ agent-dbg break --pattern "handler":15 # Regex URL match
119
+ agent-dbg break-rm BP#1 # Remove specific breakpoint
120
+ agent-dbg break-rm all # Remove all breakpoints
121
+ agent-dbg break-ls # List all breakpoints
122
+ agent-dbg break-toggle BP#1 # Disable/enable one breakpoint
123
+ agent-dbg break-toggle all # Disable/enable all
124
+ agent-dbg breakable src/app.ts:10-50 # List valid breakpoint locations
125
+ agent-dbg logpoint src/app.ts:20 "x=${x}" # Log without pausing
126
+ agent-dbg logpoint src/app.ts:20 "x=${x}" --condition "x > 0"
127
+ agent-dbg catch all # Pause on all exceptions
128
+ agent-dbg catch uncaught # Pause on uncaught only
129
+ agent-dbg catch none # Don't pause on exceptions
130
+ ```
131
+
132
+ ## Mutation
133
+
134
+ ```bash
135
+ agent-dbg set <@ref|name> <value> # Change variable value
136
+ agent-dbg set count 0 # By name
137
+ agent-dbg set @v2 true # By ref
138
+ agent-dbg set-return "newValue" # Change return value (at return point)
139
+ agent-dbg hotpatch <file> # Live-edit script from disk
140
+ agent-dbg hotpatch <file> --dry-run # Preview without applying
141
+ ```
142
+
143
+ ## Blackboxing
144
+
145
+ Skip stepping into matching scripts (useful for node_modules).
146
+
147
+ ```bash
148
+ agent-dbg blackbox "node_modules/**" # Add pattern
149
+ agent-dbg blackbox "lib/**" "vendor/**" # Multiple patterns
150
+ agent-dbg blackbox-ls # List patterns
151
+ agent-dbg blackbox-rm "node_modules/**" # Remove specific pattern
152
+ agent-dbg blackbox-rm all # Remove all patterns
153
+ ```
154
+
155
+ ## Source Maps
156
+
157
+ agent-dbg auto-detects source maps from `Debugger.scriptParsed` events. TypeScript `.ts` paths work transparently for breakpoints and display.
158
+
159
+ ```bash
160
+ agent-dbg sourcemap # List all loaded source maps
161
+ agent-dbg sourcemap src/app.ts # Info for specific file
162
+ agent-dbg sourcemap --disable # Disable resolution globally
163
+ ```
164
+
165
+ ## Global Flags
166
+
167
+ ```bash
168
+ --session NAME # Target session (default: "default")
169
+ --json # JSON output
170
+ --color # Enable ANSI colors
171
+ --help-agent # LLM-optimized reference card
172
+ --help # Human help
173
+ ```
@@ -0,0 +1,19 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "bun",
6
+ "request": "launch",
7
+ "name": "Debug Daemon",
8
+ "program": "src/main.ts",
9
+ "cwd": "${workspaceFolder}",
10
+ "stopOnEntry": false,
11
+ "watchMode": false,
12
+ "internalConsoleOptions": "neverOpen",
13
+ "args": [
14
+ "--daemon",
15
+ "default",
16
+ ]
17
+ },
18
+ ]
19
+ }
package/CLAUDE.md CHANGED
@@ -1,8 +1,8 @@
1
- # ndbg — Node.js Debugger CLI for AI Agents
1
+ # agent-dbg — Node.js Debugger CLI for AI Agents
2
2
 
3
3
  ## Project Overview
4
4
  CLI debugger for Node.js built with Bun, optimized for AI agent consumption.
5
- See `ndbg-spec.md` for full specification, `PROGRESS.md` for implementation status.
5
+ See `agent-dbg-spec.md` for full specification, `PROGRESS.md` for implementation status.
6
6
 
7
7
  ## Tech Stack
8
8
  - **Runtime**: Bun (compiled to standalone binary via `bun build --compile`)
package/PROGRESS.md CHANGED
@@ -1,4 +1,4 @@
1
- # ndbg Development Progress
1
+ # agent-dbg Development Progress
2
2
 
3
3
  > Status legend: `[ ]` Not started | `[~]` In progress | `[x]` Done | `[-]` Blocked
4
4
 
@@ -20,12 +20,12 @@
20
20
  ### 1.1 Daemon Architecture
21
21
 
22
22
  - [x] Daemon process spawning and backgrounding
23
- - [x] Unix socket server (listen on `$XDG_RUNTIME_DIR/ndbg/<session>.sock`)
23
+ - [x] Unix socket server (listen on `$XDG_RUNTIME_DIR/agent-dbg/<session>.sock`)
24
24
  - [x] CLI-to-daemon request/response protocol (newline-delimited JSON)
25
25
  - [x] Daemon auto-termination on process exit
26
26
  - [x] Daemon idle timeout (configurable, default 300s)
27
27
  - [x] Lock file to prevent duplicate daemons per session
28
- - [x] Crash recovery: detect dead socket, suggest `ndbg attach`
28
+ - [x] Crash recovery: detect dead socket, suggest `agent-dbg attach`
29
29
 
30
30
  ### 1.2 CDP (Chrome DevTools Protocol) Connection
31
31
 
@@ -45,7 +45,7 @@
45
45
  - [x] `LP#` refs — logpoint refs (persist until removed)
46
46
  - [x] `HS#` refs — heap snapshot refs (persist until session ends)
47
47
  - [x] Ref resolution: resolve `@ref` in CLI arguments to V8 IDs
48
- - [x] `ndbg gc-refs` — clear accumulated `@o` refs
48
+ - [x] `agent-dbg gc-refs` — clear accumulated `@o` refs
49
49
 
50
50
  ### 1.4 Output Formatter
51
51
 
@@ -56,28 +56,28 @@
56
56
  - [x] Error output with actionable suggestions (`→ Try: ...`)
57
57
  - [x] `--color` flag for ANSI terminal colors
58
58
  - [x] `--json` flag for JSON output mode
59
- - [x] Truncation hints (`... (ndbg props @oN for more)`)
59
+ - [x] Truncation hints (`... (agent-dbg props @oN for more)`)
60
60
 
61
61
  ---
62
62
 
63
63
  ## Phase 2 — Session Management
64
64
 
65
- - [x] `ndbg launch [--brk] [--session NAME] <command...>` — spawn + attach
66
- - [x] `ndbg launch --brk` — spawn with `--inspect-brk`, pause on first line
67
- - [x] `ndbg launch --port PORT` — use specific inspector port
68
- - [x] `ndbg launch --timeout SECS` — configure daemon idle timeout
69
- - [x] `ndbg attach <pid | ws-url | port>` — attach to running process
70
- - [x] `ndbg stop [--session NAME]` — kill process + daemon
71
- - [x] `ndbg sessions` — list active sessions (PID, status, name)
72
- - [x] `ndbg sessions --cleanup` — kill orphaned daemons
73
- - [x] `ndbg status` — session info (PID, pause state, breakpoints, memory, uptime)
65
+ - [x] `agent-dbg launch [--brk] [--session NAME] <command...>` — spawn + attach
66
+ - [x] `agent-dbg launch --brk` — spawn with `--inspect-brk`, pause on first line
67
+ - [x] `agent-dbg launch --port PORT` — use specific inspector port
68
+ - [x] `agent-dbg launch --timeout SECS` — configure daemon idle timeout
69
+ - [x] `agent-dbg attach <pid | ws-url | port>` — attach to running process
70
+ - [x] `agent-dbg stop [--session NAME]` — kill process + daemon
71
+ - [x] `agent-dbg sessions` — list active sessions (PID, status, name)
72
+ - [x] `agent-dbg sessions --cleanup` — kill orphaned daemons
73
+ - [x] `agent-dbg status` — session info (PID, pause state, breakpoints, memory, uptime)
74
74
  - [x] Multi-session support (`--session NAME` on any command)
75
75
 
76
76
  ---
77
77
 
78
78
  ## Phase 3 — State Snapshot
79
79
 
80
- - [x] `ndbg state` — full state snapshot (source + locals + stack + breakpoints)
80
+ - [x] `agent-dbg state` — full state snapshot (source + locals + stack + breakpoints)
81
81
  - [x] State filtering: `-v` / `--vars` (locals only)
82
82
  - [x] State filtering: `-s` / `--stack` (stack trace only)
83
83
  - [x] State filtering: `-b` / `--breakpoints` (breakpoints/logpoints only)
@@ -94,80 +94,80 @@
94
94
 
95
95
  ## Phase 4 — Breakpoints
96
96
 
97
- - [x] `ndbg break <file>:<line>` — set breakpoint (`Debugger.setBreakpointByUrl`)
98
- - [x] `ndbg break --condition <expr>` — conditional breakpoint
99
- - [x] `ndbg break --hit-count <n>` — pause on Nth hit
100
- - [x] `ndbg break --continue` — set breakpoint + immediately continue
101
- - [ ] `ndbg break --log <template>` — shortcut to logpoint
102
- - [x] `ndbg break --pattern <urlRegex>:<line>` — regex pattern breakpoint
103
- - [ ] `ndbg break-fn <expr>` — breakpoint on function call
104
- - [ ] `ndbg break-on-load [--sourcemap]` — break on new script parse
105
- - [x] `ndbg break-rm <BP# | LP# | all>` — remove breakpoints
106
- - [x] `ndbg break-ls` — list all breakpoints/logpoints with locations and conditions
107
- - [x] `ndbg break-toggle [BP# | all]` — enable/disable breakpoints
108
- - [x] `ndbg breakable <file>:<start>-<end>` — list valid breakpoint locations
109
- - [x] `ndbg logpoint <file>:<line> <template>` — set logpoint (no pause)
97
+ - [x] `agent-dbg break <file>:<line>` — set breakpoint (`Debugger.setBreakpointByUrl`)
98
+ - [x] `agent-dbg break --condition <expr>` — conditional breakpoint
99
+ - [x] `agent-dbg break --hit-count <n>` — pause on Nth hit
100
+ - [x] `agent-dbg break --continue` — set breakpoint + immediately continue
101
+ - [ ] `agent-dbg break --log <template>` — shortcut to logpoint
102
+ - [x] `agent-dbg break --pattern <urlRegex>:<line>` — regex pattern breakpoint
103
+ - [ ] `agent-dbg break-fn <expr>` — breakpoint on function call
104
+ - [ ] `agent-dbg break-on-load [--sourcemap]` — break on new script parse
105
+ - [x] `agent-dbg break-rm <BP# | LP# | all>` — remove breakpoints
106
+ - [x] `agent-dbg break-ls` — list all breakpoints/logpoints with locations and conditions
107
+ - [x] `agent-dbg break-toggle [BP# | all]` — enable/disable breakpoints
108
+ - [x] `agent-dbg breakable <file>:<start>-<end>` — list valid breakpoint locations
109
+ - [x] `agent-dbg logpoint <file>:<line> <template>` — set logpoint (no pause)
110
110
  - [ ] Logpoint `--max <n>` — auto-pause after N emissions (default: 100)
111
111
  - [x] Logpoint `--condition <expr>` — conditional logpoint
112
- - [x] `ndbg catch [all | uncaught | caught | none]` — pause-on-exception config
112
+ - [x] `agent-dbg catch [all | uncaught | caught | none]` — pause-on-exception config
113
113
 
114
114
  ---
115
115
 
116
116
  ## Phase 5 — Execution Control
117
117
 
118
- - [x] `ndbg continue` — resume execution (+ auto-state return)
119
- - [x] `ndbg step over` — step one statement over (default)
120
- - [x] `ndbg step into` — step into function call
121
- - [x] `ndbg step out` — step out of current function
122
- - [ ] `ndbg step into --break-on-async` — pause on first async task
123
- - [ ] `ndbg step --skip <pattern>` — inline blackboxing during step
124
- - [x] `ndbg run-to <file>:<line>` — continue to location (no persistent breakpoint)
125
- - [x] `ndbg restart-frame [@fN]` — re-execute frame from beginning
126
- - [x] `ndbg pause` — interrupt running process
127
- - [ ] `ndbg kill-execution` — terminate JS execution, keep session alive
118
+ - [x] `agent-dbg continue` — resume execution (+ auto-state return)
119
+ - [x] `agent-dbg step over` — step one statement over (default)
120
+ - [x] `agent-dbg step into` — step into function call
121
+ - [x] `agent-dbg step out` — step out of current function
122
+ - [ ] `agent-dbg step into --break-on-async` — pause on first async task
123
+ - [ ] `agent-dbg step --skip <pattern>` — inline blackboxing during step
124
+ - [x] `agent-dbg run-to <file>:<line>` — continue to location (no persistent breakpoint)
125
+ - [x] `agent-dbg restart-frame [@fN]` — re-execute frame from beginning
126
+ - [x] `agent-dbg pause` — interrupt running process
127
+ - [ ] `agent-dbg kill-execution` — terminate JS execution, keep session alive
128
128
 
129
129
  ---
130
130
 
131
131
  ## Phase 6 — Inspection
132
132
 
133
- - [x] `ndbg vars [name1, name2, ...]` — show local variables with `@v` refs
134
- - [x] `ndbg stack [--async-depth N]` — show call stack with `@f` refs
135
- - [x] `ndbg eval <expression>` — evaluate in current frame context
136
- - [x] `ndbg eval` with `await` support (CDP `awaitPromise`)
137
- - [x] `ndbg eval` with `@ref` interpolation
138
- - [x] `ndbg eval --frame @fN` — evaluate in specific frame
139
- - [x] `ndbg eval --silent` — suppress exception reporting
140
- - [x] `ndbg eval --timeout MS` — kill after N ms (default: 5000)
141
- - [x] `ndbg eval --side-effect-free` — throw on side effects
142
- - [x] `ndbg props <@ref>` — expand object properties (returns `@o` refs)
143
- - [x] `ndbg props --own` — only own properties
144
- - [x] `ndbg props --depth N` — recursive expansion
145
- - [x] `ndbg props --private` — include private fields
146
- - [x] `ndbg props --internal` — V8 internal properties (`[[PromiseState]]`)
147
- - [ ] `ndbg instances <expression>` — find all live instances of prototype
148
- - [ ] `ndbg globals` — list global let/const/class declarations
149
- - [x] `ndbg source [--lines N] [--file <path>] [--all]` — show source code
150
- - [x] `ndbg search <query> [--regex] [--case-sensitive] [--file <id>]` — search scripts
151
- - [x] `ndbg scripts [--filter <pattern>]` — list loaded scripts
152
- - [x] `ndbg console [--follow] [--since N] [--level] [--clear]` — console output
153
- - [x] `ndbg exceptions [--follow] [--since N]` — captured exceptions
133
+ - [x] `agent-dbg vars [name1, name2, ...]` — show local variables with `@v` refs
134
+ - [x] `agent-dbg stack [--async-depth N]` — show call stack with `@f` refs
135
+ - [x] `agent-dbg eval <expression>` — evaluate in current frame context
136
+ - [x] `agent-dbg eval` with `await` support (CDP `awaitPromise`)
137
+ - [x] `agent-dbg eval` with `@ref` interpolation
138
+ - [x] `agent-dbg eval --frame @fN` — evaluate in specific frame
139
+ - [x] `agent-dbg eval --silent` — suppress exception reporting
140
+ - [x] `agent-dbg eval --timeout MS` — kill after N ms (default: 5000)
141
+ - [x] `agent-dbg eval --side-effect-free` — throw on side effects
142
+ - [x] `agent-dbg props <@ref>` — expand object properties (returns `@o` refs)
143
+ - [x] `agent-dbg props --own` — only own properties
144
+ - [x] `agent-dbg props --depth N` — recursive expansion
145
+ - [x] `agent-dbg props --private` — include private fields
146
+ - [x] `agent-dbg props --internal` — V8 internal properties (`[[PromiseState]]`)
147
+ - [ ] `agent-dbg instances <expression>` — find all live instances of prototype
148
+ - [ ] `agent-dbg globals` — list global let/const/class declarations
149
+ - [x] `agent-dbg source [--lines N] [--file <path>] [--all]` — show source code
150
+ - [x] `agent-dbg search <query> [--regex] [--case-sensitive] [--file <id>]` — search scripts
151
+ - [x] `agent-dbg scripts [--filter <pattern>]` — list loaded scripts
152
+ - [x] `agent-dbg console [--follow] [--since N] [--level] [--clear]` — console output
153
+ - [x] `agent-dbg exceptions [--follow] [--since N]` — captured exceptions
154
154
 
155
155
  ---
156
156
 
157
157
  ## Phase 7 — Mutation
158
158
 
159
- - [x] `ndbg set <@vRef | varName> <value>` — change variable value
160
- - [x] `ndbg set-return <value>` — change return value (at return point)
161
- - [x] `ndbg hotpatch <file>` — live-edit script source (`Debugger.setScriptSource`)
162
- - [x] `ndbg hotpatch --dry-run` — check without applying
159
+ - [x] `agent-dbg set <@vRef | varName> <value>` — change variable value
160
+ - [x] `agent-dbg set-return <value>` — change return value (at return point)
161
+ - [x] `agent-dbg hotpatch <file>` — live-edit script source (`Debugger.setScriptSource`)
162
+ - [x] `agent-dbg hotpatch --dry-run` — check without applying
163
163
 
164
164
  ---
165
165
 
166
166
  ## Phase 8 — Blackboxing
167
167
 
168
- - [x] `ndbg blackbox <pattern...>` — skip stepping into matching scripts
169
- - [x] `ndbg blackbox-ls` — list current patterns
170
- - [x] `ndbg blackbox-rm <pattern | all>` — remove patterns
168
+ - [x] `agent-dbg blackbox <pattern...>` — skip stepping into matching scripts
169
+ - [x] `agent-dbg blackbox-ls` — list current patterns
170
+ - [x] `agent-dbg blackbox-rm <pattern | all>` — remove patterns
171
171
 
172
172
  ---
173
173
 
@@ -176,54 +176,54 @@
176
176
  - [x] Fetch and cache source maps from `Debugger.scriptParsed` events
177
177
  - [x] Resolve `.ts` locations to `.js` for breakpoint setting
178
178
  - [x] Display source-mapped paths in all output (stack traces, source, breakpoints)
179
- - [x] Show original source (TypeScript) in `ndbg source`
179
+ - [x] Show original source (TypeScript) in `agent-dbg source`
180
180
  - [x] Graceful fallback when no source map exists
181
- - [x] `ndbg sourcemap <file>` — show source map info
182
- - [x] `ndbg sourcemap --disable` — disable resolution globally
181
+ - [x] `agent-dbg sourcemap <file>` — show source map info
182
+ - [x] `agent-dbg sourcemap --disable` — disable resolution globally
183
183
  - [x] `--generated` flag — bypass source map resolution per-command (state, source, stack)
184
184
 
185
185
  ---
186
186
 
187
187
  ## Phase 10 — CPU Profiling
188
188
 
189
- - [ ] `ndbg cpu start [--interval <us>]` — start V8 CPU profiler
190
- - [ ] `ndbg cpu stop [--top N]` — stop profiling + report (function, file:line, self%, total%, deopt)
189
+ - [ ] `agent-dbg cpu start [--interval <us>]` — start V8 CPU profiler
190
+ - [ ] `agent-dbg cpu stop [--top N]` — stop profiling + report (function, file:line, self%, total%, deopt)
191
191
  - [ ] Save full profile to file for external tools
192
- - [ ] `ndbg coverage start [--detailed]` — start code coverage
193
- - [ ] `ndbg coverage stop [--file] [--uncovered]` — stop + report
192
+ - [ ] `agent-dbg coverage start [--detailed]` — start code coverage
193
+ - [ ] `agent-dbg coverage stop [--file] [--uncovered]` — stop + report
194
194
 
195
195
  ---
196
196
 
197
197
  ## Phase 11 — Memory / Heap
198
198
 
199
- - [ ] `ndbg heap usage` — quick heap statistics
200
- - [ ] `ndbg heap snapshot [--tag <name>]` — full heap snapshot (assigns `HS#` ref)
201
- - [ ] `ndbg heap diff <HS#a> <HS#b> [--top N]` — compare snapshots
202
- - [ ] `ndbg heap sample start [--interval] [--include-gc]` — sampling profiler
203
- - [ ] `ndbg heap sample stop [--top N]` — stop sampling + report
204
- - [ ] `ndbg heap track start` — allocation tracking (timeline)
205
- - [ ] `ndbg heap track stop` — stop tracking + report
206
- - [ ] `ndbg heap inspect <heapObjectId>` — get runtime ref from snapshot node
207
- - [ ] `ndbg gc` — force garbage collection
199
+ - [ ] `agent-dbg heap usage` — quick heap statistics
200
+ - [ ] `agent-dbg heap snapshot [--tag <name>]` — full heap snapshot (assigns `HS#` ref)
201
+ - [ ] `agent-dbg heap diff <HS#a> <HS#b> [--top N]` — compare snapshots
202
+ - [ ] `agent-dbg heap sample start [--interval] [--include-gc]` — sampling profiler
203
+ - [ ] `agent-dbg heap sample stop [--top N]` — stop sampling + report
204
+ - [ ] `agent-dbg heap track start` — allocation tracking (timeline)
205
+ - [ ] `agent-dbg heap track stop` — stop tracking + report
206
+ - [ ] `agent-dbg heap inspect <heapObjectId>` — get runtime ref from snapshot node
207
+ - [ ] `agent-dbg gc` — force garbage collection
208
208
 
209
209
  ---
210
210
 
211
211
  ## Phase 12 — Advanced / Utility
212
212
 
213
- - [ ] `ndbg inject-hook <name>` — create runtime binding (`__ndbg_<name>()`)
214
- - [ ] `ndbg hooks [--follow]` — view hook invocations
215
- - [ ] `ndbg contexts` — list V8 execution contexts
216
- - [ ] `ndbg async-depth <N>` — set async call stack depth
217
- - [ ] `ndbg config [key] [value]` — get/set daemon configuration
218
- - [ ] `ndbg gc-refs` — clear `@o` refs to free memory
219
- - [ ] `ndbg --help-agent` — compact LLM-optimized reference card
213
+ - [ ] `agent-dbg inject-hook <name>` — create runtime binding (`__agent-dbg_<name>()`)
214
+ - [ ] `agent-dbg hooks [--follow]` — view hook invocations
215
+ - [ ] `agent-dbg contexts` — list V8 execution contexts
216
+ - [ ] `agent-dbg async-depth <N>` — set async call stack depth
217
+ - [ ] `agent-dbg config [key] [value]` — get/set daemon configuration
218
+ - [ ] `agent-dbg gc-refs` — clear `@o` refs to free memory
219
+ - [ ] `agent-dbg --help-agent` — compact LLM-optimized reference card
220
220
 
221
221
  ---
222
222
 
223
223
  ## Phase 13 — Distribution & Integration
224
224
 
225
225
  - [ ] `bun build --compile` producing standalone binaries (linux-x64, darwin-arm64, etc.)
226
- - [ ] npm package (`npx ndbg` support)
226
+ - [ ] npm package (`npx agent-dbg` support)
227
227
  - [ ] SKILL.md for Claude Code agent integration
228
228
  - [ ] `--help-agent` output matching spec reference card
229
229
  - [ ] GitHub releases with prebuilt binaries