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

@bugchud/core

v0.2.1

Published

Schema-first TypeScript framework for the BUGCHUD! tabletop RPG: foundation types, content definitions, runtime state, simulator contracts, computed views, and the transcribed ruleset data.

Readme

@bugchud/core

@bugchud/core is the shared schema, content catalog, runtime model layer, and validation surface for Bugchud applications.

It gives downstream apps two things at once:

  • Plain JSON-friendly schemas for authored rulesets and live runtime state.
  • Ergonomic runtime classes for creating, editing, validating, and serializing that state safely.

Live runtime state now includes both aggregate injury tracking and explicit anatomy data, so applications can store wound totals alongside limb-by-limb status such as impaired, lost, prosthetic, or mutation-added body parts.

Install

npm install @bugchud/core

The package is ESM-only and targets Node 18.17+ plus modern TypeScript/bundler setups.

Quick Example

import { BugchudCore } from "@bugchud/core";
import { importedRuleset } from "@bugchud/core/data";

const core = new BugchudCore({ ruleset: importedRuleset });

const character = core.createCharacter({
  name: "Marta Rust",
  currentFate: 1,
});

character.addDream(importedRuleset.progression.dreamRefs[0]);
character.setWounds(2);
character.patchBodyPart("leftArm", {
  status: "lost",
  notes: ["Crushed in a scrap-hauler accident."],
});

const npc = core.createNpc({
  name: "Roadfang",
  allegiance: "Raiders",
});

const characterIssues = character.getIssues();
const combatDraft = character.getCombatProfileDraft();
const payload = character.toJSON();

Package Map

Applications will usually interact with these surfaces:

  • @bugchud/core The app-facing runtime layer: BugchudCore, model classes, wrappers, factories, serialization, and validation exports.
  • @bugchud/core/foundation Primitive building blocks such as branded ids, typed refs, constants, dice/effect types, and helper builders.
  • @bugchud/core/content Immutable authored ruleset definitions like BugchudRuleset, RaceDefinition, WeaponDefinition, and CreatureDefinition.
  • @bugchud/core/state Plain serializable runtime snapshots like CharacterState, CreatureState, EncounterState, and CampaignState.
  • @bugchud/core/contracts Simulator-facing interfaces for actions, events, and resolution contracts. Important for engine work, but not a finished rules engine by itself.
  • @bugchud/core/views Computed projections like ComputedCombatProfile and draft calculators that turn state plus ruleset into UI/combat-facing read models.
  • @bugchud/core/validation Structured validation result types and helpers for rulesets and runtime snapshots.
  • @bugchud/core/character Character-specific initializer and factory surface.
  • @bugchud/core/npc Creature/NPC-specific initializer and factory surface.
  • @bugchud/core/data The imported canonical ruleset and transcribed BUGCHUD content. Heavy by design and intended as read-only source data.

Core Idea

The library is intentionally layered:

  1. content describes what may exist in the ruleset.
  2. state describes what currently exists in a running game or editor.
  3. model classes like CharacterModel and NpcModel provide an ergonomic editing API over plain state.
  4. views derive read models from state plus ruleset.
  5. validation and snapshot serialization protect persistence and transport boundaries.

The important design rule is that classes are for application ergonomics, but plain snapshots remain the persistence boundary.

That means explicit body-part changes belong in plain BodyState too, not only in model helpers. If a character loses an arm, gains a prosthetic tail, or carries a long-term torso injury, those facts should survive serialization as regular runtime state.

Documentation

To sync the packaged docs onto a local machine, run:

npx --yes --package @bugchud/core finalchud-docs

That command copies the published docs/ tree into ./finalchud-docs, compares each file with a SHA-256 hash on reruns, and only overwrites files whose contents changed. Pass a custom destination as a positional argument or with --dir.

Development

npm run verify
npm run docs:check

docs:check regenerates docs/api/, validates internal markdown links, and verifies that key public symbols appear in the generated reference.

Versioning

The package is still pre-1.0. Pin versions precisely if a downstream application needs a stable integration surface.