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

@dierkens.dev/ptcgl-battle-log-state

v0.1.0

Published

Reconstruct Pokémon TCG Live board state from a battle log. Zero runtime dependencies beyond the parser; divergence is a value, not a guess.

Readme

PTCGL battle-log state

CI

Reconstruct the board from a Pokémon TCG Live battle-log export — and say so when the log cannot settle it.

A battle log names cards, never instances. When two Kangaskhan are in play, a damage line says which name, not which body. This package reconstructs what the log actually supports, in a form where a set of possibilities cannot be mistaken for a fact.

Status: pre-release. The lowering pass and the document validator ship. The solver and the corpus measurement are next. See the design spec.

Install

pnpm add @dierkens.dev/ptcgl-battle-log-state
npm  install @dierkens.dev/ptcgl-battle-log-state

Requires Node >= 22.12.0. ESM only.

The idea

The parser gives you a faithful tree of template events. That tree is a program in a small language whose meaning is board state — and the interpretation is partial and nondeterministic:

  • Partial. An event that cannot happen in a state (a knockout where nothing is at its HP, five cards discarded from a body holding four) invalidates that state. The game ran the program, so the truth is never on an impossible state.
  • Nondeterministic. Some events have a choice domain — which of two identical cards, which energy onto which body. Evaluating one yields a set.

So a prefix is one of three things, and the document always says which:

| Determinacy | Meaning | |---|---| | whole | one board | | divergent | two or more boards survive; the alternatives travel with the document | | unexecutable | no board survives — a defect, not an ambiguity |

Usage

import { isErr, validateDocument } from "@dierkens.dev/ptcgl-battle-log-state";

const result = validateDocument(unknownDocument);
if (isErr(result)) {
  for (const issue of result.error.issues) {
    console.error(issue.path, issue.message);
  }
}

validateDocument checks more than the shape: that a group's candidates agree, that a divergent document actually diverges, and that a slot inside a group does not smuggle in a value the group was supposed to hold. Those invariants are why it exists — a schema-valid document can still be a lie.

Divergence is stored per group

A list of complete boards grows exponentially: g groups with k alternatives is k^g boards that differ in g places. The document stores each group's alternatives once (k·g) and a consumer materialises a board only if it wants one.

Two invariants keep that compact form honest, and the validator enforces both: every candidate assigns all of a group's members and no one else's, and every candidate carries the same multiset of values. A group reorders evidence; it never invents or loses any.

Licence

MIT. Pokémon and Pokémon TCG Live are trademarks of The Pokémon Company. This project is not affiliated with or endorsed by them.