Files
aitbc/scripts/nightly_health_check.sh
AITBC System 3df15a0d8d docs(planning): update milestone status to reflect completed exchange integration
- Update executive summary to reflect completed exchange integration
- Change focus from implementation gap to sustainability and security
- Remove "40% missing" language and emphasize production readiness
- Shift milestone focus to reliability and hardening phases
2026-03-18 16:12:54 +01:00

54 lines
1.8 KiB
Bash

#!/bin/bash
#
# AITBC Nightly Health Check
# Runs master planning cleanup and reports documentation/planning cleanliness.
#
set -e
PROJECT_ROOT="/opt/aitbc"
PLANNING_DIR="$PROJECT_ROOT/docs/10_plan"
DOCS_DIR="$PROJECT_ROOT/docs"
MASTER_WORKFLOW="$PROJECT_ROOT/scripts/run_master_planning_cleanup.sh"
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_err() { echo -e "${RED}[ERROR]${NC} $1"; }
log_info "Starting nightly health check..."
if [[ -x "$MASTER_WORKFLOW" ]]; then
log_info "Running master planning cleanup workflow..."
if ! "$MASTER_WORKFLOW"; then
log_warn "Master workflow reported issues; continuing to collect stats."
fi
else
log_warn "Master workflow script not found or not executable: $MASTER_WORKFLOW"
fi
log_info "Collecting documentation/planning stats..."
planning_files=$(find "$PLANNING_DIR" -name "*.md" | wc -l)
completed_files=$(find "$DOCS_DIR/completed" -name "*.md" | wc -l)
archive_files=$(find "$DOCS_DIR/archive" -name "*.md" | wc -l)
documented_files=$(find "$DOCS_DIR" -name "documented_*.md" | wc -l)
completion_markers=$(find "$PLANNING_DIR" -name "*.md" -exec grep -l "✅" {} \; | wc -l)
echo "--- Nightly Health Check Summary ---"
echo "Planning files (docs/10_plan): $planning_files"
echo "Completed files (docs/completed): $completed_files"
echo "Archive files (docs/archive): $archive_files"
echo "Documented files (docs/): $documented_files"
echo "Files with completion markers: $completion_markers"
if [[ $completion_markers -eq 0 ]]; then
log_info "Planning cleanliness OK (0 completion markers)."
else
log_warn "Completion markers remain in planning files ($completion_markers)."
fi
log_info "Nightly health check completed."