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

bugbear

v1.0.2

Published

> a persistent source of annoyance — now useful

Downloads

95

Readme

bugbear

a persistent source of annoyance — now useful

Debug event logger and live navigator for Bare. Log structured events to a JSONL file from anywhere in your app, then browse them in a ranger-style TUI — drill into objects, filter, select, and page through data.

Designed for debugging and inspecting, not for production use.

Usage

  1. Install bugbear:
npm install bugbear
  1. Add bugbear to your project globally:
require('bugbear')
  1. Log events:
__bugbear('hyperswarm')({ event: 'peer-added', peers: 4 })
__bugbear('hyperswarm')({ level: 'error', msg: 'connection refused', code: 111 })

// re-usable logger
const logs = __bugbear('hyperswarm')
logs({ event: 'peer-added', peers: 4 })
logs({ level: 'error', msg: 'connection refused', code: 111 })
  1. Run your app and open the resulting JSONL file in the TUI.
node ./app.js && bugbear

navigator showing three-column layout while browsing sample/peers

This will append the log file to ./bugbear.jsonl, and open it in the TUI.

bugbear(scope) returns a scoped logger. Every call captures a stack trace. level is optional — include it as a key if you want it.

Buffers, Maps, Sets, and BigInts are serialized safely and restored when browsing.

Nested scopes

const log = bugbear(['hyperswarm', 'peers'])
log({ event: 'connected', id })

Nested scopes appear as drillable nodes in the navigator.

Custom log file

const log = bugbear('hyperswarm', { file: './debug.jsonl' })

The default file is ./bugbear.jsonl.

Global

__bugbear is available everywhere without passing it around:

require('bugbear')

const log = __bugbear('hyperswarm')
log({ event: 'peer-added', peers: 4 })

// or

__bugbear('hyperswarm')({ event: 'peer-added', peers: 4 })

bugbear registers itself at globalThis.__bugbear — one instance shared across every module, no matter how many times it's required.

Navigator

Run the CLI to browse your logs:

bugbear                          # open ./bugbear.jsonl
bugbear ./debug.jsonl            # open a specific file
bugbear --file ./debug.jsonl

The navigator watches the file for new entries and updates live. It works with any JSONL file — bugbear's own format is just regular JSONL with special-type encoding.

The three-column layout shows parent | current | preview. The current path is shown at the top.

Keys

| key | action | | ------------------- | --------------------------------------------------------------- | | j / | down | | k / | up | | l / / enter | drill in | | h / / esc | go up | | g | top | | G | bottom | | s | toggle selection on current item | | v | visual mode — range select | | c | clear all selections | | / | filter — type regex, enter to confirm, esc to clear | | m | map — type a dot-path to preview a sub-field across all items | | p | pager — scrollable expanded view of selected (or current) items | | x | cycle buffer and timestamp encoding: hex → z32 → raw | | q / ctrl+c | exit |

Filter and map compose: /\d to narrow to numeric keys, then m + latency to show just that field across every item in the preview column.

filter and map active together: /\d narrows to peers, →latency maps the preview to the latency field

License

Apache-2.0