Update GaCy-GO

This commit is contained in:
CAtlas0784 committed 2026-10-28 18:54:43 +07:00
1 parent da8a32f60d
commit 0cbe460e49
345 files changed
+98202 -77559

No files matched your search

+37 -1
View File
@@ -49,7 +49,7 @@ def inventory(root):
handlers = {}
for path in sorted((root / "internal/gameserver").glob("*.go")):
text = path.read_text(encoding="utf-8")
for match in re.finditer(r'\b(handleNamed|handle|rawNamed|dummy)\("([^"]+)"', text):
for match in re.finditer(r'\b(cwHandleNamed|cwHandle|handleNamed|handle|rawNamed|dummy)\("([^"]+)"', text):
if match[2].startswith("GridFight"):
handlers.setdefault(match[2], []).append({
"file": path.relative_to(root).as_posix(), "kind": match[1],
@@ -73,8 +73,44 @@ def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--root", type=pathlib.Path, default=pathlib.Path(__file__).resolve().parents[1])
parser.add_argument("--output", type=pathlib.Path, required=True)
parser.add_argument("--reference-root", type=pathlib.Path,
help="Optional source checkout to compare; never executes its server")
parser.add_argument("--markdown", type=pathlib.Path,
help="Write request/pending-action coverage for implementation planning")
args = parser.parse_args()
result = inventory(args.root.resolve())
reference = {}
if args.reference_root:
for path in sorted(args.reference_root.rglob("HandlersGridFight*.cs")):
text = path.read_text(encoding="utf-8-sig")
for name in re.findall(r"\[Opcode\(CmdIds\.(\w+CsReq)\)\]", text):
reference.setdefault(name, []).append(path.relative_to(args.reference_root).as_posix())
result["reference_source_handlers"] = reference
if args.markdown:
requests = sorted(name for name in result['commands'] if name.endswith('CsReq'))
lines = ['# CW dispatcher and source comparison', '',
'Generated by `tools/inventory_cw.py` from the current revision table and source registrations.',
'**Registration is not gameplay verification.** A registered pending dispatcher still needs each action implemented.',
'Reference source names are evidence for comparison only; they are not protocol aliases.', '',
'| Current request | Go registration | Reference same name |',
'| --- | --- | --- |']
for name in requests:
handlers = result['registrations'].get(name.removesuffix('CsReq'), [])
go = ', '.join(f"`{h['file']}:{h['line']}` ({h['kind']})" for h in handlers) or 'Missing'
lines.append(f"| `{name}` | {go} | {'Yes' if name in reference else 'Not matched'} |")
root = args.root.resolve()
dispatcher = (root / 'internal/gameserver/currency_wars_entry_choice.go').read_text(encoding='utf-8')
body = result['types']['GridFightHandleBonfireHealHpCsReq']['body']
arms = re.findall(r'^\s*\w+\s+(\w+)\s*=\s*\d+;', body, re.M)
lines += ['', '## Pending action arms', '',
'“Referenced” means the dispatcher inspects the field; it does not prove the entire action/effect works.', '',
'| Schema arm | Dispatcher |', '| --- | --- |']
for arm in arms:
if arm in ('queue_position',):
continue
lines.append(f"| `{arm}` | {'Referenced' if 'req.Get' + arm + '()' in dispatcher else 'Missing'} |")
args.markdown.parent.mkdir(parents=True, exist_ok=True)
args.markdown.write_text('\n'.join(lines) + '\n', encoding='utf-8')
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(json.dumps(result, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
print(f"CW: {len(result['commands'])} commands, {len(result['types'])} reachable declarations, "