mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6343] [MERGED] feat(game): community rulesets from a file or a custom repository (rulesets slice 7a) #7144
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7144
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6343
Author: @kolacheee
Created: 9/18/2026
Status: ✅ Merged
Merged: 9/19/2026
Merged by: @kolacheee
Base:
staging← Head:feat/rulesets-community📝 Commits (10+)
c2d4641feat(game): store community rulesets beside packaged onesc58871efix(game): name the chosen combat style in the ruleset note and list installed rulesets in the Agents paneld41fcd0docs(game): ruleset authoring guide, a non-d20 example and a generated JSON Schemac05a8b1feat(game): import community rulesets from a file or a custom agent repositoryf8301e7fix(game): address local review findings on the community ruleset lanes330d8e0fix(game): second round of local review findings on the ruleset lanes643019ffix(game): skip a refused repository ruleset at confirm and allow comments on every schema objectf48e231fix(agents): hold the empty Agents panel state until installed rulesets have loadeda70a7b2fix(game): bound the ruleset import request body at the route9f88a4dfix(agents): tolerate a repository preview that carries no rulesets📊 Changes
38 files changed (+5578 additions, -95 deletions)
View changed files
📝
CHANGELOG.md(+4 -0)📝
docs/CONFIGURATION.md(+8 -2)📝
docs/development/game-rulesets-and-sheets-implementation.md(+38 -1)➕
docs/examples/rulesets/ember-roads.json(+121 -0)➕
docs/extending/ruleset.schema.json(+2421 -0)➕
docs/extending/writing-rulesets.md(+148 -0)📝
docs/game/getting-started.md(+4 -2)📝
package.json(+3 -1)📝
packages/client/src/components/agents/CustomAgentRepositoriesModal.tsx(+122 -18)➕
packages/client/src/components/agents/RulesetImportReviewModal.tsx(+160 -0)📝
packages/client/src/components/game/GameSetupRulesChooser.tsx(+23 -2)📝
packages/client/src/components/game/GameSetupWizard.tsx(+27 -5)📝
packages/client/src/components/panels/AgentsPanel.tsx(+252 -4)📝
packages/client/src/hooks/use-capability-packages.ts(+26 -0)📝
packages/client/src/hooks/use-custom-agent-repositories.ts(+13 -6)📝
packages/client/src/hooks/use-game-ruleset.ts(+43 -6)➕
packages/client/src/lib/ruleset-source.ts(+16 -0)📝
packages/client/src/localization/locales/en.json(+62 -4)📝
packages/server/src/db/file-backed-store.ts(+1 -0)➕
packages/server/src/db/schema/game-rulesets.ts(+38 -0)...and 18 more files
📄 Description
Linked issue
Part of #6314 (slice 7a; it does not close the issue). Builds on #6336 and #6338 (slices 5 and 6, merged).
Why this change
What changed
game_rulesets, holds community rulesets: one row per namespaced id and version, with the exact imported text and its sha256. NoSTORAGE_VERSIONbump (same precedent asgame_dice_pools). The table has no owner and no cascade.local/<id>for a picked file and<owner>/<id>for a repository, and the registry rewritesdefinition.idto that, so nothing imported can take an official ruleset's id and two authors'v20are two rulesets. A GitHub account namedlocalis refused.version-missing); official packages keep their existing rule.POST /api/game-rulesets/import(privileged access plus Allow custom Agent imports, the same two gates asPOST /agents/import). The Agents panel's Import agents chooser gains Game Mode ruleset. The client parses the file with the shared parser, then a review shows identity, license, coverage, how checks roll, and the Game Master text verbatim with a sentence that it is sent to the model. No capability checkboxes, because a ruleset has none.DELETE /api/game-rulesets?rulesetId=removes every stored version. It needs privileged access only, so it works with imports off. When games pin the ruleset it answers 409ruleset_in_usewith the count, and the client asks again before retrying withforce=true.rulesets/*.json(direct children only, at most 32 files of 256 KB) beside or instead ofagents.json. Every existing archive safety check is unchanged. The preview lists each ruleset with a status (new, new version, already installed, version kept, cannot be used); one unusable file is a row with its reasons, never a failed repository. The preview-to-confirm digest check covers rulesets because they come from the same archive. A ruleset withdrawn upstream stays installed, and removing the repository only detaches its rulesets./game/createrefuses a community ruleset withruleset_imports_disabledand the wizard leaves them out. Resolution never consults the policy, so games already on one keep working, andGET /capability-packages/rulesetskeeps listing them so stored sheets stay readable.docs/extending/writing-rulesets.md(it leads with what a ruleset cannot do), a 2d6 example rulesetdocs/examples/rulesets/ember-roads.json, anddocs/extending/ruleset.schema.json, generated from the zod schema bypnpm ruleset:schema. New root dev dependencyzod-to-json-schema(it was already in the lockfile as a transitive dependency, same version).game-ruleset-community(storage, namespacing, exact-version pins, policy off, the guide's example),game-ruleset-import(the two routes),game-ruleset-repository(archive parsing, statuses, verbatim bytes, detach),game-ruleset-json-schema(the committed schema is current).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Commands run locally by the agent:
pnpm check(exit 0),pnpm localization:check, the full node regression lane (pnpm regression:node, 312 of 312), and the four new regressions. Six local CodeRabbit sweeps were run before opening. Their findings were fixed (error handling around the import, per-file handling in the repository lane, the wizard failing closed while the import policy loads, a route body limit), and the last complete one returned no findings. One suggestion was declined: a separate schema for the resolved community definition. Nothing re-validates a resolved definition, so the type now documents that instead.The agent also drove a scratch server on port 7820 with a fresh data folder and a keyless dummy connection (no model was connected):
added, the same bytesunchanged, changed bytes under the same version 409 with the raise-the-version message, a higher versionadded, and/capability-packages/rulesetslistedlocal/ember-roadswith versions 1, 2.local/ember-roads, version, license, coverage, how checks roll, Game Master text), and Import showed "Imported Ember Roads, version 3."/game/createon the ruleset answeredruleset_imports_disabled, and the wizard's World step showed no Rules choice.Still to verify by hand:
rulesetsfolder (needsENABLE_CUSTOM_AGENT_REPOS=true); the download against live GitHub was not exercised, only an in-memory archive through the real fetch path.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
CHANGELOG.md,docs/CONFIGURATION.md(custom agent repositories),docs/game/getting-started.md(Choosing rules), newdocs/extending/writing-rulesets.md, the plan. The[docs-i18n]follow-up is batched for the ruleset slices.UI evidence (if applicable)
To be added by a human: the Rules section, the import review dialog, and the repository preview with rulesets, in light, dark and phone width.
Summary by CodeRabbit
New Features
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.