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

@zeitzeuge/bun

v0.1.1

Published

Bun test runner integration for performance analysis powered by zeitzeuge.

Readme

@zeitzeuge/bun

AI-powered performance analysis for Bun test suites. Captures CPU profiles during bun test, correlates hot functions with your application code, and runs a Deep Agent to produce actionable optimization suggestions.

"Zeuge" = witness — the tool "witnesses" slowdowns in your test suite.

Installation

bun add @zeitzeuge/bun

Requires an LLM API key:

export OPENAI_API_KEY=sk-...    # or ANTHROPIC_API_KEY

Quick start

1. Run tests with the zeitzeuge preload script:

bun test --preload @zeitzeuge/bun/preload

2. Analyze the results:

import { analyzeTestRun } from '@zeitzeuge/bun';

await analyzeTestRun();

Or combine both steps in a single script:

// scripts/profile-tests.ts
import { $ } from 'bun';
import { analyzeTestRun } from '@zeitzeuge/bun';

await $`bun test --preload @zeitzeuge/bun/preload`;
await analyzeTestRun();

A Markdown report is written to zeitzeuge-report.md with findings and suggested fixes.

Recommended: on-demand profiling

Add a dedicated script so normal test runs stay fast and free of charge:

{
  "scripts": {
    "test": "bun test",
    "test:profile": "bun scripts/profile-tests.ts"
  }
}
bun test                # regular run — no profiling, no LLM cost
bun run test:profile    # profiles tests + generates AI report

bunfig.toml

Alternatively, configure the preload script in bunfig.toml:

[test]
preload = ["@zeitzeuge/bun/preload"]

Options

await analyzeTestRun({
  enabled: true, // enable/disable analysis
  output: 'zeitzeuge-report.md', // path for the Markdown report
  profileDir: '.zeitzeuge-profiles', // directory for temporary profile files
  analyzeOnFinish: true, // run Deep Agent analysis
  projectRoot: process.cwd(), // project root for classifying code
  verbose: false, // enable debug logging
});

| Option | Type | Default | Description | | ----------------- | --------- | ----------------------- | ------------------------------------- | | enabled | boolean | true | Enable/disable analysis | | output | string | 'zeitzeuge-report.md' | Path for the Markdown report | | profileDir | string | '.zeitzeuge-profiles' | Directory for temporary profile files | | analyzeOnFinish | boolean | true | Run Deep Agent analysis | | projectRoot | string | process.cwd() | Project root for classifying code | | verbose | boolean | false | Enable debug logging |

How it works

  1. Preload script captures timing — injected via --preload, it uses Bun's test lifecycle hooks (afterEach/afterAll) to record per-test timing data
  2. V8-compatible CPU profiles — Bun generates .cpuprofile files in the same V8 format used by Node.js
  3. Correlates profiles with test files — profiles are matched to test files by execution order
  4. Classifies hot functions — every profiled function is categorized as application, dependency, test, or framework
  5. Deep Agent analyzes your application code — focuses on bottlenecks in the code you wrote, not test infrastructure overhead

Exports

import { analyzeTestRun, parseBunProfile, classifyScript } from '@zeitzeuge/bun';
import type { ZeitZeugeBunTestOptions, JSCProfile, JSCProfileNode } from '@zeitzeuge/bun';

Environment variables

| Variable | Description | | ------------------- | --------------------------------------------------------------- | | OPENAI_API_KEY | OpenAI API key (preferred) | | ANTHROPIC_API_KEY | Anthropic API key (fallback) | | ZEITZEUGE_MODEL | Override model name (e.g. gpt-4o, claude-sonnet-4-20250514) |

Requirements

  • Bun >= 1.0
  • An LLM API key (OPENAI_API_KEY or ANTHROPIC_API_KEY)

Related packages

License

MIT