#!/bin/bash # OWASP AST10 Content Validation Script # Run this script to validate documentation quality echo "๐Ÿ” OWASP Agentic Skills Top 10 - Content Validation" echo "==================================================" # Check if we're in the right directory if [ ! -f "_config.yml" ]; then echo "โŒ Error: Run this script from the project root directory" exit 1 fi echo "โœ… Project structure validated" # Check Jekyll build echo "" echo "๐Ÿ—๏ธ Testing Jekyll build..." if command -v jekyll &> /dev/null; then if jekyll build --quiet 2>/dev/null; then echo "โœ… Jekyll build successful" else echo "โŒ Jekyll build failed" exit 1 fi else echo "โš ๏ธ Jekyll not installed - skipping build test" fi # Count AST files ast_count=$(find . -name "ast*.md" -not -path "./.git/*" | wc -l) echo "" echo "๐Ÿ“Š Content Statistics:" echo " AST files: $ast_count" # Check for required files required_files=("_config.yml" "index.md" "README.md" "MAINTENANCE.md" "universal-skill-format.md") echo "" echo "๐Ÿ“ Required files check:" for file in "${required_files[@]}"; do if [ -f "$file" ]; then echo " โœ… $file exists" else echo " โŒ $file missing" fi done # Check frontmatter in AST files echo "" echo "๐Ÿ“ Frontmatter validation:" for file in ast*.md; do if [ -f "$file" ]; then # Check if file starts with --- using portable method first_line=$(head -n 1 "$file" 2>/dev/null || sed -n '1p' "$file" 2>/dev/null || echo "") if [ "$first_line" = "---" ]; then echo " โœ… $file has frontmatter" else echo " โŒ $file missing frontmatter" fi fi done # Check for broken internal links (basic check) echo "" echo "๐Ÿ”— Internal link validation:" broken_links=0 for file in *.md ast*.md; do if [ -f "$file" ]; then # Look for markdown links to .md files links=$(grep -o '\[.*\]([^)]*\.md)' "$file" | sed 's/.*](\([^)]*\.md\).*/\1/') for link in $links; do # Skip external URLs โ€” this check validates internal links only case "$link" in http://*|https://*|//*|mailto:*) continue ;; esac # Remove anchor links clean_link=$(echo "$link" | cut -d'#' -f1) if [ ! -f "$clean_link" ]; then echo " โŒ Broken link in $file: $clean_link" broken_links=$((broken_links + 1)) fi done fi done if [ $broken_links -eq 0 ]; then echo " โœ… No broken internal links found" fi # Check for TODO comments or placeholders echo "" echo "๐Ÿ“‹ Content completeness check:" todo_count=$(grep -r "TODO\|FIXME\|PLACEHOLDER" --include="*.md" . | wc -l) if [ $todo_count -gt 0 ]; then echo " โš ๏ธ Found $todo_count TODO/FIXME items" grep -r "TODO\|FIXME\|PLACEHOLDER" --include="*.md" . | head -5 else echo " โœ… No TODO items found" fi # Check for accidental content artifacts that should not be committed echo "" echo "๐Ÿงน Artifact hygiene check:" artifact_count=$(grep -r "\|[A-Za-z]:\\\\\\Users\\\\" --include="*.md" . | wc -l) if [ $artifact_count -gt 0 ]; then echo " โŒ Found $artifact_count artifact marker(s) (e.g., or local absolute paths)" grep -r "\|[A-Za-z]:\\\\\\Users\\\\" --include="*.md" . | head -5 else echo " โœ… No content artifacts found" fi # Final summary echo "" echo "๐ŸŽฏ Validation Summary:" echo " - Project structure: โœ…" echo " - Content files: $ast_count AST files found" echo " - Required files: $(ls -1 "${required_files[@]}" 2>/dev/null | wc -l)/${#required_files[@]} present" echo " - Frontmatter: All AST files have frontmatter" echo " - Internal links: Checked for broken links" echo " - Content completeness: $( [ $todo_count -eq 0 ] && echo "โœ…" || echo "โš ๏ธ" )" echo " - Artifact hygiene: $( [ $artifact_count -eq 0 ] && echo "โœ…" || echo "โŒ" )" echo "" echo "โœจ Validation complete!" if [ $broken_links -gt 0 ] || [ $todo_count -gt 0 ] || [ $artifact_count -gt 0 ]; then echo "โš ๏ธ Some issues found - please review above" exit 1 else echo "๐ŸŽ‰ All checks passed!" fi