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
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
[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 $_ }
|
||||
Reference in New Issue
Block a user