[Protocol] Single-source-of-truth protocol version + publish @cockatrice/protocol

The protocol version is now declared once in libcockatrice_protocol/protocol_version.json.
CMake reads it at configure time and emits a generated protocol_version.h exposing
COCKATRICE_PROTOCOL_VERSION; remote_client.cpp and serversocketinterface.cpp both
pick it up via the existing libcockatrice_protocol link.

The same JSON file is bundled into a new @cockatrice/protocol npm package
(scripts/package-protocol.mjs + .github/workflows/protocol-publish.yml) so
TypeScript consumers (Sockatrice/webclient) can derive PROTOCOL_VERSION from the
identical source instead of hand-typing the literal. The workflow dry-runs
npm pack on PRs and publishes to GitHub Packages on stable releases only.
This commit is contained in:
ZeldaZach 2026-05-23 12:59:58 -04:00
parent 98c00c55ed
commit cc4a53b850
No known key found for this signature in database
7 changed files with 214 additions and 2 deletions

View file

@ -79,6 +79,7 @@
#include <libcockatrice/protocol/pb/serverinfo_deckstorage.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_replay.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
#include <libcockatrice/protocol/protocol_version.h>
#include <libcockatrice/utility/trice_limits.h>
#include <server_response_containers.h>
#include <server_room.h>
@ -88,7 +89,7 @@ inline Q_LOGGING_CATEGORY(AbstractServerSocketInterfaceLog, "abstract_server_soc
inline Q_LOGGING_CATEGORY(TcpServerSocketInterfaceLog, "tcp_server_socket_interface");
inline Q_LOGGING_CATEGORY(WebsocketServerSocketInterfaceLog, "websocket_server_socket_interface");
static const int protocolVersion = 14;
static const int protocolVersion = COCKATRICE_PROTOCOL_VERSION;
AbstractServerSocketInterface::AbstractServerSocketInterface(Servatrice *_server,
Servatrice_DatabaseInterface *_databaseInterface,