npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@thecto/opencode-debug-plugin

v1.6.3

Published

Debug HTTP server plugin for OpenCode with ngrok tunneling support

Downloads

1,171

Readme

OpenCode Debug Plugin

A debug plugin for OpenCode that enables runtime debugging by capturing data from instrumented code. Similar to Cursor's debug mode, this plugin allows the agent to insert fetch calls into your codebase, capture runtime data, and analyze it to identify issues.

Installation

Add the plugin to your OpenCode configuration:

{
  "plugin": ["@thecto/opencode-debug-plugin@latest"]
}

How It Works

The debug plugin enables a powerful debugging workflow:

  1. Start Debug Mode — The agent starts a local HTTP server to receive debug events
  2. Instrument Code — The agent inserts fetch() calls at strategic locations in your codebase
  3. Reproduce the Issue — You run your code and reproduce the bug
  4. Analyze Logs — The agent reads the captured data to identify the problem
  5. Clean Up — The agent removes the debug fetch calls and stops the server

Features

  • Runtime Data Capture — Capture function inputs, outputs, state changes, and errors
  • Local Debug Server — HTTP server to receive debug events
  • Ngrok Tunneling — Expose your debug server publicly for remote/deployed debugging
  • Persistent Logging — All debug events are written to .opencode/debug.log
  • Agent-Guided Workflow — The agent knows how to instrument code and analyze results

Tools

| Tool | Description | | -------------- | ----------------------------------------------------- | | debug_start | Start debug mode and get instrumentation instructions | | debug_stop | Stop debug mode (remember to remove fetch calls) | | debug_read | Read and analyze the captured debug data | | debug_clear | Clear the debug log for a fresh session | | debug_status | Check if debug mode is active and get the debug URL |

Usage

Starting a Debug Session

When you ask the agent to debug an issue, it will:

debug_start

This starts the debug server and provides the agent with instructions on how to instrument your code.

Instrumentation

The agent will insert fetch calls like this at key locations:

fetch("http://localhost:PORT/debug", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ label: "function-entry", data: { arg1, arg2 } }),
}).catch(() => {});

Common instrumentation points:

  • Function entry/exit points
  • Before/after async operations
  • Inside catch blocks for errors
  • State changes and variable mutations
  • Conditional branches to trace control flow

Reading Debug Data

After you reproduce the issue:

debug_read
debug_read tail=20

The agent analyzes the captured data to identify:

  • Execution flow
  • Unexpected values
  • Error locations
  • State discrepancies

Stopping Debug Mode

debug_stop

The agent will also remove the fetch calls it inserted.

Enabling Ngrok (Public URLs)

For debugging deployed applications or remote environments:

  1. Get an authtoken from ngrok.com
  2. In OpenCode, run:
    opencode auth login
  3. Select Otherngrok
  4. Enter your ngrok authtoken

Or set the environment variable:

export NGROK_AUTHTOKEN=your_token_here

Once configured, debug_start automatically creates a public tunnel.

Example Workflow

You: "The checkout function is returning the wrong total"

Agent:

  1. Calls debug_start
  2. Reads the checkout code
  3. Inserts fetch calls to capture cart items, prices, discounts, and the final total
  4. Says "I've instrumented the checkout function. Please try checking out now."

You: Reproduce the checkout bug

Agent:

  1. Calls debug_read
  2. Sees: cart-items: [...], discount-applied: 0.15, subtotal: 100, final-total: 80
  3. Identifies: "The discount is being applied twice. The subtotal shows 100 but the final total is 80 instead of 85."
  4. Fixes the bug and calls debug_stop
  5. Removes the debug fetch calls

License

MIT