docs: close OKF conformance gaps found by night audit
- references/okf-spec.md: replace v0.2 note with the deltas verified against upstream SPEC.md 2026-10-19 (timestamp->generated.at and # Citations->sources are the two breaking changes; trust fields and root-index okf_version are additive; bundle stays v0.1). - index.md: restore the agentic-web-research section lost in the 2026-08-28 rebuild and link log.md (index-coverage doctrine). - gen-keybinds.sh emits OKF frontmatter so its generated artifact (tools/niri/keybindings.md, regenerated, 120 bindings) passes kb-lint; test added red->green. - fix the two broken [[niri]] wikilinks (handy, noctalia-shell). Refs #29
This commit is contained in:
1 parent
01d9d3fbd5
commit
e86e60af39
8 files changed
+98
-12
No files matched your search
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Doctrine check: every dir has index.md; index links every sibling file/dir."""
|
||||
import re, sys
|
||||
from pathlib import Path
|
||||
kb = Path(sys.argv[1])
|
||||
issues = []
|
||||
dirs = sorted({p.parent for p in kb.rglob("*.md")})
|
||||
for d in dirs:
|
||||
idx = d / "index.md"
|
||||
if not idx.is_file() and d != kb:
|
||||
issues.append(f"{d.relative_to(kb)}: no index.md")
|
||||
continue
|
||||
if not idx.is_file():
|
||||
continue
|
||||
text = idx.read_text(errors="replace")
|
||||
linked = set()
|
||||
for m in re.finditer(r"\]\((?!https?:|#)([^)#\s]+?)(?:#[^)]*)?\)", text):
|
||||
t = m.group(1)
|
||||
target = (d / t).resolve() if not t.startswith("/") else (kb / t.lstrip("/")).resolve()
|
||||
linked.add(target)
|
||||
# wikilinks too
|
||||
wl_names = {m.group(1).strip().rsplit("/", 1)[-1] for m in re.finditer(r"\[\[([^\]|#]+)", text)}
|
||||
for sib in sorted(d.iterdir()):
|
||||
if sib.suffix != ".md" or sib.name == "index.md":
|
||||
continue
|
||||
if sib.resolve() not in linked and sib.stem not in wl_names:
|
||||
issues.append(f"{d.relative_to(kb)}/index.md: does not link {sib.name}")
|
||||
# subdirs of d linked as their index?
|
||||
for sub in sorted(d.iterdir()):
|
||||
if sub.is_dir() and (sub / "index.md").is_file():
|
||||
subidx = (sub / "index.md").resolve()
|
||||
dirref = sub.resolve()
|
||||
if subidx not in linked and dirref not in linked:
|
||||
# also accept link to sub/ or sub/index.md or wikilink to dir name
|
||||
if not re.search(re.escape(sub.name) + r"[/)]", text):
|
||||
issues.append(f"{d.relative_to(kb)}/index.md: does not link subdir {sub.name}/")
|
||||
for i in issues:
|
||||
print(i)
|
||||
print(f"index-coverage: {len(issues)} issue(s)")
|
||||
sys.exit(1 if issues else 0)
|
||||
@@ -27,6 +27,16 @@ KBD="${KBD:-$HOME/.config/niri/cfg/keybinds.kdl}"
|
||||
[ -f "$KBD" ] || { echo "error: no such file: $KBD" >&2; exit 1; }
|
||||
|
||||
gen() {
|
||||
echo "---"
|
||||
echo "type: reference"
|
||||
echo "title: Niri Keybindings"
|
||||
echo "description: Live keybinding cheat sheet generated from $(basename "$KBD") — do not edit by hand."
|
||||
echo "tags:"
|
||||
echo " - niri"
|
||||
echo " - keybindings"
|
||||
echo "generated: { by: scripts/gen-keybinds.sh }"
|
||||
echo "---"
|
||||
echo
|
||||
echo "# Niri Keybindings"
|
||||
echo
|
||||
echo "> GENERATED by \`scripts/gen-keybinds.sh\` from \`$(basename "$KBD")\` — do not edit by hand."
|
||||
|
||||
Reference in new issue
Block a user