Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

improve: add JSON syntax validation to check-docs-json.sh

Mario12327e579a39
diff --git a/scripts/check-docs-json.sh b/scripts/check-docs-json.sh
index 835c9d8a..cc940c19 100755
--- a/scripts/check-docs-json.sh
+++ b/scripts/check-docs-json.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Validate docs.json - check that all referenced files exist
+# Validate docs.json - check JSON syntax and verify all referenced files exist
set -e
@@ -17,6 +17,23 @@ if [ ! -f "$DOCS_JSON" ]; then
exit 0
fi
+# Validate JSON syntax
+if command -v jq &> /dev/null; then
+ if ! jq empty "$DOCS_JSON" 2>/dev/null; then
+ echo -e "${RED}✗ Invalid JSON syntax in $DOCS_JSON${NC}"
+ jq empty "$DOCS_JSON" # Show error
+ exit 1
+ fi
+elif command -v python3 &> /dev/null; then
+ if ! python3 -m json.tool "$DOCS_JSON" > /dev/null 2>&1; then
+ echo -e "${RED}✗ Invalid JSON syntax in $DOCS_JSON${NC}"
+ python3 -m json.tool "$DOCS_JSON" # Show error
+ exit 1
+ fi
+else
+ echo -e "${YELLOW}⚠️ jq or python3 not found - skipping JSON syntax check${NC}"
+fi
+
# Extract all file paths from docs.json
# Looks for patterns like "path/to/file.md"
files=$(grep -oE '"[a-zA-Z0-9/_.-]+\.md"' "$DOCS_JSON" | tr -d '"' | sort -u)