Files
llm_wiki/tools/scripts/wiki-lint-orphan.ps1
T
hehaiguang1123 a6f05ab2d5 Phase 0-2: Schema cleanup, typed relations, event-driven automation
- Phase 0: AGENTS.md cleanup (dedup quotes, renumber sections, merge qmd)
- Phase 1: typed relations (manage-relations.py, graph-search.py, check-staleness.py, detect-conflicts.py)
- Phase 2: frontmatter validator, weekly lint, knowledge promotion, git hooks
- Fix .gitignore to track tools/ and .githooks/
- Fix git remote URL (remove plaintext token)
- New wiki pages: 504 pages, 34 raw sources
2026-07-01 08:05:43 +08:00

31 lines
1.1 KiB
PowerShell

[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$wikiPath = 'D:\Applications\app\kepano-obsidian-main\wiki'
$vaultPath = 'D:\Applications\app\kepano-obsidian-main'
$wikiFiles = Get-ChildItem -Path $wikiPath -Filter '*.md' -File
$pageNames = $wikiFiles | ForEach-Object { $_.BaseName }
$allMd = Get-ChildItem -Path $vaultPath -Filter '*.md' -File -Recurse | Where-Object { $_.Length -lt 500KB }
$allContent = @{}
foreach ($f in $allMd) {
try { $allContent[$f.FullName] = [System.IO.File]::ReadAllText($f.FullName) } catch {}
}
$orphans = @()
foreach ($pn in $pageNames) {
if ($pn -eq 'index' -or $pn -eq 'log') { continue }
$linkPattern = '[[' + $pn + ']'
$hasInbound = $false
foreach ($fp in $allContent.Keys) {
$baseF = [System.IO.Path]::GetFileNameWithoutExtension($fp)
if ($baseF -eq $pn) { continue }
if ($allContent[$fp] -match [regex]::Escape($linkPattern)) {
$hasInbound = $true
break
}
}
if (-not $hasInbound) { $orphans += $pn }
}
Write-Output "ORPHAN_COUNT: $($orphans.Count)"
$orphans | ForEach-Object { Write-Output $_ }