@archivist-gg/dnd5e
v0.1.1
Published
The D&D 5e (2014 & 2024) rules pack for Archivist: parsers, schemas, codecs, and types for every entity type, the dice/formula/tag machinery, the player-character engine, and the bundled SRD content. Built on [`@archivist-gg/core`](https://github.com/arch
Readme
@archivist-gg/dnd5e
The D&D 5e (2014 & 2024) rules pack for Archivist: parsers, schemas, codecs, and
types for every entity type, the dice/formula/tag machinery, the player-character
engine, and the bundled SRD content. Built on @archivist-gg/core.
What's inside
- Entity types — armor, background, class, subclass, race, feat,
optional-feature, item, weapon, monster, npc, and spell. Each has a parser, a
zod schema, a codec, and TypeScript types, exposed as
@archivist-gg/dnd5e/<entity>/*subpath exports. - Rules engine (
dnd/*) — ability math, proficiency/XP, the formula and inline-tag grammar, resource dice, and SRD tag conversion. - Player characters (
pc/*) — parse → resolve → recalc a character into derived stats (AC, saves, skills, attacks, spellcasting, resources, rest), plus the decision engine, equipment/slotting, and conditions. - SRD data — System Reference Document 5.1 and 5.2 as
.mdsources plus canonical/runtime JSON, loadable throughsrd-store.
Common entry points are re-exported from the package root; everything else is available via subpath exports.
Usage
Distributed as TypeScript source (no build step). It depends on @archivist-gg/core
via a sibling path dependency, so clone both repos side by side:
archivist-core/
archivist-dnd5e/// package.json
"dependencies": {
"@archivist-gg/core": "file:../archivist-core",
"@archivist-gg/dnd5e": "file:../archivist-dnd5e"
}Running npm install in archivist-dnd5e then resolves the sibling.
import { parseMonster, dnd5ePack } from "@archivist-gg/dnd5e";
import { parsePC } from "@archivist-gg/dnd5e/pc/pc.parser";Scripts
npm run typecheck— type-check the pack and its tools.npm test— run the test suite with vitest (regenerates the SRD md-index first).npm run generate— regeneratesrc/data-srd/index.generated.tsfrom the.mdsources.npm run build:srd-canonical[:refresh]— dev tool that rebuilds the canonical SRD JSON from an external 5etools structured-rules dump (STRUCTURED_RULES_PATH). Not part of the test gate; the committedsrc/srd/data/{canonical,runtime}JSON is the consumer contract.
License
- Code: MIT — see LICENSE.
- Bundled SRD data (
src/srd/data/,src/data-srd/): System Reference Document 5.1 and 5.2 by Wizards of the Coast LLC, licensed under CC-BY-4.0. See LICENSES/SRD.md.
