pkg:clod/com.clodhub/rules-settings 0.11.0 House rules kept in one checked settings file that the game and the rules page both read: a loader, a JSON-schema-style validator with a schema file, typed lookups by path, and rows for a rules page. The game and the rules page must never disagree. The recipe solves this by keeping the house rules in one JSON file that the engine reads (`rules.ts`) and a human-readable document derived from it. This component generalises that: a loader reads the rules file, a small JSON-schema-style validator checks it against a schema file and reports every problem with its path, `getRule` reads a rule by path (`blinds.levels[2].big_blind`), and `ruleRows` lists every rule with the schema's description for a rules page. Checked rules are deeply frozen. A shipped envelope schema requires `schema_version`, `ruleset_id` and `game`; the recipe supplies a fuller schema for its own sections. The validator supports type, enum, const, minimum, maximum, minLength, maxLength, pattern, items, minItems, maxItems, properties, required, additionalProperties, oneOf, anyOf and local `$ref`; a schema using any other validating keyword is refused rather than silently ignored. Examples A hold'em game whose engine and rules page read the same file. A second game with its own rules file and schema using the same loader. An agent edits the rules file; the next start rejects a typo with the exact path. A client shows the rules table without a copy of the numbers. Package URL: pkg:clod/com.clodhub/rules-settings@0.11.0 Class: Rules settings (pkg:clod/com.clodhub/rules-settings-class@1.1.0): A typed settings file read, checked and frozen for the rest of the application. Any component of this class can fill a recipe slot that asks for it. Category data-and-storage/validation; https://clodhub.com/classes/rules-settings-class.txt; 0 other components of this class: https://clodhub.com/components.txt?class=pkg%3Aclod%2Fcom.clodhub%2Frules-settings-class Provides (1) - rules-settings (com.clodhub/rules-settings 1.0.0): A house rules file checked against its schema and read by path. The engine form is `RulesReader.value(path)` over checked rules, from createRulesSettings(rules) or loadRulesSettings({rulesFile, strict}, folder); methods named `RulesReader.` are members of that object. The `rulesFile` setting is a name (a lower-case slug, default house-rules), not a path: the rules are /.json with their schema beside them as /.schema.json. The checker supports type, enum, const, minimum, maximum, minLength, maxLength, pattern, items, minItems, maxItems, properties, required, additionalProperties, oneOf, anyOf and local $ref; annotation keywords are ignored and any other keyword makes the schema unusable. Browser and server: TypeScript `implementation/web/schema.ts`; file loading (server only): `implementation/server/rules.ts`, which also exports everything of schema.ts. components that use it: https://clodhub.com/components.txt?requires=com.clodhub%2Frules-settings Requires (0) - none Settings (2) The installer collects two settings. `rulesFile` is the name of the rules file the game reads (a lower-case slug; default `house-rules`): the rules are `.json` and their schema `.schema.json` in the application's rules folder (`rulesLocation`). It is a name, not a path, because clod checks every setting against a grammar and none of the grammars admits a file path. `strict`, when true (default), makes every object in the schema reject fields the schema does not list, so a misspelt rule name is an error instead of being ignored. - rulesFile: string (slug); optional, default "house-rules" - strict: boolean; optional, default true Depends on components: none How to use in a recipe A recipe uses it through a slot of class Rules settings (pkg:clod/com.clodhub/rules-settings-class 1.1.0), naming pkg:clod/com.clodhub/rules-settings as the slot's preferred component or substituting it for another component of the class. The recipe connects what it provides (rules-settings) to the slots that use it. The recipe sets rulesFile and strict; any it leaves out takes its default. - as a slot in recipe.json components: {"id":"rules-settings","class":{"name":"pkg:clod/com.clodhub/rules-settings-class","version":"1.1.0","digest":"79e247cd787503095a80b0e4dcea786731d5697855477ecc2ae740aea5ba7658"},"preferred":{"name":"pkg:clod/com.clodhub/rules-settings","version":"0.11.0"}} - in place of another component of the class: clod fetch rules-settings@0.11.0 --store store --from https://clodhub.com, then clod design RECIPE@VERSION --store store --answers answers.json --substitute SLOT=rules-settings@0.11.0 --out definition.json Used by recipes: pkg:clod/com.clodhub/ourpoker-recipe 0.13.0 (slot rules-settings) For developers: how an application uses it At startup the server calls `loadRulesSettings({rulesFile, strict}, folder)` (or `requireRules(rulesFile, schemaFile, {strict})` with explicit paths), which returns an object with `value(path)` and `has(path)`; on bad rules it throws with every problem listed and the game does not start. Other components then read numbers with `getRule(rules, "timing.decision_seconds")` instead of constants (for example the clock, level, chip and hold'em rule components can take their settings from here). The web client can import `implementation/web/schema.ts` and show `ruleRows(rules, schema)` as the rules page. Server code is `rules.ts` (reads files with `node:fs`); `web/schema.ts` has no file access and is imported by the server file, both installed under `components/rules-settings/`. `value(path)` is what the turn engine calls (it reads only `timing.decision_seconds`): the value at the dotted path, or `undefined` when the rules have none. Accounts and services No deployed service and no accounts. The rules file and schema ship with the application; reading them needs the host's file system (server) or a fetched copy (browser). How it is checked `tests/web.test.ts` loads the OurPoker house rules from `tests/fixtures/texas-holdem-house-rules.json` (test data only) and checks them against `tests/fixtures/texas-holdem-house-rules.schema.json`, then mutates them: wrong type, out-of-range number, bad enum, missing field, bad pattern, unknown field in strict mode and null only where allowed. It also tests the other keywords, refusal of unusable schemas, frozen results, path lookups, rule rows with descriptions, loading from disk and the startup error message, `value(path)` (present, missing, deep, indexed), the file-name convention and its refusal of names that could leave the folder, and loading by name. - `node --test tests/web.test.ts` (web, required-local; tools: node 26.5) Updates Patch updates replace the files only. The component keeps no data; the rules file itself is application content owned by the recipe. A rules file layout change is a `schema_version` bump decided by the recipe. Tags: data-and-storage, rules, settings, validation Targets: client web, windows; server none Publisher: George McIntyre (george-mcintyre) Guardians: Level N Ltd (guardian key 08775f20) Source: clodhub/rules-settings release v0.11.0; digest sha256:bccdcda55bd9450cdab095754e4fdef56857067ae5d2734a4516dc209d6e2f59 Release: features Line 0.11: no security releases Quality: Integration-tested, certified Known vulnerabilities: none known (checked 2026-11-26 at OSV); https://clodhub.com/api/components/rules-settings/0.11.0/vulnerabilities Downloads: 1 in 30 days; 1 of this version Classes: https://clodhub.com/classes.txt; this component as JSON: https://clodhub.com/api/components/rules-settings/0.11.0 Bundle download: GET https://clodhub.com/api/components/rules-settings/0.11.0/bundle returns a link valid for one hour Implements: pkg:clod/com.clodhub/rules-settings-class@1.1.0 79e247cd787503095a80b0e4dcea786731d5697855477ecc2ae740aea5ba7658 com.clodhub/rules-settings 1.0.0 entry modules: server server/index.ts, web web/index.ts, windows web/index.ts shared behaviour suites: shared Platforms: server, web, windows Toolchains: node >=26.5.0 <27.0.0 Frameworks: none Styles: scope none; 0 namespaces; 0 conflicts Licence: Apache-2.0; 0 upstream sources, 0 exact dependencies, 27 files (listed on the details page) Suitable for jobs: rules-settings profile any: cost none; load none; regions any; compliance none Notes: Pure library; no provider limits apply. The rules file is read once at startup. Data migration: this component keeps no data Maintainers: Level N Ltd; https://github.com/clodhub/rules-settings/issues; updates https://github.com/clodhub/rules-settings/releases (manual) What you download rules-settings-0.11.0.tar, from release v0.11.0 of clodhub/rules-settings: 27 files - Documents and manifests (8): CONTRACT.md, INSTRUCTIONS.md, LICENCE, NOTICE, PROVENANCE.md, SOURCE.md, ... - Source code (5): server/ (3), web/ (2) - Tests (4): fixtures/ (3), web.test.ts - Interface documents (1): rules-settings.json - Class files: the class's interfaces and shared checks (3): rules-settings-class/ (3) - Examples (1): consumer.ts - Diagrams (5): definition.json, examples/ (1), output/ (3) Installing copies 5 of them into the application under components/rules-settings/: server 3, web 2 Not included: the values of its settings, which the recipe writes; any secret The archive is a release file on the publisher's public GitHub repository; ClodHub keeps this page and a pointer to the release, not the code. clod checks the archive's sha256 fingerprint before anything is copied, and installing runs none of the package's code. Versions - 0.11.0 features (2026-11-26T11:31:46.931Z) sha256:bccdcda55bd9450cdab095754e4fdef56857067ae5d2734a4516dc209d6e2f59 Links Details (package foundations, upstream sources, exact dependencies, styles, class inventories, files): https://clodhub.com/components/rules-settings/details.txt?version=0.11.0 Page: https://clodhub.com/components/rules-settings; JSON: https://clodhub.com/api/components/rules-settings/0.11.0; connections diagram: https://clodhub.com/api/components/rules-settings/0.11.0/connections.svg Copyright Level N Ltd 2026