Skip to content

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

chore: add docs.json validation to pre-commit hook

Mario044cbb1fa0e4
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
index 97732a40..787bdcdf 100755
--- a/.githooks/pre-commit
+++ b/.githooks/pre-commit
@@ -15,4 +15,7 @@ go vet ./...
echo "🦀 pre-commit: go test..."
go test ./... -count=1 -timeout=30s
+echo "🦀 pre-commit: docs.json validation..."
+./scripts/check-docs-json.sh
+
echo "🦀 PINCH! All checks passed."
diff --git a/docs/docs.json b/docs/docs.json
index e6665eb9..88e9a21b 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -20,7 +20,7 @@
"guides/cdp-url-shared-chrome.md",
"guides/docker.md",
"guides/headed-mode-guide.md",
- "guides/identifing-instances.md"
+ "guides/identifying-instances.md"
]
}
}
diff --git a/scripts/check-docs-json.sh b/scripts/check-docs-json.sh
new file mode 100755
index 00000000..835c9d8a
--- /dev/null
+++ b/scripts/check-docs-json.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Validate docs.json - check that all referenced files exist
+
+set -e
+
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m'
+
+DOCS_JSON="docs/docs.json"
+DOCS_DIR="docs"
+
+# Check if docs.json exists
+if [ ! -f "$DOCS_JSON" ]; then
+ echo -e "${YELLOW}⚠️ $DOCS_JSON not found - skipping validation${NC}"
+ exit 0
+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)
+
+if [ -z "$files" ]; then
+ echo -e "${YELLOW}⚠️ No markdown files found in $DOCS_JSON${NC}"
+ exit 0
+fi
+
+missing_files=()
+
+# Check each file exists
+for file in $files; do
+ full_path="$DOCS_DIR/$file"
+
+ if [ ! -f "$full_path" ]; then
+ missing_files+=("$file")
+ fi
+done
+
+# Report results
+if [ ${#missing_files[@]} -eq 0 ]; then
+ count=$(echo "$files" | wc -l)
+ echo -e "${GREEN}✓ Documentation index valid${NC} ($count files)"
+ exit 0
+else
+ echo -e "${RED}✗ Missing documentation files referenced in docs.json:${NC}"
+ for file in "${missing_files[@]}"; do
+ echo -e "${RED} - $DOCS_DIR/$file${NC}"
+ done
+ echo ""
+ echo -e "${YELLOW}Fix: Create missing files or update docs/docs.json${NC}"
+ exit 1
+fi