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

@open-tomato/gates

v0.1.2

Published

Repository gates of the open-tomato projects: a control-byte gate and a privacy gate, run in CI and as pre-commit hooks.

Readme

@open-tomato/gates

Repository gates for the open-tomato projects. Each gate reads what git tracks, reports by file and line, and exits with one of three codes:

| Exit | Meaning | | --- | --- | | 0 | clean | | 1 | findings | | 2 | the gate could not run |

A gate that cannot run never reports a pass. Both gates are TypeScript run by bun, so they need bun 1.3 or newer.

bun add -d @open-tomato/gates

Run each gate through the installed package, with bun run <bin> or a package.json script. bun run only runs what the project has installed, so where the package is missing it stops with Script not found and fetches nothing. Never call a gate as a bare bunx <bin>: where the package is not installed, bunx looks the bin name up as a package of its own on the registry and runs whatever it finds there.

{
  "scripts": {
    "gate:control-bytes": "ot-control-byte-gate",
    "gate:privacy": "ot-privacy-gate"
  }
}

ot-control-byte-gate

Refuses raw control bytes and invisible characters in tracked text files. A raw NUL makes git treat a file as binary, so its diffs stop rendering, and makes grep miss text that is there. The gate also refuses the Trojan Source BiDi overrides and the zero-width characters, the same set as @open-tomato/no-unsafe-unicode in @open-tomato/eslint-plugin. The gate covers files ESLint never reads, such as YAML, shell scripts and lock files.

bun run ot-control-byte-gate                      # every tracked file
bun run ot-control-byte-gate --staged             # the index, for a pre-commit hook
bun run ot-control-byte-gate --include-untracked  # also files not yet added

ot-privacy-gate

Refuses personal and private data in what a public repository tracks:

  • Banned terms from the project's own list, stored as sha256 hashes so no file spells them: machine names, private domains, private repositories, home paths.
  • Shapes that need no list: a home directory with its account name, a private or public IPv4 address, a LAN host name, a credential prefix, an email outside the reserved example domains.
  • Sample data in stories, fixtures, mocks and tests: a URL, a phone number or a profile link must use a reserved example host or the fictional 555-01xx range.
bun run ot-privacy-gate              # tracked files and untracked ones git would track
bun run ot-privacy-gate --staged     # the index, for a pre-commit hook
bun run ot-privacy-gate --history    # every blob and commit identity, before a first push
bun run ot-privacy-gate --root ../other-repo  # a repository other than the current one

Each mode reads what it judges from where a reviewer would see it:

  • --staged reads the files and .privacy-gate.json from the index, so an allowance edited locally but never staged cannot pass a commit.
  • --history judges a blob under every path it was committed at, because the sample rules and the allow list both depend on the path.
  • An unknown flag, --root with no folder, or two modes at once stop the gate with exit 2, so a typo never runs a different scan.

The project's list

The package ships no banned terms. Each project keeps its own in .privacy-gate.json at the repository root:

{
  "banned": [
    { "sha256": "<sha256 of the lowercase term>", "label": "a private machine name" }
  ],
  "allow": [
    { "path": "package.json", "rule": "email", "sha256": "<sha256 of the evidence>", "why": "The author field." }
  ]
}

A label names the term without spelling it. Print a term's hash with:

bun -e 'console.log(new Bun.CryptoHasher("sha256").update(process.argv[1].toLowerCase()).digest("hex"))' '<term>'

An allow entry is a reviewed exception: the path glob, the rule, the sha256 of the exact text the gate reported, and why it is meant. Without a config file, the gate runs the shape rules alone and says so in its report. A malformed config stops the gate with exit 2, and so does a key other than banned, allow and $comment, or an allow rule the gate does not have: a typo there would otherwise empty a list without a word.

A pre-commit hook

#!/usr/bin/env bash
set -euo pipefail
bun run ot-control-byte-gate --staged
bun run ot-privacy-gate --staged

Save it as .githooks/pre-commit, make it executable, and turn it on once per clone with git config core.hooksPath .githooks. In a clone that has not run bun install yet, the hook stops the commit with Script not found instead of fetching anything.

Exports

The gates are importable too, for a project that wraps them:

| Path | What it holds | | --- | --- | | ./control-bytes | scanText, scanBuffer, scanFiles, listFiles | | ./privacy | judge, readSources, readConfig, parseArgs, run | | ./privacy/rules | scan, bannedIn, isSamplePath, sha256, RULE_NAMES | | ./privacy/config | readPrivacyConfig, parsePrivacyConfig, CONFIG_FILE, NO_CONFIG |