Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

node-inspect-debugger

БесплатноЗапускает вложенные скриптыНе проверен

See runtime state a console.log cannot reach — set real breakpoints, step, and dump the scope chain of a paused Node/TypeScript process. Use on "set a…

BlackBeltTechnologyот BlackBeltTechnology★ 357 звёзд на GitHub

Об этом скилле

Node Inspect Debugger

Overview

console.log is a guess with a print statement attached — you have to already suspect where to look and what to print. A breakpoint inverts that: you stop the world at a line and read every local and closure variable in the frame, walk the call stack, and evaluate expressions in the paused context. When the bug lives in state a log can't cheaply reach — a closure captured three calls ago, a paused async frame, the Electron main process, the internals of a long-lived WebSocket server — the inspector is the tool.

This skill is the TOOL half of a pair; the METHOD is systematic-debugging (its Phase 1 "gather evidence" and Phase 3 "test one variable" are exactly when you reach for a breakpoint).

When to Use

Reach for the inspector when the state you need is expensive or impossible to log:

  • The dashboard server (packages/server, TypeScript run directly via the Node-native strip-only loader; the server has no jiti path) — request handlers whose failure depends on accumulated in-memory state.
  • The restart orchestrator / PTY workers (restart-helper.ts) — a detached process whose closure state you can't console.log from the parent.
  • Dual WebSocket server closure state — connection maps and buffers held in closures across the bridge and browser servers.
  • The Electron main process — lifecycle/bootstrap state that never reaches a browser console.
  • The bridge extension — code running inside every pi session, where adding logs means reloading every session.

If a single well-placed console.log would answer the question, use the log. The inspector earns its setup cost when the state is deep, closure-bound, or in a process you can't easily instrument.

Two tiers

Tier Use when Interface
REPL (node inspect) interactive, one-off, you're driving the node inspect command REPL
Programmatic CDP scripted, repeatable, or attaching from another process scripts/cdp-inspect.ts (this skill)

Tier 1 — the node inspect REPL cheat-sheet

node inspect opens a REPL against the inspector. Core commands:

Command Does
sb('file.ts', N) set breakpoint at line N of file.ts (see Pitfalls — .ts works directly)
c continue to next breakpoint
n / s / o step next / step-in / step-out
bt backtrace (call stack of the paused frame)
list(5) show 5 source lines around the pause point
repl drop into a REPL evaluated in the paused frame's scope — inspect any local
watch('expr') re-evaluate expr at every pause
exec expr evaluate one expression in the paused frame
restart / kill restart / kill the inspected process

In repl mode you can read any in-scope variable by name — this is the fastest way to answer "what is x right now?".

Tier 2 — pi-dashboard native-loader launch (the server; default)

The dashboard server runs TypeScript directly (no dist/*.js build) through the single Node-native loader @blackbelt-technology/pi-dashboard-shared/platform/native-ts-register.mjs (strip-only: module.stripTypeScriptTypes on module.registerHooks; tier 2/3 module.register on EOL 23.x). Launch the target with the inspector and that register module:

node --inspect-brk=<port> --enable-source-maps --import <native-ts-register-url> cli.ts

Resolve the URL by package specifier, never by path arithmetic:

import { createRequire } from "node:module";
import { pathToFileURL } from "node:url";
const req = createRequire(process.argv[1] ?? import.meta.url);
const hook = pathToFileURL(req.resolve("@blackbelt-technology/pi-dashboard-shared/platform/native-ts-register.mjs")).href;
  • Type erasure replaces types with whitespace, so .ts lines and columns stay aligned. First-party server source is erasable-only (no enum, runtime namespace, parameter properties), so nothing is rewritten. Keep --enable-source-maps on.
  • Do NOT launch the server with tsx or jiti --import: the server logs a foreign-loader warning and /api/restart normalizes to native.
  • The log header names the running loader: grep "launch (parent pid" ~/.pi/dashboard/server.log | tail -1.

Tier 2b — jiti launch (pi-hosted code only)

Pi-hosted TypeScript (bridge extension, plugin bridge entries) runs under pi's own jiti, not the dashboard server. To inspect such code in a standalone process, launch with jiti's register hook. PI_DASHBOARD_TS_LOADER is ignored by the server; PI_DASHBOARD_TS_LOADER=jiti no longer selects jiti. Do not use this recipe for the server.

node --inspect-brk=<port> --enable-source-maps --import <jiti-register-hook-url> cli.ts
  • --inspect-brk=<port> halts at the very first line so you can set breakpoints before anything runs.
  • --enable-source-maps is not required for line-level breakpoints (jiti is line-preserving, see pitfal
Полный SKILL.md на GitHub

Установить node-inspect-debugger в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

SKILL.md.AGENTS.mdscripts/cdp-inspect.ts

FAQ

Что делает скилл node-inspect-debugger?

See runtime state a console.log cannot reach — set real breakpoints, step, and dump the scope chain of a paused Node/TypeScript process. Use on "set a breakpoint", "inspect runtime state", "console.log isn't enough", "step through this", "what's in this closure at runtime", "attach a debugger". Not a logging or observability-setup workflow.

Как установить скилл node-inspect-debugger?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл node-inspect-debugger запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить node-inspect-debugger с