Plan abgestimmt mit k9ert im RamaDama-Topic 2026-06-16.
Detection/Execution-Trennung: scripts/wiki-lint.sh ist mechanisch
(kein LLM), Subagent-Spawn nur für Fixes.
Includes:
- scripts/wiki-lint.sh (v0.1, 360 lines, 8 checks, exit 0/1/2)
- scripts/wiki-lint-test.sh (17 asserts, 3 fixtures, all green)
- scripts/test-fixtures/wiki-lint/{clean,messy,broken}-wiki/
- scripts/subagents/{wiki-lint-runner,frontmatter-migration}.md
- wiki/tasks/maintenance-todo.md (WMT-001..006, WMT-000 done)
- AGENTS.md v1.4 (Maintenance-Section hinzugefügt)
- wiki/log.md (Eintrag)
- scripts/wiki-lint-report.md (erster Lint-Run: 46 Pages, 2 Issues)
Erste Lint-Befunde (siehe Report):
- 12 Wiki-Pages ohne Frontmatter
- 14 Stubs (30% Quote)
Co-Authored-By: Hector <hector-bot@botreasury.local>
120 lines
3.6 KiB
Bash
Executable file
120 lines
3.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# wiki-lint-test.sh — Test-Suite für scripts/wiki-lint.sh
|
|
# Usage: ./scripts/wiki-lint-test.sh
|
|
|
|
set -u
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
FIXTURES="$SCRIPT_DIR/test-fixtures/wiki-lint"
|
|
LINT="$SCRIPT_DIR/wiki-lint.sh"
|
|
|
|
# Farben
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
PASS=0
|
|
FAIL=0
|
|
|
|
assert_exit() {
|
|
# $1 = expected exit code, $2 = actual, $3 = test name
|
|
local expected=$1
|
|
local actual=$2
|
|
local name=$3
|
|
if [ "$actual" -eq "$expected" ]; then
|
|
echo -e "${GREEN}✓${NC} $name (exit=$actual)"
|
|
PASS=$((PASS+1))
|
|
else
|
|
echo -e "${RED}✗${NC} $name (expected exit=$expected, got=$actual)"
|
|
FAIL=$((FAIL+1))
|
|
fi
|
|
}
|
|
|
|
assert_report_contains() {
|
|
# $1 = report file, $2 = expected substring, $3 = test name
|
|
local report=$1
|
|
local needle=$2
|
|
local name=$3
|
|
if grep -qF "$needle" "$report"; then
|
|
echo -e "${GREEN}✓${NC} $name (found: '$needle')"
|
|
PASS=$((PASS+1))
|
|
else
|
|
echo -e "${RED}✗${NC} $name (NOT found: '$needle')"
|
|
FAIL=$((FAIL+1))
|
|
fi
|
|
}
|
|
|
|
assert_report_not_contains() {
|
|
local report=$1
|
|
local needle=$2
|
|
local name=$3
|
|
if ! grep -qF "$needle" "$report"; then
|
|
echo -e "${GREEN}✓${NC} $name (correctly absent: '$needle')"
|
|
PASS=$((PASS+1))
|
|
else
|
|
echo -e "${RED}✗${NC} $name (UNEXPECTEDLY present: '$needle')"
|
|
FAIL=$((FAIL+1))
|
|
fi
|
|
}
|
|
|
|
run_lint() {
|
|
# $1 = fixture dir, $2 = report file
|
|
"$LINT" "$1" "$2" >/dev/null 2>&1
|
|
return $?
|
|
}
|
|
|
|
echo "=== Test 1: clean-wiki (expect: exit 0, 0 issues)==="
|
|
REPORT=$(mktemp)
|
|
run_lint "$FIXTURES/clean-wiki" "$REPORT"
|
|
assert_exit 0 $? "clean-wiki exit code"
|
|
assert_report_contains "$REPORT" "Total Wiki-Pages: 3" "clean-wiki total count"
|
|
assert_report_contains "$REPORT" "✅ **0 / 3 (0%)**" "clean-wiki no stubs"
|
|
assert_report_contains "$REPORT" "✅ **3 / 3 present**" "clean-wiki all frontmatter present"
|
|
assert_report_contains "$REPORT" "✅ **0 broken**" "clean-wiki no broken refs"
|
|
assert_report_contains "$REPORT" "✅ **0 orphans**" "clean-wiki no orphans"
|
|
rm -f "$REPORT"
|
|
|
|
echo ""
|
|
echo "=== Test 2: messy-wiki (expect: exit 1, issues detected)==="
|
|
REPORT=$(mktemp)
|
|
run_lint "$FIXTURES/messy-wiki" "$REPORT"
|
|
EXIT=$?
|
|
assert_exit 1 $EXIT "messy-wiki exit code (issues found)"
|
|
assert_report_contains "$REPORT" "Stub-Quote" "messy-wiki has stub section"
|
|
assert_report_contains "$REPORT" "polymarket" "messy-wiki polymarket cluster detected"
|
|
assert_report_contains "$REPORT" "❌" "messy-wiki has at least one failure indicator"
|
|
rm -f "$REPORT"
|
|
|
|
echo ""
|
|
echo "=== Test 3: broken-wiki (expect: exit 1, multiple issues)==="
|
|
REPORT=$(mktemp)
|
|
run_lint "$FIXTURES/broken-wiki" "$REPORT"
|
|
EXIT=$?
|
|
assert_exit 1 $EXIT "broken-wiki exit code"
|
|
assert_report_contains "$REPORT" "broken" "broken-wiki broken refs detected"
|
|
assert_report_contains "$REPORT" "Missing" "broken-wiki missing frontmatter"
|
|
assert_report_contains "$REPORT" "orphan" "broken-wiki orphans detected"
|
|
rm -f "$REPORT"
|
|
|
|
echo ""
|
|
echo "=== Test 4: real repo (sanity check, expect exit 1)==="
|
|
REPORT=$(mktemp)
|
|
run_lint "$REPO_ROOT" "$REPORT"
|
|
EXIT=$?
|
|
assert_exit 1 $EXIT "real-repo exit code"
|
|
assert_report_contains "$REPORT" "frontmatter" "real-repo frontmatter section"
|
|
assert_report_contains "$REPORT" "Stub-Quote" "real-repo stub section"
|
|
rm -f "$REPORT"
|
|
|
|
echo ""
|
|
echo "=============================="
|
|
echo -e "Passed: ${GREEN}$PASS${NC}"
|
|
echo -e "Failed: ${RED}$FAIL${NC}"
|
|
echo "=============================="
|
|
|
|
if [ "$FAIL" -gt 0 ]; then
|
|
exit 1
|
|
fi
|
|
exit 0
|