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

@selfbuilding/testing

v0.1.0

Published

scriptedHarness, tmpdirProvider and emulator setup for offline tests.

Readme

@selfbuilding/testing

The offline test kit: everything here runs with no model, no Docker daemon, no credentials and no network beyond localhost.

tmpdirProvider()

A full SandboxProvider backed by temp directories and local child processes.

  • Each box is a directory, <fsRoot>/<sandboxId>, standing in for /. Execs run /bin/sh -c with that box's root in SELFBUILDING_FS_ROOT (always the box's own root, whatever the host passed), HOME=/selfbuilding/home and TMPDIR=/tmp mapped into the box, and none of the host's environment except PATH.
  • Canonical paths (/selfbuilding/..., /run/selfbuilding/..., /tmp/...) in commands, cwd, readFile and writeFiles are mapped into the box. Write commands with the canonical paths, exactly as for a real box.
  • pause sends SIGSTOP to every process group the box started and open sends SIGCONT (expireKeeps: "memory"). Handle calls on a paused box throw SandboxUnavailableError; reopen with provider.open(ref).
  • snapshot copies the box (snap-... ids; create a box from one with image.ref = snapshotId), fork copies it per child. Both skip /run and /tmp, so secrets never land in a copy. Fork children are keyed <parent scope>/fork[<index>] and labelled selfbuilding.parent.
  • Lifetimes are enforced lazily: an expired box is paused or killed (per onExpire) on the next provider call.
  • Fault injection: provider.faults.inject(kind, op, { times }) with kinds 503, network, timeout (the call takes effect, then the response is lost), 429, 401, refuse (pause only). provider.ghost(ref, kind) leaves the listing row and removes the box.
  • Two providers given the same root see the same boxes, like two processes talking to one vendor.
  • Call close() (or await using) to kill every box and remove the root.

scriptedHarness(script, opts)

A real Harness whose CLI is a small node player shipped into the box by prepare(). It replays scripted steps (scripted.* builders: say, sh, submit, invalidThenValid, askHuman, notifyHuman, crash, hangUntilCancelled, error), runs shell steps for real, sends tool calls through the selfbuilding MCP server from PrepareContext.mcpServers (or the tool socket with toolTransport: "socket"), and prints Claude Code or Codex native stream JSON (format). Follow-up turns (resumes, ask answers) take opts.turns in order. A script can be a function of { runId, callPath, attempt }, so one harness value can play a different script per agent call.

runHarnessTurn(box, harness) plays one turn without the runtime, for harness and fixture tests.

Emulators

startGitHubEmulator() and startSlackEmulator() start emulate.dev (pinned [email protected]) with the spec seeds. seedPlayground(gh) builds a local bare repo (the git remote: the emulator has no smart HTTP) and mirrors it into the emulator; openPlaygroundPr() commits a branch, mirrors it and opens a PR. mirrorRefs() copies any pushed refs.

Golden streams

toGoldenJsonl(events, { roots }) normalises volatile values (<sandbox:1>, <session:1>, <time>, <usd>, ...) for expect(...).toMatchFileSnapshot("__golden__/<name>.jsonl").