- Add delete_document_chunks for reprocessing, save extracted text to disk - Expand case directory structure (original/extracted/proofread/backup) - Update classifier patterns (תגובה, הודעת עמדה) - Fix proofreader agent paths for new directory layout - Update HEARTBEAT to notify on every task completion - Improve bidi_table with LRE/PDF directional embedding - Add Paperclip project verification and auto-close setup issue - Add auto-sync-cases.sh for Gitea synchronization Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38 lines
1.4 KiB
Bash
Executable File
38 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Auto-sync case repos to Gitea
|
|
# Runs via crontab every minute, commits and pushes any changes found.
|
|
|
|
CASES_DIR="/home/chaim/legal-ai/data/cases"
|
|
LOG="/home/chaim/legal-ai/data/.auto-sync.log"
|
|
GIT_ENV="GIT_AUTHOR_NAME=Ezer Mishpati GIT_AUTHOR_EMAIL=legal@local GIT_COMMITTER_NAME=Ezer Mishpati GIT_COMMITTER_EMAIL=legal@local GIT_TERMINAL_PROMPT=0"
|
|
|
|
for status_dir in "$CASES_DIR"/new "$CASES_DIR"/in-progress "$CASES_DIR"/completed; do
|
|
[ -d "$status_dir" ] || continue
|
|
for case_dir in "$status_dir"/*/; do
|
|
[ -d "$case_dir/.git" ] || continue
|
|
|
|
cd "$case_dir" || continue
|
|
|
|
# Check for any changes (modified, new, deleted)
|
|
changes=$(git status --porcelain 2>/dev/null)
|
|
[ -z "$changes" ] && continue
|
|
|
|
# Stage all changes
|
|
git add -A 2>/dev/null
|
|
|
|
# Build commit message from changed files
|
|
changed_files=$(git diff --cached --name-only 2>/dev/null | head -5)
|
|
count=$(git diff --cached --name-only 2>/dev/null | wc -l)
|
|
case_name=$(basename "$case_dir")
|
|
msg="סנכרון אוטומטי — ${count} קבצים שונו"
|
|
|
|
# Commit
|
|
env $GIT_ENV git commit -m "$msg" --quiet 2>/dev/null
|
|
if [ $? -eq 0 ]; then
|
|
# Push (non-blocking, ignore errors)
|
|
git push origin main --quiet 2>/dev/null
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') | $case_name | $count files synced" >> "$LOG"
|
|
fi
|
|
done
|
|
done
|