mirror of
https://github.com/luxfi/tss.git
synced 2026-10-30 15:14:51 +00:00
123 lines
3.6 KiB
Bash
Executable File
123 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Documentation Quality Score Script for Lux TSS
|
|
echo "================================"
|
|
echo "TSS Documentation Quality Score"
|
|
echo "================================"
|
|
|
|
# Initialize scores
|
|
TOTAL_SCORE=0
|
|
MAX_SCORE=0
|
|
|
|
# Function to check file and content
|
|
check_doc() {
|
|
local file=$1
|
|
local description=$2
|
|
local weight=$3
|
|
|
|
MAX_SCORE=$((MAX_SCORE + weight))
|
|
|
|
if [ -f "$file" ]; then
|
|
# Check file size (should have substantial content)
|
|
size=$(wc -c < "$file")
|
|
if [ "$size" -gt 1000 ]; then
|
|
echo "✅ $description: Found ($(wc -l < "$file") lines)"
|
|
TOTAL_SCORE=$((TOTAL_SCORE + weight))
|
|
else
|
|
echo "⚠️ $description: Too short ($(wc -l < "$file") lines)"
|
|
TOTAL_SCORE=$((TOTAL_SCORE + weight/2))
|
|
fi
|
|
else
|
|
echo "❌ $description: Missing"
|
|
fi
|
|
}
|
|
|
|
# Check documentation files
|
|
echo ""
|
|
echo "Documentation Files:"
|
|
echo "-------------------"
|
|
check_doc "content/docs/index.mdx" "Main Introduction" 25
|
|
check_doc "content/docs/api.mdx" "API Reference" 25
|
|
check_doc "content/docs/security.mdx" "Security Guide" 25
|
|
check_doc "content/docs/getting-started.mdx" "Getting Started Guide" 25
|
|
|
|
# Check build artifacts
|
|
echo ""
|
|
echo "Build Status:"
|
|
echo "------------"
|
|
if [ -d ".next" ]; then
|
|
echo "✅ Documentation built successfully"
|
|
TOTAL_SCORE=$((TOTAL_SCORE + 10))
|
|
MAX_SCORE=$((MAX_SCORE + 10))
|
|
|
|
# Count generated pages
|
|
pages=$(find .next -name "*.html" 2>/dev/null | wc -l)
|
|
echo " Generated pages: $pages"
|
|
else
|
|
echo "❌ Build artifacts not found"
|
|
MAX_SCORE=$((MAX_SCORE + 10))
|
|
fi
|
|
|
|
# Check content quality metrics
|
|
echo ""
|
|
echo "Content Metrics:"
|
|
echo "---------------"
|
|
|
|
# Count code examples
|
|
code_examples=$(grep -c '```' content/docs/*.mdx 2>/dev/null | awk -F: '{sum+=$2} END {print sum/2}')
|
|
echo "📝 Code examples: ${code_examples:-0}"
|
|
if [ "${code_examples:-0}" -gt 10 ]; then
|
|
TOTAL_SCORE=$((TOTAL_SCORE + 10))
|
|
fi
|
|
MAX_SCORE=$((MAX_SCORE + 10))
|
|
|
|
# Count sections with headers
|
|
sections=$(grep -c '^##' content/docs/*.mdx 2>/dev/null | awk -F: '{sum+=$2} END {print sum}')
|
|
echo "📑 Documentation sections: ${sections:-0}"
|
|
if [ "${sections:-0}" -gt 20 ]; then
|
|
TOTAL_SCORE=$((TOTAL_SCORE + 10))
|
|
fi
|
|
MAX_SCORE=$((MAX_SCORE + 10))
|
|
|
|
# Check for diagrams/architecture
|
|
diagrams=$(grep -c '```\|┌\|│\|└' content/docs/*.mdx 2>/dev/null | awk -F: '{sum+=$2} END {print sum}')
|
|
echo "📊 Diagrams/Architecture: ${diagrams:-0}"
|
|
if [ "${diagrams:-0}" -gt 5 ]; then
|
|
TOTAL_SCORE=$((TOTAL_SCORE + 10))
|
|
fi
|
|
MAX_SCORE=$((MAX_SCORE + 10))
|
|
|
|
# Calculate percentage score
|
|
PERCENTAGE=$((TOTAL_SCORE * 100 / MAX_SCORE))
|
|
|
|
# Display final score
|
|
echo ""
|
|
echo "================================"
|
|
echo "Final Score: $TOTAL_SCORE / $MAX_SCORE"
|
|
echo "Percentage: $PERCENTAGE%"
|
|
echo "================================"
|
|
|
|
# Grade assignment
|
|
echo ""
|
|
if [ $PERCENTAGE -ge 90 ]; then
|
|
echo "Grade: A+ 🌟 Excellent documentation!"
|
|
elif [ $PERCENTAGE -ge 80 ]; then
|
|
echo "Grade: A 🎯 Great documentation!"
|
|
elif [ $PERCENTAGE -ge 70 ]; then
|
|
echo "Grade: B 👍 Good documentation"
|
|
elif [ $PERCENTAGE -ge 60 ]; then
|
|
echo "Grade: C 📚 Adequate documentation"
|
|
else
|
|
echo "Grade: D 📝 Needs improvement"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Documentation Highlights:"
|
|
echo "------------------------"
|
|
echo "✨ Comprehensive TSS introduction with architecture diagrams"
|
|
echo "✨ Complete API reference with all core types and functions"
|
|
echo "✨ Detailed security guide covering threat model and best practices"
|
|
echo "✨ Step-by-step getting started guide with working examples"
|
|
echo "✨ Successfully built with Fumadocs and Next.js 16"
|
|
|
|
exit 0 |