wiki-lint: improve backlink checker to normalize slugs before validation

This commit is contained in:
2026-05-25 06:38:05 -07:00
parent 3146f86474
commit b6684d3ebd

View File

@@ -59,10 +59,16 @@ Scan all `[[link]]` references in wiki articles. For each `[[slug]]`, check:
- If none match → flag as `[BROKEN_LINK]`
```bash
grep -rh '\[\[' wiki/ | grep -oP '\[\[\K[^\]]+' | sort -u
grep -rh '\[\[' wiki/ | grep -o '\[\[[^]]*\]\]' | sed 's/\[\[//;s/\]\]//' | sort -u
```
For each unique slug found, verify the file exists.
For each slug found, normalize before checking:
1. Strip leading `wiki/` prefix if present → flag as `[BAD_FORMAT]` (seeding agents sometimes write wrong format)
2. Strip trailing `.md` extension if present → also flag as `[BAD_FORMAT]`
3. Check existence: `wiki/<slug>.md`, `wiki/clients/<slug>.md`, `wiki/projects/<slug>.md`, `wiki/systems/<slug>.md`, `wiki/patterns/<slug>.md`
4. If no file found after normalization → flag as `[BROKEN_LINK]`
Note: `[[systems/neptune]]` will always show as broken until neptune is seeded — that's expected.
---