mons-rules 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,8 @@
1
1
  # Mons rules engine
2
2
 
3
3
  `mons-rules` is the dependency-free TypeScript rules engine for Super Metal
4
- Mons. The package is an ES module targeting ES2020 and runs in browsers, Web
5
- Workers, Node.js, and Firebase Cloud Functions.
6
-
7
- Version 0.3 introduces an intentionally smaller, idiomatic TypeScript API.
8
- Existing 0.2 users should follow [MIGRATION.md](./MIGRATION.md).
4
+ Mons. It is an ESM-only package for browsers, Web Workers, Node.js, and Firebase
5
+ Cloud Functions.
9
6
 
10
7
  ## Install
11
8
 
@@ -13,77 +10,39 @@ Existing 0.2 users should follow [MIGRATION.md](./MIGRATION.md).
13
10
  npm install mons-rules
14
11
  ```
15
12
 
16
- `mons-rules` is ESM-only:
13
+ ## Use
17
14
 
18
15
  ```ts
19
16
  import { AutomovePreference, Game, GameVariant, type Input } from "mons-rules";
20
17
 
21
18
  const game = new Game({ variant: GameVariant.Classic });
22
-
23
19
  const inputs: Input[] = [
24
20
  { kind: "position", position: { row: 10, column: 5 } },
25
21
  { kind: "position", position: { row: 9, column: 4 } },
26
22
  ];
27
23
  const result = game.play(inputs);
28
-
29
- if (result.kind === "complete") {
30
- console.log(result.events);
31
- }
32
-
33
24
  const suggestion = game.suggestMove(AutomovePreference.Pro);
34
- console.log(suggestion?.inputFen);
35
25
  ```
36
26
 
37
- `AutomovePreference.Pro` uses the packed Pro search engine pinned by the v4
38
- decision corpus. When a position cannot be represented safely, Pro attempts
39
- canonical selection within the same shared deadline. It retains a legal
40
- timeout result while canonical selection runs, starting with a packed move
41
- when available or a deterministic legal fallback otherwise.
42
-
43
- FEN helpers are available when a wire-format boundary is more convenient:
44
-
45
- ```ts
46
- const game = new Game();
47
- const result = game.playFen("l10,5;l9,4");
48
- const restored = Game.fromFen(game.toFen());
49
- ```
27
+ Use `preview` or `previewFen` to inspect inputs without mutating the game. Use
28
+ `play` or `playFen` to apply a complete legal move. Serialize games with
29
+ `toFen` and restore them with `Game.fromFen`.
50
30
 
51
- Use `preview` or `previewFen` to inspect a partial input sequence without
52
- mutating the game. Use `play` or `playFen` to apply a complete legal move.
53
- Results, events, board items, positions, and squares are plain discriminated
54
- objects rather than mutable façade classes.
31
+ Published JavaScript targets ES2020 and uses Web-standard `performance` and
32
+ `crypto` globals. Node.js 22.13 through 22.x, or Node.js 24 or newer, is
33
+ required for Node consumers and repository tooling.
55
34
 
56
- Published JavaScript uses Web-standard `performance` and `crypto` globals.
57
- Node.js 22.13 through 22.x, or Node.js 24 or newer, is required for Node
58
- consumers and repository tooling.
59
-
60
- ## Validation
61
-
62
- Install dependencies and run the complete local gate:
35
+ ## Validate
63
36
 
64
37
  ```sh
65
38
  npm ci --engine-strict
66
39
  npm run check
67
40
  ```
68
41
 
69
- The check streams and replays 699,994 canonical rules transitions without
70
- unpacking the compressed corpus. It also validates the public API,
71
- deterministic automove decisions, and 1,527 complete real-player games
72
- containing 25,185 turns and 169,480 inputs across all 12 variants.
73
-
74
- Run `node ./scripts/check-complete-games.mjs` to validate the immutable public
75
- corpus without replaying it. Run `npm run test:complete-games` for the full
76
- engine replay.
77
-
78
42
  ## Release
79
43
 
80
- Run `npm run bump` to increment the patch version in `package.json` and
81
- `package-lock.json`, then commit the release change. Run
82
- `npm run publish -- --check-only` to validate the unpublished version and
83
- perform an npm dry run. Run `npm run publish` from a clean worktree to publish
84
- that version to `latest`.
85
-
86
- A real publish uses the transient `mons-npm-publish-lock` tag on `origin`, or
87
- the shared remote named by `MONS_PUBLISH_LOCK_REMOTE`, to serialize releases
88
- across hosts. The script prints lease-protected recovery instructions if
89
- cleanup fails.
44
+ ```sh
45
+ npm run bump
46
+ npm run publish -- --check-only
47
+ npm run publish
48
+ ```