feat: Add page size linting to enforce documentation limits
This commit is contained in:
parent
7f10a4f770
commit
14d78d65ea
2 changed files with 27 additions and 0 deletions
24
lib/lint.sh
24
lib/lint.sh
|
|
@ -152,6 +152,30 @@ check_knowledge_decay() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# check_page_size <file>
|
||||||
|
# Enforces the page length limits defined in agents-genome.md:
|
||||||
|
# soft cap: 400 lines → warn
|
||||||
|
# hard cap: 800 lines → error
|
||||||
|
# These limits ensure pages fit within the LLM context window without
|
||||||
|
# attention degradation and keep the wiki atomically navigable.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
check_page_size() {
|
||||||
|
local file="$1"
|
||||||
|
local lines
|
||||||
|
lines=$(wc -l < "$file")
|
||||||
|
|
||||||
|
if [[ $lines -gt 800 ]]; then
|
||||||
|
error "Page too long (${lines} lines, hard cap 800): $file"
|
||||||
|
error " Split this page into focused sub-pages and link them."
|
||||||
|
return 1
|
||||||
|
elif [[ $lines -gt 400 ]]; then
|
||||||
|
warn "Page approaching limit (${lines} lines, soft cap 400): $file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# check_broken_links <file>
|
# check_broken_links <file>
|
||||||
# Basic check for internal [[wikilinks]] that cannot be resolved locally.
|
# Basic check for internal [[wikilinks]] that cannot be resolved locally.
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@ for entry in "${GENOMES[@]}"; do
|
||||||
check_privacy_consistency "$md_file"
|
check_privacy_consistency "$md_file"
|
||||||
TOTAL_ERRORS=$((TOTAL_ERRORS + $?))
|
TOTAL_ERRORS=$((TOTAL_ERRORS + $?))
|
||||||
|
|
||||||
|
check_page_size "$md_file"
|
||||||
|
TOTAL_ERRORS=$((TOTAL_ERRORS + $?))
|
||||||
|
|
||||||
check_knowledge_decay "$md_file"
|
check_knowledge_decay "$md_file"
|
||||||
stale=$?
|
stale=$?
|
||||||
TOTAL_STALE=$((TOTAL_STALE + stale))
|
TOTAL_STALE=$((TOTAL_STALE + stale))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue