[PR #6771] [MERGED] feat(game): rulesets describe items: an items block and catalogs of items #7322

Closed
opened 2026-10-23 04:18:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6771
Author: @kolacheee
Created: 9/27/2026
Status: ✅ Merged
Merged: 9/27/2026
Merged by: @kolacheee

Base: staging ← Head: feat/ruleset-items-format


📝 Commits (3)

  • a7d908c feat(game): rulesets describe items: an items block and catalogs of items
  • 2a2ba89 Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-format
  • 8d8d4b4 docs(rulesets): the guide's items block declares what its hunting bow uses

📊 Changes

20 files changed (+2152 additions, -45 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+32 -0)
📝 docs/examples/rulesets/ember-roads.json (+144 -0)
📝 docs/examples/rulesets/gravewatch.json (+131 -0)
📝 docs/extending/ruleset.schema.json (+845 -2)
📝 docs/extending/writing-rulesets.md (+118 -3)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+14 -0)
📝 packages/server/src/services/game/gm-prompts.ts (+4 -4)
📝 packages/shared/src/schemas/capability-package.schema.ts (+6 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+236 -19)
📝 scripts/generate-ruleset-schema.mjs (+12 -7)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+4 -4)
📝 scripts/regressions/game-ruleset-catalogs.regression.ts (+6 -3)
📝 scripts/regressions/game-ruleset-combat-core.regression.ts (+3 -0)
📝 scripts/regressions/game-ruleset-combat-creature-sheets.regression.ts (+3 -0)
📝 scripts/regressions/game-ruleset-combat-creatures.regression.ts (+5 -2)
📝 scripts/regressions/game-ruleset-dice-pool.regression.ts (+3 -0)
➕ scripts/regressions/game-ruleset-items.regression.ts (+578 -0)
📝 scripts/regressions/game-ruleset-layers.regression.ts (+3 -0)
📝 scripts/regressions/game-ruleset-wound-tracks.regression.ts (+3 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6765

Why this change

A ruleset cannot describe items today. Armor, weapons, potions, gear and money can only be typed in as rows of a sheet list, which belong to one character and which Game Mode's inventory knows nothing about. So a 5e game has no Padded Armor with an Armor Class, a weight and a rarity, and a V20 game has no pistol with its range and clip.

This is slice I1 of the ruleset items plan: the data an item carries, and the words a ruleset declares for its items. It is data only. The inventory, the sheet and fights read it in the slices after it. Keys that make an item do something (worn effects, attacks, use, charges, rarity caps, loot tables) arrive with the slice that acts on them, so a ruleset never declares one the Engine ignores.

What changed

Capability API 1.49.

  • An items block declares what every item is written in:
    • categories (at least one), rarities, tags;
    • stats, declared exactly like list columns, with promptVisible for what the Game Master sees;
    • slots with counts, and binding (a label and a maximum read off the sheet, such as attunement 3);
    • carry: the weight stat, what a character carries before being encumbered, and the most they can carry, both read off the sheet;
    • currencies: families of coins that change into each other by value. Two families never do;
    • native (default true) and freeform ("plain" or "refuse").
  • A third catalog kind, holds: "items". It declares no feeds and needs the items block. Each entry carries an item: category, rarity, tags, stat values, slots, stack, cost and binds. An entry now has exactly one of rows, creature or item, and an item carries no mechanics.
  • Checked at import, inline and in a catalog file:
    • duplicate ids, and each stat's own range, values and default;
    • the weight stat is a number never below 0, and carry and binding values never read the live state;
    • a family's smallest coin is worth 1, no two coins of a family are worth the same, a coin id is unique across families (a cost names the coin alone), and coins weigh something only beside carry;
    • every name an item uses is declared, every stat value fits its stat, an item takes no more of a slot than a character has, and it binds only where the ruleset declares binding.
  • The Game Master's op="use" line is now taught only for a catalog of rows. It used to be taught for any catalog that was not a bestiary, which would have included item catalogs.
  • The published JSON schema is regenerated, and the generator tells an editor the three-way entry rule and that item catalogs have no feeds.
  • The install gate refuses the block, an item catalog's header, and item entries inline or in a catalog file below 1.49.
  • Examples. Gravewatch binds tokens against Nerve and pays in one weightless coin. Ember Roads carries by bulk against a new load derived value and pays in two families, coin and salt.
  • Docs. A new "Items: what a party carries" section in the author guide, the catalog holds and capability notes there, the implementation record, and the CHANGELOG.
  • Existing lanes. Lanes that prove older install gates on the examples now also strip the 1.49 keys, as they do for every later key. The catalogs lane's installed package declares 1.49.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Run by the agent on this branch's one commit on staging aa3cceabf:

  • pnpm check exits 0.
  • pnpm regression:node passes 412/412.
  • pnpm smoke:ui passes 7/7.
  • pnpm regression:ui e2e/ruleset-wound-sheet.e2e.ts e2e/game-combat-director.e2e.ts e2e/ruleset-live-states.e2e.ts e2e/ruleset-sheet-sections.e2e.ts --project=desktop-chromium --workers=1 passes 12/12. These are the browser specs that load the example rulesets.
  • pnpm ruleset:schema -- --check reports the schema up to date.

The new lane scripts/regressions/game-ruleset-items.regression.ts covers:

  • both examples importing, with their items, carrying, binding and currencies;
  • every refusal of the block: duplicate ids, stat shapes, the carry stat, live reads, coin values and ids, and perWeight without carry;
  • every refusal of an item: category, rarity (and a rarity with none declared), tags, stat values, slots, cost, binding, stack bounds, and each wrong kind of entry in each kind of catalog;
  • a catalog of items in its own file;
  • the published schema's rules;
  • the use line;
  • the 1.49 gate for the block, the header, inline entries and a catalog file.

Thirty-nine deliberate breaks of these rules, in the schema, the install gate and the prompt, were each caught.

Local CodeRabbit (coderabbit review --agent --base staging), two passes, 2 and 0 findings. Both were in the new lane and both were fixed: a missing 1.49 acceptance beside a 1.48 refusal, and two non-null assertions ahead of the assert.ok that narrows them.

Still to verify by hand (not done by the agent):

  • Import docs/examples/rulesets/ember-roads.json and gravewatch.json through Rules, and confirm both import without issues.
  • Break one item on purpose (for example give the hand axe "slots": { "hands": 3 }) and confirm the import names the line.
  • Open an Ember Roads character sheet and confirm the new Load value shows in the Gear section.
  • Confirm the sheet editor's catalog picker still offers only Knacks, never the Outfitter.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Docs touched: docs/extending/writing-rulesets.md (carried by docs-i18n), docs/development/game-rulesets-and-sheets-implementation.md, the two example rulesets, the generated docs/extending/ruleset.schema.json, and CHANGELOG.md. Translations are batched for the items arc: this section joins the batched [docs-i18n] issue opened after the arc's last slice, so no per-PR issue is opened.

UI evidence (if applicable)

None: no screen changes. The only visible change is the new Load value on an Ember Roads sheet.

Summary by CodeRabbit

  • New Features
    • Rulesets can define items with categories, rarities, stats, equipment slots, currencies, and carrying or binding rules.
    • Item catalogs support validated item entries, with examples included in two rulesets.
    • Capability API 1.49 supports item definitions and catalogs.
  • Documentation
    • Updated ruleset authoring guidance and implementation notes to cover item configuration and current limitations. Item definitions are not yet used by inventory, sheets, or combat.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/6771 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 9/27/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-items-format` --- ### 📝 Commits (3) - [`a7d908c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a7d908c052653230ab26ee8f97543e20234c3ad0) feat(game): rulesets describe items: an items block and catalogs of items - [`2a2ba89`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2a2ba8957932051c63f57fba06bdbe7fd6775045) Merge remote-tracking branch 'origin/staging' into feat/ruleset-items-format - [`8d8d4b4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8d8d4b4e1e81f03520c7ec61f1c8c7edfc50210a) docs(rulesets): the guide's items block declares what its hunting bow uses ### 📊 Changes **20 files changed** (+2152 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+32 -0) 📝 `docs/examples/rulesets/ember-roads.json` (+144 -0) 📝 `docs/examples/rulesets/gravewatch.json` (+131 -0) 📝 `docs/extending/ruleset.schema.json` (+845 -2) 📝 `docs/extending/writing-rulesets.md` (+118 -3) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+14 -0) 📝 `packages/server/src/services/game/gm-prompts.ts` (+4 -4) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+6 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+236 -19) 📝 `scripts/generate-ruleset-schema.mjs` (+12 -7) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+4 -4) 📝 `scripts/regressions/game-ruleset-catalogs.regression.ts` (+6 -3) 📝 `scripts/regressions/game-ruleset-combat-core.regression.ts` (+3 -0) 📝 `scripts/regressions/game-ruleset-combat-creature-sheets.regression.ts` (+3 -0) 📝 `scripts/regressions/game-ruleset-combat-creatures.regression.ts` (+5 -2) 📝 `scripts/regressions/game-ruleset-dice-pool.regression.ts` (+3 -0) ➕ `scripts/regressions/game-ruleset-items.regression.ts` (+578 -0) 📝 `scripts/regressions/game-ruleset-layers.regression.ts` (+3 -0) 📝 `scripts/regressions/game-ruleset-wound-tracks.regression.ts` (+3 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #6765 ## Why this change A ruleset cannot describe items today. Armor, weapons, potions, gear and money can only be typed in as rows of a sheet list, which belong to one character and which Game Mode's inventory knows nothing about. So a 5e game has no Padded Armor with an Armor Class, a weight and a rarity, and a V20 game has no pistol with its range and clip. This is slice I1 of the ruleset items plan: the data an item carries, and the words a ruleset declares for its items. It is data only. The inventory, the sheet and fights read it in the slices after it. Keys that make an item do something (worn effects, attacks, use, charges, rarity caps, loot tables) arrive with the slice that acts on them, so a ruleset never declares one the Engine ignores. ## What changed Capability API 1.49. - **An `items` block** declares what every item is written in: - `categories` (at least one), `rarities`, `tags`; - `stats`, declared exactly like list columns, with `promptVisible` for what the Game Master sees; - `slots` with counts, and `binding` (a label and a maximum read off the sheet, such as attunement 3); - `carry`: the weight stat, what a character carries before being encumbered, and the most they can carry, both read off the sheet; - `currencies`: families of coins that change into each other by value. Two families never do; - `native` (default `true`) and `freeform` (`"plain"` or `"refuse"`). - **A third catalog kind, `holds: "items"`.** It declares no `feeds` and needs the `items` block. Each entry carries an `item`: category, rarity, tags, stat values, slots, `stack`, `cost` and `binds`. An entry now has exactly one of `rows`, `creature` or `item`, and an item carries no `mechanics`. - **Checked at import**, inline and in a catalog file: - duplicate ids, and each stat's own range, values and default; - the weight stat is a number never below 0, and carry and binding values never read the live state; - a family's smallest coin is worth 1, no two coins of a family are worth the same, a coin id is unique across families (a cost names the coin alone), and coins weigh something only beside `carry`; - every name an item uses is declared, every stat value fits its stat, an item takes no more of a slot than a character has, and it binds only where the ruleset declares binding. - **The Game Master's `op="use"` line** is now taught only for a catalog of rows. It used to be taught for any catalog that was not a bestiary, which would have included item catalogs. - **The published JSON schema** is regenerated, and the generator tells an editor the three-way entry rule and that item catalogs have no `feeds`. - **The install gate** refuses the block, an item catalog's header, and item entries inline or in a catalog file below 1.49. - **Examples.** Gravewatch binds tokens against Nerve and pays in one weightless coin. Ember Roads carries by bulk against a new `load` derived value and pays in two families, coin and salt. - **Docs.** A new "Items: what a party carries" section in the author guide, the catalog `holds` and capability notes there, the implementation record, and the CHANGELOG. - **Existing lanes.** Lanes that prove older install gates on the examples now also strip the 1.49 keys, as they do for every later key. The catalogs lane's installed package declares 1.49. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Run by the agent on this branch's one commit on staging aa3cceabf: - `pnpm check` exits 0. - `pnpm regression:node` passes 412/412. - `pnpm smoke:ui` passes 7/7. - `pnpm regression:ui e2e/ruleset-wound-sheet.e2e.ts e2e/game-combat-director.e2e.ts e2e/ruleset-live-states.e2e.ts e2e/ruleset-sheet-sections.e2e.ts --project=desktop-chromium --workers=1` passes 12/12. These are the browser specs that load the example rulesets. - `pnpm ruleset:schema -- --check` reports the schema up to date. The new lane `scripts/regressions/game-ruleset-items.regression.ts` covers: - both examples importing, with their items, carrying, binding and currencies; - every refusal of the block: duplicate ids, stat shapes, the carry stat, live reads, coin values and ids, and `perWeight` without `carry`; - every refusal of an item: category, rarity (and a rarity with none declared), tags, stat values, slots, cost, binding, stack bounds, and each wrong kind of entry in each kind of catalog; - a catalog of items in its own file; - the published schema's rules; - the `use` line; - the 1.49 gate for the block, the header, inline entries and a catalog file. Thirty-nine deliberate breaks of these rules, in the schema, the install gate and the prompt, were each caught. Local CodeRabbit (`coderabbit review --agent --base staging`), two passes, 2 and 0 findings. Both were in the new lane and both were fixed: a missing 1.49 acceptance beside a 1.48 refusal, and two non-null assertions ahead of the `assert.ok` that narrows them. Still to verify by hand (not done by the agent): - Import `docs/examples/rulesets/ember-roads.json` and `gravewatch.json` through **Rules**, and confirm both import without issues. - Break one item on purpose (for example give the hand axe `"slots": { "hands": 3 }`) and confirm the import names the line. - Open an Ember Roads character sheet and confirm the new **Load** value shows in the Gear section. - Confirm the sheet editor's catalog picker still offers only Knacks, never the Outfitter. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Docs touched: `docs/extending/writing-rulesets.md` (carried by `docs-i18n`), `docs/development/game-rulesets-and-sheets-implementation.md`, the two example rulesets, the generated `docs/extending/ruleset.schema.json`, and `CHANGELOG.md`. Translations are batched for the items arc: this section joins the batched `[docs-i18n]` issue opened after the arc's last slice, so no per-PR issue is opened. ## UI evidence (if applicable) None: no screen changes. The only visible change is the new **Load** value on an Ember Roads sheet. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Rulesets can define items with categories, rarities, stats, equipment slots, currencies, and carrying or binding rules. * Item catalogs support validated item entries, with examples included in two rulesets. * Capability API 1.49 supports item definitions and catalogs. * **Documentation** * Updated ruleset authoring guidance and implementation notes to cover item configuration and current limitations. Item definitions are not yet used by inventory, sheets, or combat. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:18:38 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7322
No description provided.