proto-socket/tools/check_proto_sync.sh
toki c384516b47 feat: implement new communication patterns and add cross-test support
- Add Transport class for unified communication layer
- Implement new communicator patterns
- Add VERSIONING.md for version management
- Add crosstest files for Dart/Go integration testing
- Update protocol documentation
- Add new skills and templates for AI-assisted development
- Various bug fixes and improvements to Dart implementation
2026-04-12 07:53:31 +09:00

38 lines
1,023 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
dart_proto="$repo_root/dart/lib/src/packets/message_common.proto"
go_proto="$repo_root/go/packets/message_common.proto"
if [[ ! -f "$dart_proto" ]]; then
echo "Missing canonical Dart proto: $dart_proto" >&2
exit 1
fi
if [[ ! -f "$go_proto" ]]; then
echo "Missing Go proto copy: $go_proto" >&2
exit 1
fi
tmp_dir="$(mktemp -d)"
trap 'rm -rf "$tmp_dir"' EXIT
normalize_proto() {
awk '
/^[[:space:]]*option go_package[[:space:]]*=.*;[[:space:]]*$/ { next }
/^[[:space:]]*$/ { next }
{ print }
' "$1"
}
normalize_proto "$dart_proto" >"$tmp_dir/dart.proto"
normalize_proto "$go_proto" >"$tmp_dir/go.proto"
if ! cmp -s "$tmp_dir/dart.proto" "$tmp_dir/go.proto"; then
echo "Proto schema mismatch: go/packets/message_common.proto must match the Dart canonical proto except option go_package." >&2
diff -u "$tmp_dir/dart.proto" "$tmp_dir/go.proto" >&2
exit 1
fi
echo "Proto schemas are in sync."