From b6684d3ebd89c0a237fadf929c97ca0554a85ca1 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Mon, 25 May 2026 06:38:05 -0700 Subject: [PATCH] wiki-lint: improve backlink checker to normalize slugs before validation --- .claude/commands/wiki-lint.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.claude/commands/wiki-lint.md b/.claude/commands/wiki-lint.md index c89efbb..2881de1 100644 --- a/.claude/commands/wiki-lint.md +++ b/.claude/commands/wiki-lint.md @@ -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/.md`, `wiki/clients/.md`, `wiki/projects/.md`, `wiki/systems/.md`, `wiki/patterns/.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. ---