feat: weekly_digest.py - 周度日报合成分析 (读取7份日报→AI合成周报)

This commit is contained in:
fxy
2026-06-18 23:52:12 +08:00
parent 2329a45b80
commit f83bc5af00
2 changed files with 398 additions and 0 deletions

31
scripts/run_weekly_digest.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Weekly digest cron wrapper
# Run every Sunday at 08:00 UTC (16:00 Beijing)
# Synthesizes 7 daily digests into a week-level analysis report
#
# Scheduled earlier than the daily digest (22:00) to ensure
# the most recent daily digest has already been generated.
set -e
PROJECT_DIR="$HOME/inspiration-collector"
LOG_FILE="$PROJECT_DIR/ai-insights/logs/weekly_digest.log"
mkdir -p "$(dirname "$LOG_FILE")"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting weekly digest synthesis..." >> "$LOG_FILE"
cd "$PROJECT_DIR"
/usr/bin/python3 analyzers/weekly_digest.py >> "$LOG_FILE" 2>&1
# Git push handled inside weekly_digest.py (git_push_weekly)
# Duplicate push here as safety net in case the script's push failed
cd "$PROJECT_DIR"
if [[ -n $(git status --porcelain ai-insights/) ]]; then
git add ai-insights/
git commit -m "weekly digest W$(date '+%V') - safety push"
git push origin main 2>&1 | tail -3 >> "$LOG_FILE"
echo "Safety push done" >> "$LOG_FILE"
fi
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Weekly digest done." >> "$LOG_FILE"