Skip to content

Latest commit

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Windows Debugger

A lightweight Node.js REPL debugger for Windows that spawns a PowerShell window and connects to your running process for live debugging.

Demo

✨ Features

  • Windows-only debugger (uses PowerShell)
  • Creates a separate REPL session connected to your Node.js process
  • Lets you inspect variables, run commands, and evaluate code in real-time
  • Provides a configurable default return value when no command is entered
  • Automatically sets a custom PowerShell window title for your session

📦 Installation

npm install windows-debugger

🚀 Usage

constwindowsDebugger=require("windows-debugger");// Start a debugger sessionwindowsDebugger({title: "MyApp Debugger",default: "Nothing entered",eval: (code)=>eval(code)});

When called, this will:

  1. Start a local TCP REPL server.
  2. Launch a new PowerShell window with the given title.
  3. Connect the REPL to your running Node.js process.

🛠 Example

constwindowsDebugger=require("windows-debugger");letcounter=0;setInterval(()=>{counter++;console.log("Counter:",counter);},2000);windowsDebugger({title: "Counter Debugger",default: "No input",eval: (code)=>eval(code)});
  • A new PowerShell window will open with the title Counter Debugger.

  • Inside the window, you can type:

    counter

    And see the live value of the counter variable.


⚠️ Requirements

  • Windows only (process.platform === "win32" is enforced)
  • Requires PowerShell installed and accessible via powershell.exe
  • Works with Node.js v14+ (earlier versions untested)

📖 API

windowsDebugger(options)

OptionTypeDescription
titlestringThe window title for the PowerShell debugger session.
defaultanyThe default return value when pressing enter without typing a command.
evalFunctionAn eval function used to evaluate REPL input.
passwordstringIf not provided, a random one-time UUID is generated automatically.

🔒 Error Handling

  • All REPL errors are caught and displayed in the PowerShell session.
  • Domain errors are suppressed to avoid crashing the main process.

📝 License

MIT

About

Opens a Windows terminal window with a REPL for debugging.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages