@bitmagic/cli 0.1.59-dev.1 → 0.1.59-dev.2
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/dist/verify/classify.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EARLY_WINDOW_SECONDS } from './events.js';
|
|
2
|
+
import { parseHudThemeProblem } from './hud-theme.js';
|
|
2
3
|
/**
|
|
3
4
|
* Both event thresholds warn rather than fail, deliberately: verify provides no gameplay input,
|
|
4
5
|
* so only events that fire SPONTANEOUSLY are defensible signals, and even those need real-world
|
|
@@ -168,6 +169,24 @@ export function classifyVerifyRun(observations, context = {}) {
|
|
|
168
169
|
+ 'the WebGPU path may or may not have been exercised.');
|
|
169
170
|
}
|
|
170
171
|
}
|
|
172
|
+
// A `hud.theme` the engine could not resolve. It never blocks a load — it warns once and renders
|
|
173
|
+
// the DEFAULT look — so the game runs, the screenshot is fine, and the only symptom is that the
|
|
174
|
+
// theme the author asked for never appeared. A warning rather than a failure: the game is
|
|
175
|
+
// playable and shippable, it is just not wearing the look it was told to wear.
|
|
176
|
+
//
|
|
177
|
+
// Parsed straight from `consoleLines`, which every caller already provides, so this needs no new
|
|
178
|
+
// observation and is inert wherever the line is absent — including `bitmagic publish`'s smoke
|
|
179
|
+
// run, which calls this function with observations only.
|
|
180
|
+
const themeProblem = parseHudThemeProblem(observations.consoleLines);
|
|
181
|
+
if (themeProblem) {
|
|
182
|
+
warnings.push(themeProblem.kind === 'preset'
|
|
183
|
+
? `The HUD theme did not apply — the game rendered the engine's default look instead. ${themeProblem.detail} `
|
|
184
|
+
+ 'Fix the `hud.theme` value in world.json; preset names are hyphenated (`rift-raider`, `village-keep`), '
|
|
185
|
+
+ 'and the style keys you find in engine source are not valid theme values.'
|
|
186
|
+
: `The HUD theme did not apply — the game rendered the engine's default look instead. ${themeProblem.detail} `
|
|
187
|
+
+ 'Fix the named fields in `hud.theme` in world.json; see engine/agent-docs/HUD_THEMES.md '
|
|
188
|
+
+ 'for the token vocabulary, or set a preset name instead of an inline theme.');
|
|
189
|
+
}
|
|
171
190
|
// The engine's own mobile-parity check, which it runs at every game start and which nothing
|
|
172
191
|
// read until now. Null means it reported no gap — a clean game, an older engine, or a genre
|
|
173
192
|
// whose controller has no parity check (the 2D genres) — and "not observed" is never a failure.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/verify/classify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA0B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/verify/classify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA0B,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AA2KtD;;;;;;;GAOG;AACH,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAEjC,uFAAuF;AACvF,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC,0DAA0D;AAC1D,MAAM,aAAa,GAAG;IACpB,sBAAsB;IACtB,sBAAsB;IACtB,wCAAwC;IACxC,iCAAiC;IACjC,4FAA4F;IAC5F,yFAAyF;IACzF,8FAA8F;IAC9F,0EAA0E;IAC1E,4FAA4F;IAC5F,oDAAoD;CACrD,CAAC;AAEF;mFACmF;AACnF,MAAM,gBAAgB,GAAG,CAAC,mBAAmB,EAAE,wBAAwB,CAAC,CAAC;AAEzE;iDACiD;AACjD,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC,oDAAoD;AACpD,MAAM,uBAAuB,GAAG,IAAI,GAAG,GAAG,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,SAAS,kBAAkB,CAAC,QAAuD;IACjF,IAAI,QAAQ,K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AE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the engine's HUD-theme verdict out of the console verify already captures.
|
|
3
|
+
*
|
|
4
|
+
* A bad `hud.theme` in world.json is one of the quietest failures a project can carry. The engine
|
|
5
|
+
* never throws over it — `resolveWorldTheme` deliberately treats a broken theme as recoverable and
|
|
6
|
+
* a blocked game load as not — so it logs one warning and renders the DEFAULT look. The game runs,
|
|
7
|
+
* the screenshot is fine, verify passes, and the only symptom is that the theme the author asked
|
|
8
|
+
* for never appeared. That reads as "theming is broken" rather than "the name was misspelled", and
|
|
9
|
+
* it survives for as long as nobody diffs the intended look against the shipped one.
|
|
10
|
+
*
|
|
11
|
+
* The hosted agent is protected from this by `write-hud-theme`, which validates before it writes
|
|
12
|
+
* and answers with a closest-match suggestion. A CLI project has no such tool: the theme is a hand
|
|
13
|
+
* edit to a JSON file, so this is the lane where the mistake actually happens and the lane with no
|
|
14
|
+
* check — until this one.
|
|
15
|
+
*
|
|
16
|
+
* WHY PARSE THE CONSOLE rather than validate statically here. The obvious alternative is to read
|
|
17
|
+
* world.json and check it against the engine's own validator, and it is not available: the vendored
|
|
18
|
+
* engine emits with its path-mapped specifiers intact (`from 'engine/hud/ThemeTokens.js'`), which
|
|
19
|
+
* resolve only through the browser import map, so `validateAndResolveTheme` cannot be imported from
|
|
20
|
+
* Node. The remaining static option is a hand-mirrored preset list in the CLI, i.e. a third copy of
|
|
21
|
+
* the same list to keep in sync. Parsing what the engine already said costs no mirror, cannot drift,
|
|
22
|
+
* and inherits the engine's own error text — including the field paths from an invalid inline theme
|
|
23
|
+
* and the live list of known presets, neither of which a mirror would have.
|
|
24
|
+
*
|
|
25
|
+
* The cost is honest and worth naming: this only sees a theme on a game that actually booted. A
|
|
26
|
+
* project whose game fails to load has bigger findings in the same run.
|
|
27
|
+
*/
|
|
28
|
+
/** The engine's marker on every theme-resolution warning. Also what a reader greps for. */
|
|
29
|
+
export declare const HUD_THEME_MARKER = "[HUD]";
|
|
30
|
+
export interface HudThemeProblem {
|
|
31
|
+
/**
|
|
32
|
+
* `preset` — the name matched nothing, so the game silently rendered the default.
|
|
33
|
+
* `custom` — an inline theme was structurally invalid and was dropped whole.
|
|
34
|
+
*/
|
|
35
|
+
kind: 'preset' | 'custom';
|
|
36
|
+
/**
|
|
37
|
+
* The engine's own sentence, minus the marker. Carries the detail a re-implementation here
|
|
38
|
+
* would have had to invent: the offending name and the live preset list, or the failing field
|
|
39
|
+
* paths.
|
|
40
|
+
*/
|
|
41
|
+
detail: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The theme problem the engine reported during this run, or null when it reported none.
|
|
45
|
+
*
|
|
46
|
+
* Null is "not observed" and never a failure. Three legitimate ways to get it: the theme resolved
|
|
47
|
+
* cleanly, the project sets no theme at all, or the engine predates the warning.
|
|
48
|
+
*
|
|
49
|
+
* The LAST matching line wins, for the same reason it does in the mobile-parity reader: a run that
|
|
50
|
+
* starts gameplay more than once logs the check once per start, and the newest verdict describes
|
|
51
|
+
* the game as it ended up.
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseHudThemeProblem(consoleLines: string[]): HudThemeProblem | null;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the engine's HUD-theme verdict out of the console verify already captures.
|
|
3
|
+
*
|
|
4
|
+
* A bad `hud.theme` in world.json is one of the quietest failures a project can carry. The engine
|
|
5
|
+
* never throws over it — `resolveWorldTheme` deliberately treats a broken theme as recoverable and
|
|
6
|
+
* a blocked game load as not — so it logs one warning and renders the DEFAULT look. The game runs,
|
|
7
|
+
* the screenshot is fine, verify passes, and the only symptom is that the theme the author asked
|
|
8
|
+
* for never appeared. That reads as "theming is broken" rather than "the name was misspelled", and
|
|
9
|
+
* it survives for as long as nobody diffs the intended look against the shipped one.
|
|
10
|
+
*
|
|
11
|
+
* The hosted agent is protected from this by `write-hud-theme`, which validates before it writes
|
|
12
|
+
* and answers with a closest-match suggestion. A CLI project has no such tool: the theme is a hand
|
|
13
|
+
* edit to a JSON file, so this is the lane where the mistake actually happens and the lane with no
|
|
14
|
+
* check — until this one.
|
|
15
|
+
*
|
|
16
|
+
* WHY PARSE THE CONSOLE rather than validate statically here. The obvious alternative is to read
|
|
17
|
+
* world.json and check it against the engine's own validator, and it is not available: the vendored
|
|
18
|
+
* engine emits with its path-mapped specifiers intact (`from 'engine/hud/ThemeTokens.js'`), which
|
|
19
|
+
* resolve only through the browser import map, so `validateAndResolveTheme` cannot be imported from
|
|
20
|
+
* Node. The remaining static option is a hand-mirrored preset list in the CLI, i.e. a third copy of
|
|
21
|
+
* the same list to keep in sync. Parsing what the engine already said costs no mirror, cannot drift,
|
|
22
|
+
* and inherits the engine's own error text — including the field paths from an invalid inline theme
|
|
23
|
+
* and the live list of known presets, neither of which a mirror would have.
|
|
24
|
+
*
|
|
25
|
+
* The cost is honest and worth naming: this only sees a theme on a game that actually booted. A
|
|
26
|
+
* project whose game fails to load has bigger findings in the same run.
|
|
27
|
+
*/
|
|
28
|
+
/** The engine's marker on every theme-resolution warning. Also what a reader greps for. */
|
|
29
|
+
export const HUD_THEME_MARKER = '[HUD]';
|
|
30
|
+
/** `resolveWorldTheme`'s wording when `hud.theme` is a string that names no preset. */
|
|
31
|
+
const UNKNOWN_PRESET = 'Unknown theme preset';
|
|
32
|
+
/** …and when it is an object the validator rejected. */
|
|
33
|
+
const INVALID_THEME = 'Custom theme failed validation';
|
|
34
|
+
/**
|
|
35
|
+
* The theme problem the engine reported during this run, or null when it reported none.
|
|
36
|
+
*
|
|
37
|
+
* Null is "not observed" and never a failure. Three legitimate ways to get it: the theme resolved
|
|
38
|
+
* cleanly, the project sets no theme at all, or the engine predates the warning.
|
|
39
|
+
*
|
|
40
|
+
* The LAST matching line wins, for the same reason it does in the mobile-parity reader: a run that
|
|
41
|
+
* starts gameplay more than once logs the check once per start, and the newest verdict describes
|
|
42
|
+
* the game as it ended up.
|
|
43
|
+
*/
|
|
44
|
+
export function parseHudThemeProblem(consoleLines) {
|
|
45
|
+
for (let i = consoleLines.length - 1; i >= 0; i--) {
|
|
46
|
+
const problem = parseLine(consoleLines[i]);
|
|
47
|
+
if (problem !== null)
|
|
48
|
+
return problem;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function parseLine(line) {
|
|
53
|
+
const marker = line.indexOf(HUD_THEME_MARKER);
|
|
54
|
+
if (marker === -1)
|
|
55
|
+
return null;
|
|
56
|
+
// Everything after the marker, with the console-type prefix (`warning: `) dropped.
|
|
57
|
+
const detail = line.slice(marker + HUD_THEME_MARKER.length).trim();
|
|
58
|
+
if (detail.length === 0)
|
|
59
|
+
return null;
|
|
60
|
+
if (detail.includes(UNKNOWN_PRESET))
|
|
61
|
+
return { kind: 'preset', detail };
|
|
62
|
+
if (detail.includes(INVALID_THEME))
|
|
63
|
+
return { kind: 'custom', detail };
|
|
64
|
+
// Other `[HUD]` lines exist (a theme that resolved but carried warnings, for one). Those are
|
|
65
|
+
// not this check's business, and claiming them would turn a working theme into a finding.
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=hud-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hud-theme.js","sourceRoot":"","sources":["../../src/verify/hud-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC,uFAAuF;AACvF,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C,wDAAwD;AACxD,MAAM,aAAa,GAAG,gCAAgC,CAAC;AAgBvD;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,YAAsB;IACzD,KAAK,IAAI,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAClD,MAAM,OAAO,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO,OAAO,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9C,IAAI,MAAM,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAE/B,mFAAmF;IACnF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACnE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACvE,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAEtE,6FAA6F;IAC7F,0FAA0F;IAC1F,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitmagic/cli",
|
|
3
|
-
"version": "0.1.59-dev.
|
|
3
|
+
"version": "0.1.59-dev.2",
|
|
4
4
|
"description": "Build Bitmagic games from your own agent tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Bitmagic Oy",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"fflate": "^0.8.2",
|
|
24
24
|
"playwright-core": "^1.59.1",
|
|
25
25
|
"tar": "^7.4.3",
|
|
26
|
-
"@bitmagic/animation-forger": "0.1.14-dev.
|
|
27
|
-
"@bitmagic/
|
|
28
|
-
"@bitmagic/
|
|
26
|
+
"@bitmagic/animation-forger": "0.1.14-dev.2",
|
|
27
|
+
"@bitmagic/asset-core": "0.2.14-dev.2",
|
|
28
|
+
"@bitmagic/world-forger": "0.1.19-dev.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@eslint/js": "^9.38.0",
|