feat: Add scripts for linting genomes and adding individual genomes
This commit is contained in:
parent
b490e6c70f
commit
b283911134
2 changed files with 67 additions and 0 deletions
29
scripts/add-genome.sh
Normal file
29
scripts/add-genome.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# scripts/add-genome.sh
|
||||
# Helper to add a single new genome to the existing infrastructure.
|
||||
# Usage: make add-genome NAME=my-new-genome DESC="Description here"
|
||||
# =============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
source "lib/output.sh"
|
||||
source "config.env"
|
||||
|
||||
GENOME_NAME="${1:-}"
|
||||
GENOME_DESC="${2:-}"
|
||||
|
||||
if [[ -z "$GENOME_NAME" || -z "$GENOME_DESC" ]]; then
|
||||
error "Missing arguments."
|
||||
echo "Usage: $0 <genome-name> <description>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
step "Adding New Genome: ${GENOME_NAME}"
|
||||
|
||||
# Overwrite the GENOMES array for this session to process only the new one
|
||||
export GENOMES=("${GENOME_NAME}|${GENOME_DESC}")
|
||||
|
||||
# Trigger the standard genome setup logic
|
||||
bash "scripts/setup-genomes.sh"
|
||||
|
||||
success "Genome '${GENOME_NAME}' added and linked successfully!"
|
||||
38
scripts/lint-genomes.sh
Normal file
38
scripts/lint-genomes.sh
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/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
|
||||
Loading…
Add table
Reference in a new issue