@gameslate/sdk 0.3.16 → 0.3.19
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 +23 -3
- package/bin/gameslate-plugin.mjs +8 -3
- package/build/build-plugin.d.mts +8 -2
- package/build/build-plugin.mjs +74 -43
- package/build/third-party-licences.d.mts +7 -0
- package/build/third-party-licences.mjs +52 -0
- package/build/zip.d.mts +6 -0
- package/build/zip.mjs +94 -0
- package/lib/assets.d.ts +41 -1
- package/lib/assets.js +22 -0
- package/lib/host/asset-sandbox.d.ts +2 -1
- package/lib/host/asset-sandbox.js +7 -2
- package/lib/host/index.d.ts +1 -0
- package/lib/host/index.js +1 -0
- package/lib/host/inspect.d.ts +2 -0
- package/lib/host/inspect.js +6 -2
- package/lib/host/plugin-registry.d.ts +11 -0
- package/lib/host/plugin-registry.js +130 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/pack.d.ts +1 -1
- package/lib/plugin/contract.d.ts +3 -46
- package/lib/plugin-manifest.d.ts +175 -24
- package/lib/plugin-manifest.js +88 -11
- package/lib/plugin-permissions.d.ts +20 -0
- package/lib/plugin-permissions.js +58 -0
- package/lib/plugins-api.d.ts +476 -6
- package/lib/plugins-api.js +56 -1
- package/lib/registry.d.ts +0 -81
- package/lib/registry.js +0 -16
- package/package.json +1 -1
- package/template/README.md +8 -0
- package/template/claude/skills/build-gameslate-plugin/SKILL.md +185 -10
- package/template/claude/skills/verify-gameslate-plugin/SKILL.md +4 -3
- package/template/github/workflows/release.yml +38 -0
- package/template/gitignore +2 -0
- package/template/plugin/tracked-documents.test.ts +68 -0
package/lib/plugins-api.js
CHANGED
|
@@ -1,15 +1,47 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { Sha256Schema } from './plugin-manifest.js';
|
|
3
|
+
import { PluginPermissionSchema } from './plugin-permissions.js';
|
|
2
4
|
/*
|
|
3
5
|
* The daemon's plugin API for the cog (GET /api/plugins and the switch and job endpoints): what's
|
|
4
|
-
* installed, each plugin's feature switches, and the extraction job, if any
|
|
6
|
+
* installed, each plugin's feature switches, and the extraction job, if any; and plugins added by
|
|
7
|
+
* URL (preview, install, updates, rollback, remove).
|
|
5
8
|
*/
|
|
6
9
|
const Feature = z.object({ available: z.boolean(), on: z.boolean() });
|
|
10
|
+
/** A plugin the player added by URL; a preset (built with the core) has none. */
|
|
11
|
+
export const InstalledInfoSchema = z.object({
|
|
12
|
+
/** the manifest or zip URL it was added from */
|
|
13
|
+
url: z.string(),
|
|
14
|
+
/** false for a plain zip: there is no manifest to check for updates */
|
|
15
|
+
updates: z.boolean(),
|
|
16
|
+
autoUpdate: z.boolean(),
|
|
17
|
+
/** the version kept for a rollback */
|
|
18
|
+
previous: z.string().nullable(),
|
|
19
|
+
/** a newer version found at the URL, not installed yet */
|
|
20
|
+
update: z
|
|
21
|
+
.object({
|
|
22
|
+
version: z.string(),
|
|
23
|
+
/** its zip's sha256: confirming sends it back, so only this version installs */
|
|
24
|
+
sha256: Sha256Schema,
|
|
25
|
+
/** permissions it asks for that this version doesn't have: it waits for consent */
|
|
26
|
+
wants: z.array(PluginPermissionSchema),
|
|
27
|
+
/** it installs itself (auto-update on, nothing new asked, not rolled back from, not
|
|
28
|
+
* failed before) */
|
|
29
|
+
automatic: z.boolean(),
|
|
30
|
+
/** it will install itself once no game from this plugin is running */
|
|
31
|
+
waitingForGame: z.boolean(),
|
|
32
|
+
})
|
|
33
|
+
.nullable(),
|
|
34
|
+
/** why the last update check or automatic update failed */
|
|
35
|
+
checkError: z.string().nullable(),
|
|
36
|
+
});
|
|
7
37
|
export const PluginViewSchema = z.object({
|
|
8
38
|
id: z.string(),
|
|
9
39
|
name: z.string(),
|
|
10
40
|
version: z.string(),
|
|
11
41
|
/** built and tested with another core version */
|
|
12
42
|
untested: z.boolean(),
|
|
43
|
+
/** null: a preset, which can be hidden but not removed */
|
|
44
|
+
installed: InstalledInfoSchema.nullable(),
|
|
13
45
|
features: z.object({ live: Feature, assets: Feature }),
|
|
14
46
|
games: z.array(z.object({
|
|
15
47
|
id: z.string(),
|
|
@@ -40,4 +72,27 @@ export const JobStatusSchema = z.object({
|
|
|
40
72
|
export const PluginsResponseSchema = z.object({
|
|
41
73
|
plugins: z.array(PluginViewSchema),
|
|
42
74
|
job: JobStatusSchema.nullable(),
|
|
75
|
+
/** presets the player hid: not loaded, offered to show again */
|
|
76
|
+
hidden: z.array(z.object({ id: z.string(), name: z.string(), version: z.string() })),
|
|
77
|
+
/** why plugins can't be added, updated or removed right now (the daemon's install record is
|
|
78
|
+
* damaged), or null */
|
|
79
|
+
installError: z.string().nullable(),
|
|
80
|
+
});
|
|
81
|
+
/** What a URL holds, shown for the player to confirm before anything is installed. */
|
|
82
|
+
export const PluginPreviewSchema = z.object({
|
|
83
|
+
url: z.string(),
|
|
84
|
+
/** a published manifest (updates are checked), or a plain zip (no update checks) */
|
|
85
|
+
kind: z.enum(['manifest', 'zip']),
|
|
86
|
+
id: z.string(),
|
|
87
|
+
name: z.string(),
|
|
88
|
+
version: z.string(),
|
|
89
|
+
games: z.array(z.object({ id: z.string(), title: z.string() })),
|
|
90
|
+
permissions: z.array(PluginPermissionSchema),
|
|
91
|
+
/** the zip's sha256: the install refuses any other */
|
|
92
|
+
sha256: Sha256Schema,
|
|
93
|
+
/** where that hash came from: the manifest, a `.zip.sha256` beside the zip, or only this
|
|
94
|
+
* download */
|
|
95
|
+
checksum: z.enum(['manifest', 'sidecar', 'none']),
|
|
96
|
+
/** the version of this plugin already here, if any */
|
|
97
|
+
replaces: z.object({ version: z.string(), preset: z.boolean() }).nullable(),
|
|
43
98
|
});
|
package/lib/registry.d.ts
CHANGED
|
@@ -1673,87 +1673,6 @@ export declare const HintGraphSchema: z.ZodObject<{
|
|
|
1673
1673
|
}[];
|
|
1674
1674
|
}>;
|
|
1675
1675
|
export type HintGraph = z.infer<typeof HintGraphSchema>;
|
|
1676
|
-
export declare const RegistryIndexSchema: z.ZodObject<{
|
|
1677
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
1678
|
-
games: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1679
|
-
title: z.ZodString;
|
|
1680
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
1681
|
-
manifest: z.ZodString;
|
|
1682
|
-
hints: z.ZodString;
|
|
1683
|
-
nativeBuilds: z.ZodArray<z.ZodObject<{
|
|
1684
|
-
buildId: z.ZodString;
|
|
1685
|
-
region: z.ZodString;
|
|
1686
|
-
platform: z.ZodString;
|
|
1687
|
-
executableHint: z.ZodString;
|
|
1688
|
-
}, "strip", z.ZodTypeAny, {
|
|
1689
|
-
buildId: string;
|
|
1690
|
-
region: string;
|
|
1691
|
-
platform: string;
|
|
1692
|
-
executableHint: string;
|
|
1693
|
-
}, {
|
|
1694
|
-
buildId: string;
|
|
1695
|
-
region: string;
|
|
1696
|
-
platform: string;
|
|
1697
|
-
executableHint: string;
|
|
1698
|
-
}>, "many">;
|
|
1699
|
-
romIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1700
|
-
}, "strip", z.ZodTypeAny, {
|
|
1701
|
-
title: string;
|
|
1702
|
-
hints: string;
|
|
1703
|
-
manifest: string;
|
|
1704
|
-
nativeBuilds: {
|
|
1705
|
-
buildId: string;
|
|
1706
|
-
region: string;
|
|
1707
|
-
platform: string;
|
|
1708
|
-
executableHint: string;
|
|
1709
|
-
}[];
|
|
1710
|
-
subtitle?: string | undefined;
|
|
1711
|
-
romIds?: string[] | undefined;
|
|
1712
|
-
}, {
|
|
1713
|
-
title: string;
|
|
1714
|
-
hints: string;
|
|
1715
|
-
manifest: string;
|
|
1716
|
-
nativeBuilds: {
|
|
1717
|
-
buildId: string;
|
|
1718
|
-
region: string;
|
|
1719
|
-
platform: string;
|
|
1720
|
-
executableHint: string;
|
|
1721
|
-
}[];
|
|
1722
|
-
subtitle?: string | undefined;
|
|
1723
|
-
romIds?: string[] | undefined;
|
|
1724
|
-
}>>;
|
|
1725
|
-
}, "strip", z.ZodTypeAny, {
|
|
1726
|
-
schemaVersion: 1;
|
|
1727
|
-
games: Record<string, {
|
|
1728
|
-
title: string;
|
|
1729
|
-
hints: string;
|
|
1730
|
-
manifest: string;
|
|
1731
|
-
nativeBuilds: {
|
|
1732
|
-
buildId: string;
|
|
1733
|
-
region: string;
|
|
1734
|
-
platform: string;
|
|
1735
|
-
executableHint: string;
|
|
1736
|
-
}[];
|
|
1737
|
-
subtitle?: string | undefined;
|
|
1738
|
-
romIds?: string[] | undefined;
|
|
1739
|
-
}>;
|
|
1740
|
-
}, {
|
|
1741
|
-
schemaVersion: 1;
|
|
1742
|
-
games: Record<string, {
|
|
1743
|
-
title: string;
|
|
1744
|
-
hints: string;
|
|
1745
|
-
manifest: string;
|
|
1746
|
-
nativeBuilds: {
|
|
1747
|
-
buildId: string;
|
|
1748
|
-
region: string;
|
|
1749
|
-
platform: string;
|
|
1750
|
-
executableHint: string;
|
|
1751
|
-
}[];
|
|
1752
|
-
subtitle?: string | undefined;
|
|
1753
|
-
romIds?: string[] | undefined;
|
|
1754
|
-
}>;
|
|
1755
|
-
}>;
|
|
1756
|
-
export type RegistryIndex = z.infer<typeof RegistryIndexSchema>;
|
|
1757
1676
|
/**
|
|
1758
1677
|
* Locations extracted on the player's PC from their own game files (`local-assets/<id>/manifest.json`),
|
|
1759
1678
|
* e.g. Doom maps from the player's WAD. Never committed (data-licensing.md).
|
package/lib/registry.js
CHANGED
|
@@ -119,22 +119,6 @@ export const HintGraphSchema = z.object({
|
|
|
119
119
|
gameId: z.string(),
|
|
120
120
|
hints: z.array(HintNodeSchema),
|
|
121
121
|
});
|
|
122
|
-
export const RegistryIndexSchema = z.object({
|
|
123
|
-
schemaVersion: z.literal(1),
|
|
124
|
-
games: z.record(z.string(), z.object({
|
|
125
|
-
title: z.string(),
|
|
126
|
-
subtitle: z.string().optional(),
|
|
127
|
-
manifest: z.string(),
|
|
128
|
-
hints: z.string(),
|
|
129
|
-
nativeBuilds: z.array(z.object({
|
|
130
|
-
buildId: z.string(),
|
|
131
|
-
region: z.string(),
|
|
132
|
-
platform: z.string(),
|
|
133
|
-
executableHint: z.string(),
|
|
134
|
-
})),
|
|
135
|
-
romIds: z.array(z.string()).optional(),
|
|
136
|
-
})),
|
|
137
|
-
});
|
|
138
122
|
/**
|
|
139
123
|
* Locations extracted on the player's PC from their own game files (`local-assets/<id>/manifest.json`),
|
|
140
124
|
* e.g. Doom maps from the player's WAD. Never committed (data-licensing.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gameslate/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "Build plugins for GameSlate, the second-screen companion for PC games: the plugin contract, game-state and catalogue schemas, and the plugin builder.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/template/README.md
CHANGED
|
@@ -9,3 +9,11 @@ yarn check # typecheck, tests (in the core's own sandbox), build, validate
|
|
|
9
9
|
|
|
10
10
|
`plugin/live.ts` is an example: replace its reads with offsets verified against the game (pin each
|
|
11
11
|
build by its build id), and fill the pack's catalogue (items, missions, collectibles, pins).
|
|
12
|
+
|
|
13
|
+
## Release
|
|
14
|
+
|
|
15
|
+
Bump the version in `package.json` and `plugin/manifest.json`, then push a `vX.Y.Z` tag. The release
|
|
16
|
+
workflow uploads `{{id}}-X.Y.Z.zip`, its `.sha256` and `manifest.json`. Players add the plugin in
|
|
17
|
+
GameSlate's settings (the cog, "Add plugin") with
|
|
18
|
+
`https://github.com/<owner>/gameslate-{{id}}/releases/latest/download/manifest.json`, and GameSlate
|
|
19
|
+
checks that URL for updates.
|
|
@@ -296,7 +296,8 @@ Anything with a place to move through, a track or a board still gets one.
|
|
|
296
296
|
|
|
297
297
|
- `listAssets(inputs, pick)` must be cheap: name what can be built.
|
|
298
298
|
- `buildAsset(id, inputs)` returns outputs in the SDK's shapes: floorplan, location, nav, mesh
|
|
299
|
-
(GS3D), and
|
|
299
|
+
(GS3D), image, and notes (the text of one JSON object, written as `notes/<id>.json` for a
|
|
300
|
+
pack's `localSource`, e.g. `{ file: 'notes/check-notes.json', key: 'collectibleSets.gs' }`).
|
|
300
301
|
|
|
301
302
|
Images have a `purpose` (`atlas`, `map`, `icon`, `actor`, which picks the folder) and an `encoding`:
|
|
302
303
|
|
|
@@ -313,9 +314,41 @@ Every image of a game uses one format. In the sandbox:
|
|
|
313
314
|
- Inputs are named relative to the folder the player picked (`mods/pack.o2r`). The core also hands
|
|
314
315
|
in the game's registry manifest as `registry/manifest.json` when there is one, so renders line up
|
|
315
316
|
with the registry's maps.
|
|
317
|
+
- **Data from the web is a download, never a fetch.** Plugin code has no network and nothing
|
|
318
|
+
runs outside the sandbox (`extract.ts` fails the build). Declare the file in the game's
|
|
319
|
+
manifest entry, `downloads: [{ id, url, sha256 }]` with an exact https URL (a release asset, a
|
|
320
|
+
commit's tarball), and read it as the input `downloads/<id>`. The core fetches it when a build
|
|
321
|
+
starts (at most 64 MB), checks the hash and caches it; the player sees it as a permission, and
|
|
322
|
+
changing the URL or hash asks them again. A tarball is fine to unpack in the sandbox: SoH's
|
|
323
|
+
11 MB `.tar.gz` (97 MB of tar) gunzips with `fflate/browser`'s streaming `Gunzip` in about 10 s.
|
|
324
|
+
Read the input in chunks and keep only the members you need. A plugin with no assets code can't
|
|
325
|
+
declare downloads.
|
|
316
326
|
- **Data licensing:** ship the extractor, never its output. Textures, models and renders are
|
|
317
327
|
built on the player's machine and never committed.
|
|
318
328
|
|
|
329
|
+
### Registry data: what the plugin commits
|
|
330
|
+
|
|
331
|
+
A plugin carries its games' committed map data in `plugin/registry/games/<gameId>/` (sdk 0.3.17):
|
|
332
|
+
`manifest.json` (`GameManifestSchema`), optional `hints.json` (`HintGraphSchema`) and
|
|
333
|
+
`maps/*.svg`, which a layer names as `games/<gameId>/maps/<file>.svg`. The build copies the folder
|
|
334
|
+
into the bundle, and the core serves it at `/registry/games/<gameId>/…`. `gameslate-plugin
|
|
335
|
+
validate` and the core's loader refuse a plugin whose registry carries a game its manifest doesn't
|
|
336
|
+
list, a file outside that layout, a file failing its schema, a layer naming a missing SVG, or an
|
|
337
|
+
SVG with anything but `svg g path polygon polyline rect circle line text title`. Two plugins
|
|
338
|
+
carrying the same game stop the core.
|
|
339
|
+
|
|
340
|
+
Commit only simplified data you produced: schematic SVGs, pins, affines, location and item names,
|
|
341
|
+
your own hint prose. Game text (objective and dialogue strings from the game's language files) is
|
|
342
|
+
the publisher's: generate it on the player's PC with an asset extractor (a local
|
|
343
|
+
`local-assets/<id>/manifest.json` merges over the registry). When you can't tell which side a
|
|
344
|
+
file is on (floorplans traced from the game's collision, spawn positions read from its level
|
|
345
|
+
files), git-ignore `plugin/registry/` with a note saying why, and ask before committing it; tests
|
|
346
|
+
that need it fail loudly on a fresh clone rather than skipping.
|
|
347
|
+
|
|
348
|
+
The build also writes `THIRD_PARTY_LICENSES.txt` (the licence of every npm package the code
|
|
349
|
+
bundles; a package without a licence file fails the build) and copies the repo's
|
|
350
|
+
`THIRD_PARTY_NOTICES.md` into the plugin, so a release carries the notices of what it ships.
|
|
351
|
+
|
|
319
352
|
### Maps from a ROM (Mario Kart 64 in gameslate-n64 is the worked example)
|
|
320
353
|
|
|
321
354
|
1. **Follow the game's own load path** in the decomp: the table that names each level's data
|
|
@@ -328,7 +361,8 @@ Every image of a game uses one format. In the sandbox:
|
|
|
328
361
|
game collides with, apply the same filters (section flags that drop flat or upright triangles,
|
|
329
362
|
vertices flagged "no collision"), keep floors facing up by winding, and colour by surface type.
|
|
330
363
|
Shade by height and draw higher floors later so bridges sit over roads.
|
|
331
|
-
4. **Location ids are asset ids:** lower
|
|
364
|
+
4. **Location ids are asset ids:** lower case, digits, `.`, `_` and `-`, starting with a letter or
|
|
365
|
+
digit (`AssetIdSchema`; its message says "dots and dashes", but `g5_building` is valid). The
|
|
332
366
|
`locationId` the live reader reports must equal them.
|
|
333
367
|
5. **Place the player:** the layer's affine maps world x/z onto the drawing exactly as it was
|
|
334
368
|
drawn. Find the heading convention live: drive straight, then steer one way, and compare the
|
|
@@ -336,13 +370,11 @@ Every image of a game uses one format. In the sandbox:
|
|
|
336
370
|
player back on the unmirrored map.
|
|
337
371
|
6. **Look at it.** Render the SVGs (`rsvg-convert -w 500 map.svg -o map.png`) and compare with
|
|
338
372
|
the game's own minimap.
|
|
339
|
-
7. **A game needs a registry entry** (`
|
|
373
|
+
7. **A game needs a registry entry** (`plugin/registry/games/<id>/manifest.json`: title,
|
|
340
374
|
capabilities with `map_2d`, difficulties, item names; locations empty) before the web app shows
|
|
341
|
-
extracted maps. Doom's is the pattern
|
|
342
|
-
|
|
343
|
-
the
|
|
344
|
-
manifest, keeps any hints, sets the index entry and rehashes channels with the registry
|
|
345
|
-
builders' own writers (gameslate-n64's `tools/registry-specs.ts` writes its specs).
|
|
375
|
+
extracted maps. Doom's (gameslate-idtech1) is the pattern; gameslate-n64's
|
|
376
|
+
`tools/registry-specs.ts` writes its games' entries from the plugin's own data, and a test fails
|
|
377
|
+
when the committed files drift from it. See "Registry data" below.
|
|
346
378
|
8. **No mesh traced? Map what the game itself navigates by.** Wave Race 64's course meshes sit in
|
|
347
379
|
unsplit MIO0 blobs, but its buoy and AI node lists are plain 8-byte records (x, z, type,
|
|
348
380
|
angle) in a raw course file, one list per difficulty: they give the course's shape, the start
|
|
@@ -465,8 +497,30 @@ yarn check
|
|
|
465
497
|
```
|
|
466
498
|
|
|
467
499
|
That's the typecheck, the tests, the build, then `validate dist/<id>`, which checks the built
|
|
468
|
-
plugin exactly as the core will before running it. Then bump `version
|
|
469
|
-
`
|
|
500
|
+
plugin exactly as the core will before running it. Then bump `version` in `package.json` and
|
|
501
|
+
`plugin/manifest.json`, and push a `vX.Y.Z` tag. `.github/workflows/release.yml` runs
|
|
502
|
+
`yarn build --release release`, which writes three files beside each other and uploads them:
|
|
503
|
+
|
|
504
|
+
- `<id>-X.Y.Z.zip`: the built plugin under `<id>/`, made by the build itself, so its hash is known;
|
|
505
|
+
- `<id>-X.Y.Z.zip.sha256`;
|
|
506
|
+
- `manifest.json`: the **published manifest**, the built one plus `bundle: { url, sha256 }`
|
|
507
|
+
naming the zip (by name, resolved against the URL the player gives) and its sha256. Upload it with every release:
|
|
508
|
+
without it, players can't add the plugin by URL or get updates.
|
|
509
|
+
|
|
510
|
+
**How players get it.** In GameSlate's settings (the cog), "Add plugin" takes
|
|
511
|
+
`https://github.com/<owner>/<repo>/releases/latest/download/manifest.json`. The core shows the
|
|
512
|
+
plugin's games and permissions, then downloads the zip, refuses it unless its sha256 matches, checks
|
|
513
|
+
the zip's own manifest is the published one, and unpacks it. It re-reads that URL about hourly: a
|
|
514
|
+
newer version that asks for **no new permissions** installs itself (once none of its games is
|
|
515
|
+
running); one that asks for more (a new game's memory, a new folder) waits for the player to
|
|
516
|
+
confirm. A manifest naming an `extract` module (code outside the sandbox, removed in sdk 0.3.19)
|
|
517
|
+
fails the schema everywhere, presets included (docs/plugin-architecture.md, "Closing the
|
|
518
|
+
sandbox"). So adding a game, a folder or a download in a release
|
|
519
|
+
means every player is asked again: say why in the release notes. A plain zip URL works too
|
|
520
|
+
(validated the same way, its `.zip.sha256` used when present), but gets no updates.
|
|
521
|
+
|
|
522
|
+
GameSlate also builds a few plugins in as presets, from `plugins.lock.json` (the release URL and the
|
|
523
|
+
zip's sha256).
|
|
470
524
|
|
|
471
525
|
## Pitfalls seen in real plugins
|
|
472
526
|
|
|
@@ -474,6 +528,12 @@ plugin exactly as the core will before running it. Then bump `version`, tag `vX.
|
|
|
474
528
|
game could repeat, add it here (in `@gameslate/sdk`'s `template/claude/skills`, then copy it into
|
|
475
529
|
the plugin repos) in the same change as the fix. The next game should not have to find it again.
|
|
476
530
|
|
|
531
|
+
- **Write JSON whose key order matters as text, not as an object.** JavaScript objects list
|
|
532
|
+
number-like keys (`"3"`, `"12"`) first and in ascending order, whatever order they were added
|
|
533
|
+
in, so `JSON.stringify`, `JSON.parse` and every trip across the sandbox boundary reorder them.
|
|
534
|
+
SoH's check notes key chests and Gold Skulltulas by flag in Python's insertion order: they're
|
|
535
|
+
built as `Map`s and serialised by hand, then returned as a `notes` output's `json` text, which
|
|
536
|
+
the core writes unchanged (2026-12-05).
|
|
477
537
|
- **Run the support check in `check` once the repo has a support table.** Add `"support":
|
|
478
538
|
"gameslate-plugin support plugin --built dist/<id>"` and `&& yarn support` to `check`. Without
|
|
479
539
|
it, gameslate-n64's README frontmatter said Harvest Moon 64 had no missions for a release after
|
|
@@ -849,3 +909,118 @@ the plugin repos) in the same change as the fix. The next game should not have t
|
|
|
849
909
|
to the cache (2026-12-05).
|
|
850
910
|
- **Env-var names for ROM-gated tests are per game:** `BH_ROM` was taken by Body Harvest when
|
|
851
911
|
Bomberman Hero needed one (2026-12-05).
|
|
912
|
+
- **A mutation never uses an empty replacement.** Reverting it matches the empty string at offset
|
|
913
|
+
0 and corrupts the file. Replace with a comment, and byte-compare with a backup afterwards
|
|
914
|
+
(2026-12-05).
|
|
915
|
+
- **After an sdk publish, npm lags several minutes.** `yarn up` says "No candidates found" until
|
|
916
|
+
`yarn cache clean --mirror`, even once npm serves it. Write the range as `^X.Y.Z`: `yarn up
|
|
917
|
+
pkg@X.Y.Z` pins exactly (2026-12-05).
|
|
918
|
+
- **A check names the statuses it means**, not `!== 'open'`: sdk 0.3.15 refused `puzzle_panel`
|
|
919
|
+
maps that way (2026-12-05).
|
|
920
|
+
- **Keep game text out of committed tables.** A builder that copies objective labels from the
|
|
921
|
+
game's language files into a committed table or manifest commits the publisher's text. Commit
|
|
922
|
+
ids only ("Objective 1", or the bank and entry number), and join the real labels by id from a
|
|
923
|
+
file on the player's PC or an asset extractor. Then grep your hint prose for quoted game strings:
|
|
924
|
+
Perfect Dark's hints quoted an objective verbatim, and MM's objective labels carried the boss
|
|
925
|
+
title cards (2026-12-05).
|
|
926
|
+
- **A floorplan drawing is not an SVG.** It has no text, no fill opacity, and fills and strokes are
|
|
927
|
+
separate layers (every stroke above every fill). Porting a hand-written SVG drops its title,
|
|
928
|
+
needs a group's opacity blended into the fill colour by hand, and shows outlines a later fill
|
|
929
|
+
used to cover. Check the port against the old output by geometry (each polygon's points), not
|
|
930
|
+
by bytes (TS2, 2026-12-05).
|
|
931
|
+
- **A local location replaces the registry's fields one level deep** (`{ ...registry, ...local }`),
|
|
932
|
+
and `name` is required. Leave `objectives` out of it to keep the registry's numbered ones; send
|
|
933
|
+
them only with the real labels and every difficulty rule (TS2, 2026-12-05).
|
|
934
|
+
- **Read archives by range, and know inputs by their contents.** A pak's names and directory may
|
|
935
|
+
sit at its end (TS2's P8CK): read the header and that tail, then only the entries you build
|
|
936
|
+
from, so `listAssets` stays cheap on a 20 MB pak. Match a file by its magic and the entries it
|
|
937
|
+
holds, not by the name a dump tool gave it (`_gs_tmp_l_20_ST.pak` is `l_20_ST.pak`) (2026-12-05).
|
|
938
|
+
- **Files the game ships encrypted can't be inputs.** Homefront keeps TS2's level paks inside an
|
|
939
|
+
encrypted `lsao_cached.pak`, so the extractor takes paks the player has extracted, and its
|
|
940
|
+
"nothing found" note and the README say where they come from (2026-12-05).
|
|
941
|
+
- **Objective text may live in the executable, not the level files.** TS2's Story paks hold no
|
|
942
|
+
strings; the labels are in `TimeSplitters2.exe`'s `.data` string table. Search the exe too
|
|
943
|
+
before reporting the text missing (2026-12-05).
|
|
944
|
+
- **Expected pixels in tests follow the port's rounding.** A Python-faithful port rounds half to
|
|
945
|
+
even (401.25 → 401.2): write the expected numbers out rather than computing them with
|
|
946
|
+
`Math.round` (2026-12-05).
|
|
947
|
+
- **Run a mutation's test green first.** A test that already fails "kills" every mutant: a TS2
|
|
948
|
+
test asserting the wrong note passed a mutation run until the full check caught it (2026-12-05).
|
|
949
|
+
- **An extractor is only offered from `plugin/assets.ts`.** The build looks for that file (default
|
|
950
|
+
export: `{ id, extractors: new Map([[gameId, factory]]) }`); a game's `assets.ts` elsewhere is
|
|
951
|
+
never bundled, and `validate` prints `assets: none`. Perfect Dark's objective-text extractor sat
|
|
952
|
+
unoffered for a release, blamed on underscores in its ids, which were valid (2026-12-05).
|
|
953
|
+
- **Read a level's setup from the ROM's binary, not the decomp's C text.** Text heuristics drift
|
|
954
|
+
from what the game does: Perfect Dark's `tag(id, n)` names the prop `n` commands on from the tag
|
|
955
|
+
(`setup.c`), not the next `PAD_` within a few lines, which put 563 tags on the wrong pad, and
|
|
956
|
+
text skips `#if VERSION` blocks (an Escape guard that exists only before NTSC 1.0) and literal
|
|
957
|
+
ids. Size each command from the engine's own length table, check the result against the C text
|
|
958
|
+
on every stage once, and explain each difference (2026-12-05).
|
|
959
|
+
- **Generate opcode tables from the engine, not the macros.** Perfect Dark's `g_CommandLengths`
|
|
960
|
+
has `#if VERSION` entries and a ternary, and four `commands.h` macros disagree with it in size;
|
|
961
|
+
the engine's length wins, the macro gives only operand roles, and a variable-length command
|
|
962
|
+
(`print`, 0x00b5) is sized by scanning to its terminator. Fail loud on an unknown opcode rather
|
|
963
|
+
than guessing a length (2026-12-05).
|
|
964
|
+
- **One background can serve several stages, under another stage's code.** Mr. Blonde's Revenge
|
|
965
|
+
uses Defection's `ame` pads under setup code `wax`: name pads by number from the file the stage
|
|
966
|
+
loads, not by the setup's `PAD_WAX_…` names (the old text builder lost its spawn) (2026-12-05).
|
|
967
|
+
- **Check hint facts against a walkthrough, and test hints for quoted labels.** Generated hint prose
|
|
968
|
+
invents plausible detail: TS2's Siberia hints had the filing cabinets burnt by shooting "red fuel
|
|
969
|
+
drums" in "four rooms", where the game has five cabinets you open and burn with timed mines,
|
|
970
|
+
and a dish "console" where you stick a mine on the dish. Write each fact from a walkthrough
|
|
971
|
+
(a GameFAQs FAQ, often mirrored as PDFs on video-games-museum.com; the Wayback Machine serves
|
|
972
|
+
pages that refuse fetches; StrategyWiki answers 403), in your own words, and name it in the
|
|
973
|
+
commit. Add a test, gated on the local labels file, that fails when a hint holds a label whole,
|
|
974
|
+
a quoted multi-word piece of one, or a five-word run of one; pin its matcher on made-up labels
|
|
975
|
+
so it runs everywhere (TS2, 2026-12-05).
|
|
976
|
+
- **Fact-check every level's hints, not only the one caught.** The other nine TS2 levels were
|
|
977
|
+
invented the same way: a getaway car behind the club (it comes down the street early on), a
|
|
978
|
+
Jacque who drops the crystal (it sits on the altar), a "police precinct" upload (it's a
|
|
979
|
+
computer inside the lab), fire against Stone Golems (trapdoors and grenades). Walkthroughs
|
|
980
|
+
split by difficulty (bomb, poster and golem counts, where the crystal is), so say which
|
|
981
|
+
difficulty a fact holds for, or leave the number out. Drop `obj_N` ids from hint text: the
|
|
982
|
+
player never sees them. Then compare the hints with the walkthrough texts and reword any run
|
|
983
|
+
of six or more words they share; keep the texts in a scratch folder, never in the repo
|
|
984
|
+
(TS2, 2026-12-05). Not in a worktree either: name the sources in the commit message only.
|
|
985
|
+
`plugin/tracked-documents.test.ts` fails on a tracked PDF, HTML, Word, RTF, EPUB or TXT file
|
|
986
|
+
outside licences and `fixtures/` (data-licensing rule, 2026-12-05).
|
|
987
|
+
- **Pins need fact-checking as much as hints.** Seventeen TS2 pin labels named places the level
|
|
988
|
+
doesn't have: a "Dish Control Room" anchored on an oil drum, a "turret" that was a console.
|
|
989
|
+
Label a pin after what its anchor actually is, the model or object type of its setup entry
|
|
990
|
+
(`damfilecabinet`), not after the objective it helps with. A point called a "portal" or an
|
|
991
|
+
"exit" may be the player's start position, so check it. A pin whose object appears only on
|
|
992
|
+
some difficulties gets `hiddenWhen`, built from the setup entry's per-difficulty flags
|
|
993
|
+
(TS2, 2026-12-05).
|
|
994
|
+
- **Invented hints name the wrong tool, place and method.** Perfect Dark's hints were wrong on
|
|
995
|
+
almost every mission: a Data Uplink on cleaning robots (two consoles start them), Mining
|
|
996
|
+
Explosives on a hangar door (a technician's key card), a security "booth" with biometrics, a
|
|
997
|
+
saucer-hangar medpack, made-up `X=…, Z=…` coordinates. Never put coordinates or button names
|
|
998
|
+
in hint prose unless the plugin's own data supplies them. A game's briefings are often in its
|
|
999
|
+
language banks; the decomp's extracted text lets you check them locally, but cite a public
|
|
1000
|
+
copy (the LP Archive shows PD's). When no walkthrough covers a level (PD's Pelagic II), write
|
|
1001
|
+
only what the briefing says and keep it vague. Run the run-comparison after every rewrite:
|
|
1002
|
+
writing from a walkthrough copies its phrases (PD's first rewrite shared 41 six-word runs with
|
|
1003
|
+
its sources, against 6 before). Where an extractor already reads the labels from the player's
|
|
1004
|
+
file, the quoted-label test can call it directly, gated on the input's env var (PD, 2026-12-05).
|
|
1005
|
+
- **Build every published pin from the inputs; don't carry old ones forward.** The Zelda builder
|
|
1006
|
+
copied 201 MM exits, grottos and Pieces of Heart from the previous manifest because nothing
|
|
1007
|
+
made them; once the maps moved into the extractor there was no previous manifest. Each came
|
|
1008
|
+
from the scene: a collision polygon's surface names an exit index into the scene's exit list
|
|
1009
|
+
(the entrance there names the destination), and a collectible actor's params name a Piece of
|
|
1010
|
+
Heart. Compare the rebuild with the published pins by id, label and position, and explain each
|
|
1011
|
+
one you can't derive (one was placed by hand on a moving platform) (2026-12-05).
|
|
1012
|
+
- **Collision has no rooms.** Sort a floor into a room by where the room's own meshes are: the
|
|
1013
|
+
smallest room whose drawn extent holds the floor's centre, else the nearest. A floor under a
|
|
1014
|
+
water box isn't water when the box is a puddle a unit deep; count it as submerged only below
|
|
1015
|
+
wading depth (Zelda, 2026-12-05).
|
|
1016
|
+
- **Frame each pin on a layer that shows it.** Grottos are separate layers, each framed on its own
|
|
1017
|
+
room; an exit placed by height alone landed on another grotto's frame, thousands of pixels off
|
|
1018
|
+
screen. Pick among the layers whose frame holds the pin, then by height (Zelda, 2026-12-05).
|
|
1019
|
+
- **`describe.skipIf` still runs the describe body.** Work done there (opening the gated input)
|
|
1020
|
+
throws on a fresh clone before the skip applies. Build gated data lazily inside the tests.
|
|
1021
|
+
- **Round as the published data did.** Means of integer corners land exactly on .x5; JavaScript's
|
|
1022
|
+
`Math.round` goes up where Python's `round` goes to even, and 4 of 189 exit pins moved by 0.1.
|
|
1023
|
+
- **When a hint correction disagrees with the game's code, the code wins.** A reviewer said MM's
|
|
1024
|
+
barn defence starts at 2 AM; the invasion actor runs from `CLOCK_TIME(2, 30)`. Check timings and
|
|
1025
|
+
rewards in the decomp (the Oceanside Spider House's wallet is chosen by the day it's paid out),
|
|
1026
|
+
then name a walkthrough that agrees (2026-12-05).
|
|
@@ -256,9 +256,10 @@ Inventory, Missions and Ref in turn) or `{ "url": …, "tabs": ["Inventory"] }`.
|
|
|
256
256
|
counters, the item lit in a grid, the mission list, the map's arrow against the game's minimap.
|
|
257
257
|
A local daemon's token is in its config:
|
|
258
258
|
`export GAMESLATE_TOKEN=$(node -p "require('$HOME/.config/gameslate/config.json').pairingToken")`
|
|
259
|
-
(don't paste it anywhere else). To see extracted maps, run the daemon with `GAMESLATE_LOCAL_ASSETS_DIR
|
|
260
|
-
|
|
261
|
-
"Couldn't load this game's map data from the registry" means the
|
|
259
|
+
(don't paste it anywhere else). To see extracted maps, run the daemon with `GAMESLATE_LOCAL_ASSETS_DIR`; a registry entry
|
|
260
|
+
not deployed yet comes with the plugin build (`GAMESLATE_PLUGINS_DIR` pointing at your `dist/`).
|
|
261
|
+
"Couldn't load this game's map data from the registry" means the plugin carries no
|
|
262
|
+
`registry/games/<id>/manifest.json` for the game.
|
|
262
263
|
|
|
263
264
|
For values the route doesn't show, drive to them: Luigi Raceway's first row of item boxes is on
|
|
264
265
|
the start straight, so holding A long enough fetches an item to check the held-item read.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Tag vX.Y.Z (matching package.json and plugin/manifest.json) to publish the built plugin. The
|
|
4
|
+
# release carries {{id}}-X.Y.Z.zip, its .sha256 and manifest.json, the published manifest naming
|
|
5
|
+
# the zip and its sha256. Players add the plugin in GameSlate's settings by this URL, and their
|
|
6
|
+
# GameSlate checks it for updates:
|
|
7
|
+
# https://github.com/<owner>/<repo>/releases/latest/download/manifest.json
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ['v*']
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
release:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: 22
|
|
23
|
+
- run: corepack enable
|
|
24
|
+
- run: yarn install
|
|
25
|
+
- run: yarn typecheck && yarn test
|
|
26
|
+
- name: Check the tag matches the plugin's version
|
|
27
|
+
run: |
|
|
28
|
+
v="${GITHUB_REF_NAME#v}"
|
|
29
|
+
test "$(node -p "require('./plugin/manifest.json').version")" = "$v"
|
|
30
|
+
test "$(node -p "require('./package.json').version")" = "$v"
|
|
31
|
+
- run: yarn build --release release && yarn validate
|
|
32
|
+
- name: Publish the release
|
|
33
|
+
env:
|
|
34
|
+
GH_TOKEN: ${{ github.token }}
|
|
35
|
+
run: >-
|
|
36
|
+
gh release create "$GITHUB_REF_NAME"
|
|
37
|
+
release/{{id}}-*.zip release/{{id}}-*.zip.sha256 release/manifest.json
|
|
38
|
+
--title "{{id}} $GITHUB_REF_NAME" --generate-notes
|
package/template/gitignore
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* No walkthroughs, FAQs or briefings in the repo (.claude/rules/data-licensing.md): they are other
|
|
6
|
+
* people's text, read for fact-checking and kept in a scratch folder. This fails on any tracked
|
|
7
|
+
* document-type file outside a short allowlist.
|
|
8
|
+
*
|
|
9
|
+
* The same file is the core's `tests/tracked-documents.test.ts` and the plugin template's
|
|
10
|
+
* `plugin/tracked-documents.test.ts`; the template test fails when they differ.
|
|
11
|
+
*/
|
|
12
|
+
const DOCUMENT = /\.(pdf|html?|docx?|rtf|epub|txt)$/i;
|
|
13
|
+
const ALLOWED: RegExp[] = [
|
|
14
|
+
/* the core web app's entry page */
|
|
15
|
+
/^packages\/web\/index\.html$/,
|
|
16
|
+
/* licence and notice texts, which must travel with what they cover */
|
|
17
|
+
/(^|\/)(LICENSE|COPYING|THIRD_PARTY)[^/]*\.txt$/i,
|
|
18
|
+
/(^|\/)OFL\.txt$/,
|
|
19
|
+
/* golden test fixtures (a parser's expected text output) */
|
|
20
|
+
/(^|\/)fixtures\/.*\.txt$/,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
/** Tracked paths that look like a document someone else wrote. */
|
|
24
|
+
export function findDocuments(paths: string[]): string[] {
|
|
25
|
+
return paths.filter(p => DOCUMENT.test(p) && !ALLOWED.some(allowed => allowed.test(p)));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function trackedPaths(): string[] {
|
|
29
|
+
const root = execFileSync('git', ['rev-parse', '--show-toplevel'], {
|
|
30
|
+
cwd: import.meta.dirname,
|
|
31
|
+
encoding: 'utf8',
|
|
32
|
+
}).trim();
|
|
33
|
+
return execFileSync('git', ['ls-files', '-z'], { cwd: root, encoding: 'utf8' })
|
|
34
|
+
.split('\0')
|
|
35
|
+
.filter(Boolean);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe('tracked documents', () => {
|
|
39
|
+
it('the allowlist spares licences, fixtures and the web entry page, and nothing else', () => {
|
|
40
|
+
expect(
|
|
41
|
+
findDocuments([
|
|
42
|
+
'packages/web/index.html',
|
|
43
|
+
'LICENSE.txt',
|
|
44
|
+
'tools/fixtures/doom/COPYING-freedoom.txt',
|
|
45
|
+
'packages/web/public/fonts/OFL.txt',
|
|
46
|
+
'dist/THIRD_PARTY_LICENSES.txt',
|
|
47
|
+
'plugin/soh/fixtures/tiny/check-notes.golden.txt',
|
|
48
|
+
'plugin/live.ts',
|
|
49
|
+
'README.md',
|
|
50
|
+
]),
|
|
51
|
+
).toEqual([]);
|
|
52
|
+
expect(
|
|
53
|
+
findDocuments([
|
|
54
|
+
'x.pdf',
|
|
55
|
+
'docs/guide.txt',
|
|
56
|
+
'plugin/ts2/siberia-faq.TXT',
|
|
57
|
+
'scratch/bellaonline.htm',
|
|
58
|
+
'plugin/index.html',
|
|
59
|
+
'briefing.docx',
|
|
60
|
+
'notes.rtf',
|
|
61
|
+
'book.epub',
|
|
62
|
+
]),
|
|
63
|
+
).toHaveLength(8);
|
|
64
|
+
});
|
|
65
|
+
it('no walkthrough, FAQ or briefing is tracked', () => {
|
|
66
|
+
expect(findDocuments(trackedPaths())).toEqual([]);
|
|
67
|
+
});
|
|
68
|
+
});
|