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

@randomplay/cli

v0.1.4

Published

JSON-only command shell over `@randomplay/core`.

Readme

@randomplay/cli

JSON-only command shell over @randomplay/core.

Command and flag schemas are defined with citty, while stdout remains JSON-only for AI/plugin consumers. Help output is therefore JSON (fairy help or fairy --help) instead of citty's default human text renderer.

Commands

pnpm --silent --filter @randomplay/cli run cli -- calc snapshot.json --lang zh --pretty
pnpm --silent --filter @randomplay/cli run cli -- calc snapshot.json --view verbose --lang zh --pretty
pnpm --silent --filter @randomplay/cli run cli -- compare left.json right.json --view brief --lang en --pretty
pnpm --silent --filter @randomplay/cli run cli -- compare left.json right.json --view verbose --lang en --pretty
pnpm --silent --filter @randomplay/cli run cli -- scan snapshot.json --path team[0].panel.attack --from 1000 --to 2000 --step 100
pnpm --silent --filter @randomplay/cli run cli -- explain snapshot.json
pnpm --silent --filter @randomplay/cli run cli -- migrate snapshot.json

Use - instead of a file path to read JSON from stdin. The package bin is fairy and points to packages/cli/bin/fairy.js in this workspace.

Output Contract

Stdout is always JSON.

calc defaults to --view brief. The brief output is summary-first and contains only:

  • schemaVersion: "fairy-cli-calc-brief-v1"
  • view: "brief"
  • resultMode when explicitly requested
  • calculationId
  • summary
  • warnings
  • errors

Brief summary exposes deterministic result lanes:

  • summary.lanes.nonCrit
  • summary.lanes.crit
  • summary.lanes.fixed for deterministic damage paths such as anomaly, disorder, daze, or manual events
  • summary.daze when the input produces daze value
  • summary.anomalyBuildup when non-zero anomaly buildup is produced

Use --view verbose to return the full authoritative CalcResult from @randomplay/core, including attackSegments, buckets, modifiers, events, trace, and legacy transition fields such as summary.rawTotalDamage, summary.displayTotalDamage, and summary.expectedDamage.

Warnings and errors from CalcResult are also rendered to stderr as localized diagnostic lines selected by --lang zh|en. The JSON diagnostic objects remain unchanged and language-independent.

--result-mode expected|crit|nonCrit is passed into the snapshot options before calculation. The default brief view shows non-crit and crit lanes rather than a crit-rate expectation. --result-mode expected remains available for statistical/theory checks and adds summary.expectedDamage to brief output.

compare runs calc for two BattleSnapshot files and returns schemaVersion: "fairy-cli-compare-v1". It is for deterministic binary A/B comparison such as build, buff, enemy-state, or equipment changes; RNG lane analysis remains part of calc.

compare --view brief returns:

  • view: "brief"
  • resultMode
  • left and right side summaries, not full CalcResult objects
  • delta, a summary-level damage/daze/anomaly diff
  • diff.lanes, diff.buckets, diff.modifiers, and nested contributor diffs containing changed, added, and removed entries
  • diagnostics, warnings, and errors

compare --view verbose keeps the same top-level contract but includes the full left and right CalcResult objects and includes unchanged bucket/modifier entries in diff for audit workflows.

When the two snapshots differ on identity-defining fields such as active actor, enemy, W-Engine, Drive Disc signature, or damage type, compare still emits the numeric diff but also reports localized ERR-CMP-001 warnings so callers can flag apples-to-oranges comparisons.

Invalid arguments, invalid JSON, and schema validation failures are reported as JSON error objects on stderr. Their stable error.code stays language-independent, while error.message is rendered through the same --lang zh|en catalog with English fallback strings.