Files
Orchestrator/bahn/project-audit/scripts/confluence-check-pages.ps1
ankn a5f8fb49ab Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
      Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
      Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)

Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
2026-06-30 20:39:52 +02:00

78 lines
2.7 KiB
PowerShell

<#
.SYNOPSIS
Prueft welche Unterseiten unter der Analyse-Stammseite existieren
#>
$ConfluenceUrl = "https://arija-confluence.jaas.service.deutschebahn.com"
$SpaceKey = "BES"
$ParentPageId = "581013135"
$ApiBase = "$ConfluenceUrl/rest/api"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Token aus .secrets laden
$SecretsPath = Join-Path $ScriptDir "..\.secrets"
$PAT = $null
if (Test-Path $SecretsPath) {
Get-Content $SecretsPath | ForEach-Object {
if ($_ -match "^CONFLUENCE_TOKEN=(.+)$") {
$val = $Matches[1].Trim()
if ($val -ne "HIER_TOKEN_EINTRAGEN") { $PAT = $val }
}
}
}
if (-not $PAT) { $PAT = Read-Host "Confluence PAT" }
$Headers = @{ "Authorization" = "Bearer $PAT"; "Content-Type" = "application/json" }
Write-Host "=== Confluence Seiten-Check ===" -ForegroundColor Cyan
Write-Host "Parent: $ParentPageId"
Write-Host ""
# Alle Unterseiten laden
$Uri = "$ApiBase/content/$ParentPageId/child/page?limit=50&expand=version"
try {
$Resp = Invoke-WebRequest -Uri $Uri -Headers $Headers -UseBasicParsing -ErrorAction Stop
$Data = $Resp.Content | ConvertFrom-Json
Write-Host "Gefundene Unterseiten: $($Data.results.Count)" -ForegroundColor Green
Write-Host ""
Write-Host ("{0,-5} {1,-55} {2,-10} {3}" -f "Ver", "Titel", "ID", "Status")
Write-Host ("-" * 90)
$Data.results | Sort-Object { $_.title } | ForEach-Object {
$ver = $_.version.number
$title = $_.title
$id = $_.id
Write-Host ("{0,-5} {1,-55} {2,-10}" -f "v$ver", $title, $id)
}
} catch {
Write-Host "FEHLER: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host ""
Write-Host "=== Titel-Suche fuer Seiten 1-5 ===" -ForegroundColor Cyan
$Titles = @(
"1. Uebersicht und Gesamtbild",
"2. Identifizierte Problemfelder",
"3. Technische Roadmap 2026 - Zusammenfassung",
"4. GitLab Projektlandschaft",
"5. Abkuerzungsverzeichnis"
)
foreach ($t in $Titles) {
$SearchUri = "$ApiBase/content?spaceKey=$SpaceKey&title=$([Uri]::EscapeDataString($t))&type=page"
try {
$SearchResp = Invoke-WebRequest -Uri $SearchUri -Headers $Headers -UseBasicParsing -ErrorAction Stop
$SearchData = $SearchResp.Content | ConvertFrom-Json
if ($SearchData.results -and $SearchData.results.Count -gt 0) {
Write-Host " GEFUNDEN: $t (ID: $($SearchData.results[0].id))" -ForegroundColor Green
} else {
Write-Host " NICHT GEFUNDEN: $t" -ForegroundColor Red
}
} catch {
Write-Host " FEHLER bei: $t - $($_.Exception.Message)" -ForegroundColor Red
}
}