From 92e68fff00f6da3ed56053ea58952da77db42b2b Mon Sep 17 00:00:00 2001 From: Matteo Cherubini Date: Sat, 9 May 2026 11:34:21 +0200 Subject: [PATCH] feat: Integrate knowledge decay checks into lint-genomes script --- scripts/lint-genomes.sh | 45 ++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/scripts/lint-genomes.sh b/scripts/lint-genomes.sh index 1aad8f4..392fac7 100644 --- a/scripts/lint-genomes.sh +++ b/scripts/lint-genomes.sh @@ -2,6 +2,8 @@ # ============================================================================= # scripts/lint-genomes.sh # Executes quality control across all registered genomes. +# Iterates from the GENOMES registry in config.env — not from filesystem patterns — +# so all genomes are covered regardless of their naming convention. # ============================================================================= set -euo pipefail @@ -12,27 +14,46 @@ source "lib/lint.sh" step "Starting Knowledge Genome Linting" TOTAL_ERRORS=0 +TOTAL_STALE=0 -# Iterate through genome submodules inside the Master repo -for genome_dir in "${WORK_DIR}/${MASTER_REPO}"/genome-*/; do - [[ -d "$genome_dir" ]] || continue +for entry in "${GENOMES[@]}"; do + IFS='|' read -r GENOME_NAME _ <<< "$entry" + genome_dir="${WORK_DIR}/${MASTER_REPO}/${GENOME_NAME}" + + if [[ ! -d "$genome_dir" ]]; then + warn "Genome directory not found locally, skipping: ${genome_dir}" + continue + fi - GENOME_NAME=$(basename "$genome_dir") info "Auditing genome: ${GENOME_NAME}..." - # Find all .md files, excluding AGENTS.md and external references + # Lint all .md files except AGENTS.md and core-karpathy reference while IFS= read -r md_file; do - # Run validations - lint_markdown_file "$md_file" "$GENOME_NAME" || TOTAL_ERRORS=$((TOTAL_ERRORS + $?)) - check_privacy_consistency "$md_file" || TOTAL_ERRORS=$((TOTAL_ERRORS + $?)) + + lint_markdown_file "$md_file" "$GENOME_NAME" + file_errors=$? + TOTAL_ERRORS=$((TOTAL_ERRORS + file_errors)) + + check_privacy_consistency "$md_file" + TOTAL_ERRORS=$((TOTAL_ERRORS + $?)) + + check_knowledge_decay "$md_file" + stale=$? + TOTAL_STALE=$((TOTAL_STALE + stale)) + check_broken_links "$md_file" - done < <(find "$genome_dir" -name "*.md" ! -name "AGENTS.md" ! -path "*/core-karpathy/*") + done < <(find "$genome_dir" -name "*.md" \ + ! -name "AGENTS.md" \ + ! -path "*/core-karpathy/*") done -if [[ $TOTAL_ERRORS -eq 0 ]]; then - success "Linting passed: All files are consistent and secure." +echo "" +if [[ $TOTAL_ERRORS -eq 0 && $TOTAL_STALE -eq 0 ]]; then + success "Linting passed: all files are consistent, secure, and current." +elif [[ $TOTAL_ERRORS -eq 0 && $TOTAL_STALE -gt 0 ]]; then + warn "Linting passed with ${TOTAL_STALE} stale file(s). Review and re-validate flagged pages." else - error "Linting failed: Found ${TOTAL_ERRORS} critical issues." + error "Linting failed: ${TOTAL_ERRORS} critical issue(s), ${TOTAL_STALE} stale file(s)." exit 1 fi