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

@adysre/rules-playground

v0.1.0

Published

A runnable sandbox and the worked examples, each verified against the engine that runs it.

Readme

@adysre/rules-playground

The whole ecosystem, running.

<RulePlayground />

Builder, debugger, live verdict and JSON over rules that exercise the parts of the engine that interact. Everything a reader needs to answer "what does this thing actually do" without installing it.

The examples check themselves

Every sample declares the verdict the engine must produce:

{
  id: 'new-customer',
  label: 'A large order from a new customer',
  subject: { order: { total: 2400 }, customer: { tier: 'new' } },
  expect: 'matched',
  expectActions: ['requireApproval'],
}

verifyExamples runs them all, and the package's test fails if any example stops being true.

That is the whole design. An example is documentation, and documentation is the one part of a system nothing else tests: a rule with a screenshot beside it looks right on the day it is written, and the only thing checking it afterwards is a reader who assumes it works. If a comparison rule or an operator ever changes meaning, the example that taught it fails in CI rather than teaching the wrong thing to everybody who reads it next.

The suite is framework-free, like the storage conformance suite, so it runs in a unit test, a docs build, or a deployment checking the examples it ships.

Beyond the verdict, the tests also hold each example to being a valid rule, using only plugins it registers, offering a field for every path it reads, and naming every action it applies — the four ways an example is broken in a way a verdict alone would not catch.

What each one teaches

| Example | Shows | | --- | --- | | Order approval | a nested any inside an all, a date function, and the otherwise branch people forget exists | | Access control | list membership, a boolean that is genuinely false, and why all stopping early matters | | Discount tier | a field compared to another field, a computed operand, and between being inclusive at both ends | | Hidden fault | a rule that answers correctly by luck |

The last one is the point of the debugger. Its first condition matches, so any short-circuits and the second never runs — and the second cannot run at all, because it compares a number to a word. The rule reports matched, no diagnostic is raised, and every report says it is fine. Change the customer's tier and it reports errored.

That example asserts expectHidden: true, so it cannot quietly become an ordinary passing rule — which is exactly how a teaching example stops teaching without anybody noticing.

The clock is fixed

Never Date.now(). Half of these rules read a date, and a moving clock makes a declared verdict a lie on a schedule and the server and browser renders disagree. Each example carries the instant it is evaluated at, and a test asserts it.

Editing is the point

The badge above the builder compares the live run to what the example documents. It agrees until you change something — at which point saying "now unmatched, documented as matched" is more use than hiding the difference.

Choosing a different example replaces the document, which is the one case RuleBuilder reloads on. Editing then behaves normally: the builder recognises its own document coming back and keeps the undo stack.

No theme prop is needed inside a host with a design system — the builder inherits its tokens. Pass one to scope a different palette to the sandbox.

See documents/RULES_ENGINE.md.