@@ -124,6 +124,40 @@ gen-schema:
124124 fi
125125 @.venv/bin/python3 tools/gen_lua_proto_schema $(OUTPUT ) $(PROTO )
126126
127+ # Generate the base types schema from empty.proto
128+ .PHONY : gen-types
129+ gen-types :
130+ @if [ ! -f .venv/bin/python3 ]; then \
131+ echo " Python virtual environment not found. Run 'make setup-schema-generator' first." ; \
132+ exit 1; \
133+ fi
134+ @echo " Generating src/protobuf/types.lua from empty.proto..."
135+ @.venv/bin/python3 tools/gen_lua_proto_schema src/protobuf/types.lua empty.proto
136+ @echo " Generated src/protobuf/types.lua"
137+
138+ # Check that types.lua matches what would be generated (for CI)
139+ .PHONY : check-types
140+ check-types :
141+ @if [ ! -f .venv/bin/python3 ]; then \
142+ echo " Python virtual environment not found. Run 'make setup-schema-generator' first." ; \
143+ exit 1; \
144+ fi
145+ @echo " Checking src/protobuf/types.lua is up to date..."
146+ @mkdir -p build
147+ @.venv/bin/python3 tools/gen_lua_proto_schema build/types.lua.tmp empty.proto
148+ @if diff -q src/protobuf/types.lua build/types.lua.tmp > /dev/null 2>&1 ; then \
149+ echo " src/protobuf/types.lua is up to date" ; \
150+ rm -f build/types.lua.tmp; \
151+ else \
152+ echo " ERROR: src/protobuf/types.lua is out of date!" ; \
153+ echo " Run 'make gen-types' to regenerate it." ; \
154+ echo " " ; \
155+ echo " Diff:" ; \
156+ diff src/protobuf/types.lua build/types.lua.tmp || true ; \
157+ rm -f build/types.lua.tmp; \
158+ exit 1; \
159+ fi
160+
127161# Format Lua code with stylua
128162.PHONY : format
129163format :
@@ -162,7 +196,7 @@ lint:
162196 fi
163197
164198.PHONY : check
165- check : format-check lint
199+ check : format-check lint check-types
166200 @echo " Code quality checks complete."
167201
168202# Clean generated files
@@ -186,6 +220,8 @@ help:
186220 @echo " Schema Generation:"
187221 @echo " make setup-schema-generator - Setup Python venv for schema generator"
188222 @echo " make gen-schema PROTO=<file> OUTPUT=<file> - Generate Lua schema from proto file(s)"
223+ @echo " make gen-types - Regenerate src/protobuf/types.lua"
224+ @echo " make check-types - Verify types.lua matches empty.proto"
189225 @echo " "
190226 @echo " Code Quality:"
191227 @echo " make format - Format all code (Lua)"
0 commit comments