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

mons-rules

v0.3.1

Published

TypeScript rules engine for Super Metal Mons

Readme

Mons rules engine

mons-rules is the dependency-free TypeScript rules engine for Super Metal Mons. The package is an ES module targeting ES2020 and runs in browsers, Web Workers, Node.js, and Firebase Cloud Functions.

Version 0.3 introduces an intentionally smaller, idiomatic TypeScript API. Existing 0.2 users should follow MIGRATION.md.

Install

npm install mons-rules

mons-rules is ESM-only:

import { AutomovePreference, Game, GameVariant, type Input } from "mons-rules";

const game = new Game({ variant: GameVariant.Classic });

const inputs: Input[] = [
  { kind: "position", position: { row: 10, column: 5 } },
  { kind: "position", position: { row: 9, column: 4 } },
];
const result = game.play(inputs);

if (result.kind === "complete") {
  console.log(result.events);
}

const suggestion = game.suggestMove(AutomovePreference.Normal);
console.log(suggestion?.inputFen);

FEN helpers are available when a wire-format boundary is more convenient:

const game = new Game();
const result = game.playFen("l10,5;l9,4");
const restored = Game.fromFen(game.toFen());

Use preview or previewFen to inspect a partial input sequence without mutating the game. Use play or playFen to apply a complete legal move. Results, events, board items, positions, and squares are plain discriminated objects rather than mutable façade classes.

Published JavaScript uses Web-standard performance and crypto globals. Node.js 22.13 through 22.x, or Node.js 24 or newer, is required for Node consumers and repository tooling.

Validation

Install dependencies and run the complete local gate:

npm ci --engine-strict
npm run check

The check streams and replays 699,994 canonical rules transitions without unpacking the compressed corpus. It also validates the public API, deterministic automove decisions, and 1,527 complete real-player games containing 25,185 turns and 169,480 inputs across all 12 variants.

Run node ./scripts/check-complete-games.mjs to validate the immutable public corpus without replaying it. Run npm run test:complete-games for the full engine replay.

Release

Run npm run bump to increment the patch version in package.json and package-lock.json, then commit the release change. Run npm run publish -- --check-only to validate the unpublished version and perform an npm dry run. Run npm run publish from a clean worktree to publish that version to latest.

A real publish uses the transient mons-npm-publish-lock tag on origin, or the shared remote named by MONS_PUBLISH_LOCK_REMOTE, to serialize releases across hosts. The script prints lease-protected recovery instructions if cleanup fails.