File size: 2,304 Bytes
cc38116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
57
58
59
# GSD Template Validation Script
# Validates all template files in .gsd/templates/

$ErrorCount = 0
$WarningCount = 0
$TemplatesChecked = 0

Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Cyan
Write-Host " GSD β–Ί VALIDATING TEMPLATES" -ForegroundColor Cyan
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Cyan
Write-Host ""

$templates = Get-ChildItem ".gsd/templates/*.md"

foreach ($file in $templates) {
    $TemplatesChecked++
    $content = Get-Content $file.FullName -Raw
    $hasErrors = $false
    
    # Check for title (# heading)
    if ($content -notmatch "^# ") {
        Write-Host "❌ $($file.Name): Missing title (# heading)" -ForegroundColor Red
        $ErrorCount++
        $hasErrors = $true
    }
    
    # Check for Last updated marker
    if ($content -notmatch "Last updated") {
        Write-Host "⚠️  $($file.Name): Missing 'Last updated' marker" -ForegroundColor Yellow
        $WarningCount++
    }
    
    # Check minimum length (templates should have substance)
    if ($content.Length -lt 200) {
        Write-Host "⚠️  $($file.Name): Very short template (<200 chars)" -ForegroundColor Yellow
        $WarningCount++
    }
    
    if (-not $hasErrors) {
        Write-Host "βœ… $($file.Name)" -ForegroundColor Green
    }
}

Write-Host ""
Write-Host "───────────────────────────────────────────────────────" -ForegroundColor Gray
Write-Host ""
Write-Host "Templates checked: $TemplatesChecked"
Write-Host "Errors: $ErrorCount" -ForegroundColor $(if ($ErrorCount -gt 0) { "Red" } else { "Green" })
Write-Host "Warnings: $WarningCount" -ForegroundColor $(if ($WarningCount -gt 0) { "Yellow" } else { "Green" })
Write-Host ""

if ($ErrorCount -eq 0) {
    Write-Host "βœ… All templates valid!" -ForegroundColor Green
    exit 0
} else {
    Write-Host "❌ Validation failed" -ForegroundColor Red
    exit 1
}