a4f8941fca
Consolidates the HbM: RPG project (formerly the loose hbm-books working folder) into a single repo. ObsidianNotes, foundry-lore, and foundry-system are wired in as submodules pointing at their existing Gitea repos. Loose tooling scripts are organized under tools/, obsolete/one-off scripts (fix_vault.py, generate_mocs.py, debug-*.ts, write_file_helper.py) and _books/ (superseded by ObsidianNotes) are excluded via .gitignore rather than deleted. foundryvtt-admin is excluded pending its own separate repo.
55 lines
1.7 KiB
PowerShell
55 lines
1.7 KiB
PowerShell
$repoRoot = (Resolve-Path "$PSScriptRoot\..").Path
|
|
$vaultDir = "$repoRoot\ObsidianNotes"
|
|
|
|
$targetDirs = @(
|
|
"$vaultDir\npcs",
|
|
"$vaultDir\concepts",
|
|
"$vaultDir\organizations",
|
|
"$vaultDir\locations",
|
|
"$vaultDir\races"
|
|
)
|
|
|
|
$reportFile = "$vaultDir\short_descriptions.md"
|
|
$threshold = 150
|
|
|
|
$shortFiles = @()
|
|
|
|
foreach ($dir in $targetDirs) {
|
|
if (-not (Test-Path $dir)) { continue }
|
|
|
|
$files = Get-ChildItem -Path $dir -Recurse -Filter "*.md"
|
|
foreach ($file in $files) {
|
|
$content = Get-Content $file.FullName -Raw -Encoding UTF8
|
|
|
|
# Remove YAML frontmatter
|
|
$contentWithoutYaml = $content -replace '(?s)^---\n.*?\n---\n', ''
|
|
|
|
# Count words
|
|
$words = $contentWithoutYaml -split '\s+' | Where-Object { $_ -ne '' }
|
|
$wordCount = $words.Count
|
|
|
|
if ($wordCount -lt $threshold) {
|
|
$shortFiles += [PSCustomObject]@{
|
|
Path = $file.FullName -replace [regex]::Escape("$vaultDir\"), ""
|
|
WordCount = $wordCount
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$reportContent = @("# Short Descriptions Report (< $threshold words)", "")
|
|
if ($shortFiles.Count -eq 0) {
|
|
$reportContent += "All analyzed files meet the word count threshold!"
|
|
} else {
|
|
$reportContent += "| File Path | Word Count |"
|
|
$reportContent += "|-----------|------------|"
|
|
foreach ($item in $shortFiles | Sort-Object WordCount) {
|
|
$reportContent += "| $($item.Path) | $($item.WordCount) |"
|
|
}
|
|
}
|
|
|
|
$reportContent -join "`n" | Set-Content -Path $reportFile -Encoding UTF8
|
|
|
|
Write-Host "Audit complete! Found $($shortFiles.Count) short files." -ForegroundColor Cyan
|
|
Write-Host "Report saved to: $reportFile" -ForegroundColor Green
|