feat(web): classify and route complete Blender inventory
This commit is contained in:
16
tools/web/check-web-engine-command-registry.mjs
Normal file
16
tools/web/check-web-engine-command-registry.mjs
Normal file
@@ -0,0 +1,16 @@
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
|
||||
const protocol = fs.readFileSync(new URL("../../web/protocol/web-engine.ts", import.meta.url), "utf8");
|
||||
const registry = fs.readFileSync(new URL("../../web/protocol/web-engine-capabilities.ts", import.meta.url), "utf8");
|
||||
const commandUnion = protocol.split("export type WebEngineEditCommand =", 2)[1]?.split("/** JSON values", 1)[0] ?? "";
|
||||
const commands = new Set([...commandUnion.matchAll(/type:\s*"([A-Za-z0-9]+)"/gu)].map((match) => match[1]));
|
||||
commands.add("moveNLAStrip");
|
||||
const registered = new Set([...registry.matchAll(/^ ([A-Za-z0-9]+): \{/gmu)].map((match) => match[1]));
|
||||
registered.delete("listBlenderOperators");
|
||||
registered.delete("invokeBlenderOperator");
|
||||
const missing = [...commands].filter((command) => !registered.has(command)).sort();
|
||||
const stale = [...registered].filter((command) => !commands.has(command)).sort();
|
||||
assert.deepEqual(missing, [], `WebEngine edit commands missing capabilities: ${missing.join(",")}`);
|
||||
assert.deepEqual(stale, [], `WebEngine capabilities without edit commands: ${stale.join(",")}`);
|
||||
process.stdout.write(`web-engine-command-registry-ok commands=${commands.size}\n`);
|
||||
Reference in New Issue
Block a user