# Erzeugt die Skill-Tabelle in README.md zwischen und # neu. Mit -Check wird nur geprueft, ob die Tabelle aktuell ist (Exit-Code 1, wenn nicht). # Aufruf: scripts\update-index.ps1 [-Check] param([switch]$Check) . (Join-Path $PSScriptRoot 'lib.ps1') $RepoWeb = 'https://git.gundel.dev/dg/claude-skills' $readme = Join-Path $Root 'README.md' $current = Read-Text $readme $lines = $current -split "`n" $start = [Array]::IndexOf($lines, '') $end = [Array]::IndexOf($lines, '') if ($start -lt 0 -or $end -lt $start) { Write-Error 'README.md enthaelt die Marker / nicht.' exit 1 } $table = @('| Skill | Kurzbeschreibung | Version | Doku | Download | Erweiterung (.mcpb) |', '|---|---|---|---|---|---|') foreach ($n in (Get-SkillNames)) { $dir = Join-Path $SkillsDir $n $desc = '' $skill = Join-Path $dir 'SKILL.md' if (Test-Path $skill) { $fm = Get-Frontmatter $skill if ($null -ne $fm) { $d = Get-FmValue $fm 'description' if ($d) { $desc = $d } } } $desc = $desc.Replace('|', '\|') $ver = Get-SkillVersion $dir $tagEnc = [Uri]::EscapeDataString("$n/v$ver") $zipLink = "[{0}-v{1}.zip]({2}/releases/download/{3}/{0}-v{1}.zip)" -f $n, $ver, $RepoWeb, $tagEnc $mcpb = '' if (Test-Path (Join-Path $dir 'extension\manifest.json')) { $mcpb = "[{0}-v{1}.mcpb]({2}/releases/download/{3}/{0}-v{1}.mcpb)" -f $n, $ver, $RepoWeb, $tagEnc } $table += ('| [{0}](skills/{0}/) | {1} | {2} | [README](skills/{0}/README.md) | {3} | {4} |' -f $n, $desc, $ver, $zipLink, $mcpb) } $newLines = @() if ($start -ge 0) { $newLines += $lines[0..$start] } $newLines += $table $newLines += $lines[$end..($lines.Count - 1)] $new = $newLines -join "`n" if ($Check) { if ($new -cne $current) { Write-Host 'README.md ist nicht aktuell - scripts\update-index.ps1 ausfuehren und committen.' exit 1 } Write-Host 'README.md ist aktuell.' } else { Write-Text $readme $new Write-Host 'README.md aktualisiert.' }