knowledge-genome-orchestrator/scripts/lint-genomes.sh

38 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# =============================================================================
# scripts/lint-genomes.sh
# Executes quality control across all registered genomes.
# =============================================================================
set -euo pipefail
source "lib/output.sh"
source "config.env"
source "lib/lint.sh"
step "Starting Knowledge Genome Linting"
TOTAL_ERRORS=0
# Iterate through genome submodules inside the Master repo
for genome_dir in "${WORK_DIR}/${MASTER_REPO}"/genome-*/; do
[[ -d "$genome_dir" ]] || continue
GENOME_NAME=$(basename "$genome_dir")
info "Auditing genome: ${GENOME_NAME}..."
# Find all .md files, excluding AGENTS.md and external references
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 + $?))
check_broken_links "$md_file"
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."
else
error "Linting failed: Found ${TOTAL_ERRORS} critical issues."
exit 1
fi