import * as e from './common.mjs'; export function main(){ const a=e.cli(['dump', 'output'], { source:e.ROOT }), root=e.path.resolve(a.source), protocol=e.path.join(root, 'protocol/src/root.zig'), handlers=e.path.join(root, 'gameserver/src/handlers.zig'), service=e.path.join(root, 'gameserver/src/services/grid_fight.zig'), en=e.readText(protocol), bindings=e.readText(handlers), requests=[...new Set(e.matches(en, /\bCmdGridFight\w+(?:CsReq|Req)\b/g).map(m=>m[0]))].sort(), registered=Object.fromEntries(e.matches(bindings, /\.\{\s*CmdID\.(CmdGridFight\w+),\s*([\w.]+)\s*}/g).map(m=>[m[1], m[2]])), dummy=(bindings.split('const DummyCmdList')[1]??'').split('};')[0], configs=[...new Set(e.matches(e.readText(a.dump), /public class (GridFight\w+(?:ConfigRow|InfoRow))\b/g).map(m=>m[1]))].sort(), native=e.path.join(root, 'tools/gridfight-extract/evidence/animation/native.asm'), actions=[...new Set(e.matches(e.readText(native), /RPG\.Client\.(GridFight\w+(?:Action|Selection))::/g).map(m=>m[1]))].sort(); const result={ scope:'Installed config metadata and this checkout; named requests only, not all obfuscated requests.', warning:'Registration and config presence do not prove behavior, persistence, or native gameplay. No completion percentage.', inputs:Object.fromEntries([['protocol', protocol], ['handlers', handlers], ['grid_fight', service], ['config_dump', a.dump], ['pending_action_dispatch', native]].map(([n, p])=>[n, e.sha256_file(p)])), named_request_count:requests.length, registered_named_request_count:requests.filter(n=>n in registered).length, requests:requests.map(name=>({ name, handler:registered[name]??null, empty_ack_list_member:new RegExp('^\\s*\\.?'+e.escapeRE(name)+'\\b', 'm').test(dummy) })), native_config_row_class_count:configs.length, native_config_row_classes:configs, pending_action_classes_observed_in_native_dispatch:actions }; e.atomic_json(a.output, result, 2, true); console.log(`${requests.length} named requests; ${result.registered_named_request_count} registered; ${configs.length} native config row classes`); } e.runMain(import.meta.url, main);