hale-api / scripts /validate-templates.ps1
Raunak211006's picture
Deploy HALE API v3.1
cc38116 verified
Raw
History Blame Contribute Delete
2.3 kB
# 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
}