Files
sbroenne__mcp-server-excel/scripts/check-plugin-readmes.ps1
Stefan Broenner b2eab4ca91 Migrate plugins to Agent Plugins 1.0 (#776)
Build plugins from canonical source templates, validate portable manifests and MCP configuration, synchronize complete Agent Skill directories, and scope Excel E2E to runtime-impacting changes.

Tests: 23 targeted SkillGeneration tests passed; Release build completed with 0 warnings and 0 errors; Excel E2E path classification passed for 12 cases; MCPB and Agent Skills packaging passed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Co-authored-by: Stefan Brönner <sbroenne@openclaw.fritz.box>
Copilot-Session: 858e5fa0-f0ef-490f-a154-00c470943904
2026-08-16 10:11:38 +02:00

124 lines
4.5 KiB
PowerShell

#!/usr/bin/env pwsh
<#
.SYNOPSIS
Validates canonical plugin README quality before commit
.DESCRIPTION
Checks plugin READMEs in .github/plugins/*/README.md for:
- Minimum content length (detects thin/stub content)
- Required sections for published marketplace plugins
- Prevents shipping incomplete plugin documentation
This gate catches thin canonical READMEs before they are published.
.EXAMPLE
.\check-plugin-readmes.ps1
.NOTES
Part of pre-commit validation. Added after v1.8.44 to prevent
shipping stub plugin READMEs to marketplace.
#>
$ErrorActionPreference = "Stop"
$rootDir = Split-Path -Parent $PSScriptRoot
$pluginOverlayDir = Join-Path $rootDir ".github\plugins"
Write-Host "Validating canonical plugin READMEs..." -ForegroundColor Cyan
Write-Host ""
# Minimum content requirements for published plugin READMEs
$MINIMUM_LINES = 40 # Stub content is usually < 20 lines; full content is 80+
$REQUIRED_SECTIONS = @(
"# Excel", # Plugin title
"## Prerequisites", # Requirements
"## Installation" # How to install
# Optional: "## What's Included", "## Notes", "## Support"
)
$violations = @()
# Find canonical plugin READMEs (skip marketplace-repo README - that's repo-level docs)
$pluginReadmes = Get-ChildItem -Path $pluginOverlayDir -Filter "README.md" -Recurse |
Where-Object { $_.DirectoryName -notmatch "marketplace-repo" }
if ($pluginReadmes.Count -eq 0) {
Write-Host "No canonical plugin READMEs found - validation skipped" -ForegroundColor Yellow
exit 0
}
foreach ($readme in $pluginReadmes) {
$pluginName = Split-Path -Parent $readme.DirectoryName | Split-Path -Leaf
$pluginPath = $readme.DirectoryName | Split-Path -Leaf
$relativePath = $readme.FullName.Replace("$rootDir\", "")
Write-Host "Checking: $relativePath" -ForegroundColor White
$content = Get-Content $readme.FullName -Raw
$lines = Get-Content $readme.FullName
# Check 1: Minimum line count
$lineCount = $lines.Count
if ($lineCount -lt $MINIMUM_LINES) {
$violations += [PSCustomObject]@{
File = $relativePath
Issue = "Insufficient content"
Details = "Only $lineCount lines (minimum: $MINIMUM_LINES). This appears to be stub content."
Severity = "ERROR"
}
Write-Host " ❌ Too short: $lineCount lines (minimum: $MINIMUM_LINES)" -ForegroundColor Red
} else {
Write-Host " ✓ Length OK: $lineCount lines" -ForegroundColor Green
}
# Check 2: Required sections
$missingSections = @()
foreach ($section in $REQUIRED_SECTIONS) {
if ($content -notmatch [regex]::Escape($section)) {
$missingSections += $section
}
}
if ($missingSections.Count -gt 0) {
$violations += [PSCustomObject]@{
File = $relativePath
Issue = "Missing required sections"
Details = "Missing: $($missingSections -join ', ')"
Severity = "ERROR"
}
Write-Host " ❌ Missing sections: $($missingSections -join ', ')" -ForegroundColor Red
} else {
Write-Host " ✓ All required sections present" -ForegroundColor Green
}
Write-Host ""
}
# Report results
if ($violations.Count -eq 0) {
Write-Host "All canonical plugin READMEs validated!" -ForegroundColor Green
Write-Host " Files checked: $($pluginReadmes.Count)" -ForegroundColor Cyan
exit 0
} else {
Write-Host "VALIDATION FAILED: Canonical plugin READMEs have issues" -ForegroundColor Red
Write-Host ""
foreach ($violation in $violations) {
Write-Host "[$($violation.Severity)] $($violation.File)" -ForegroundColor Red
Write-Host " Issue: $($violation.Issue)" -ForegroundColor Yellow
Write-Host " $($violation.Details)" -ForegroundColor Gray
Write-Host ""
}
Write-Host "WHY THIS MATTERS:" -ForegroundColor Yellow
Write-Host " Canonical plugin READMEs are copied directly into published packages." -ForegroundColor White
Write-Host " Stub/thin content means users see incomplete marketplace documentation." -ForegroundColor White
Write-Host ""
Write-Host "TO FIX:" -ForegroundColor Yellow
Write-Host " 1. Enrich the canonical README with full content (80+ lines)" -ForegroundColor White
Write-Host " 2. Include all required sections (Prerequisites, Installation, etc.)" -ForegroundColor White
Write-Host " 3. Re-run this check before publishing" -ForegroundColor White
Write-Host ""
exit 1
}