31 lines
714 B
Bash
31 lines
714 B
Bash
|
|
#!/bin/bash
|
||
|
|
# Regenerate Nickel constraints from TOML master file
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
OUTPUT_FILE="schemas/platform/common/constraints.ncl"
|
||
|
|
|
||
|
|
echo "🔄 Generating constraints from TOML master..."
|
||
|
|
|
||
|
|
# Run Nickel generator and properly unescape output
|
||
|
|
nickel eval scripts/generate-constraints.ncl \
|
||
|
|
| sed 's/^"//;s/"$//' \
|
||
|
|
| sed 's/\\n/\n/g' \
|
||
|
|
| sed 's/\\"/"/g' \
|
||
|
|
> "$OUTPUT_FILE"
|
||
|
|
|
||
|
|
echo "✅ Generated: $OUTPUT_FILE"
|
||
|
|
|
||
|
|
# Validate
|
||
|
|
if nickel typecheck "$OUTPUT_FILE" > /dev/null 2>&1; then
|
||
|
|
echo "✅ Validation passed"
|
||
|
|
else
|
||
|
|
echo "❌ Validation failed"
|
||
|
|
nickel typecheck "$OUTPUT_FILE"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Count constraints
|
||
|
|
COUNT=$(grep -c "contract.from_validator" "$OUTPUT_FILE")
|
||
|
|
echo "📊 Generated $COUNT constraints"
|