-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-structure.sh
More file actions
executable file
·56 lines (46 loc) · 1.65 KB
/
validate-structure.sh
File metadata and controls
executable file
·56 lines (46 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -euo pipefail
REPO_ROOT=$(git rev-parse --show-toplevel)
cd "$REPO_ROOT"
echo "=== Repository Structure Validation ==="
echo ""
ERRORS=0
# Check file lengths (exclude web-context research)
echo "1/3 Checking file lengths..."
LONG_FILES=$(find configs/ instructions/ templates/ workflows/ patterns/ guides/ -name "*.md" 2>/dev/null | \
xargs wc -l 2>/dev/null | \
awk '$1 > 550 && $2 != "total" { print $2" ("$1" lines)" }' || true)
if [ -n "$LONG_FILES" ]; then
echo " ERROR: Files exceeding 550 lines:"
echo "$LONG_FILES" | sed 's/^/ /'
ERRORS=$((ERRORS + 1))
else
echo " ✓ All files under 550 lines"
fi
# Check for version footers
echo "2/3 Checking for version footers..."
FOOTER_FILES=$(grep -r "^\*\*Version\*\*:" configs/ instructions/ templates/ workflows/ patterns/ guides/ --include="*.md" 2>/dev/null | cut -d: -f1 | sort -u || true)
if [ -n "$FOOTER_FILES" ]; then
echo " ERROR: Found version footers (git should handle versioning):"
echo "$FOOTER_FILES" | sed 's/^/ /'
ERRORS=$((ERRORS + 1))
else
echo " ✓ No version footers found"
fi
# Check section divider consistency
echo "3/3 Checking section dividers..."
NONSTANDARD=$(grep -r "^-\{4,\}$" configs/ instructions/ templates/ workflows/ patterns/ guides/ --include="*.md" 2>/dev/null || true)
if [ -n "$NONSTANDARD" ]; then
echo " WARNING: Found dividers with 4+ hyphens (should be exactly 3):"
echo "$NONSTANDARD" | sed 's/^/ /' | head -5
else
echo " ✓ Section dividers standardized"
fi
echo ""
if [ $ERRORS -eq 0 ]; then
echo "✓ Structure validation complete"
exit 0
else
echo "ERROR: Structure validation failed ($ERRORS issues)"
exit 1
fi