netgescon-day0/scripts/ai/continuity_auto.sh

49 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
THRESHOLD_MB="150"
APPLY_ARCHIVE="0"
TOPIC=""
NOTE=""
for arg in "$@"; do
case "$arg" in
--threshold=*) THRESHOLD_MB="${arg#*=}" ;;
--apply-archive) APPLY_ARCHIVE="1" ;;
--topic=*) TOPIC="${arg#*=}" ;;
--note=*) NOTE="${arg#*=}" ;;
--help)
cat <<'EOF'
Uso:
bash scripts/ai/continuity_auto.sh [--threshold=150] [--apply-archive] [--topic="..."] [--note="..."]
Default (safe):
- aggiorna SESSION_HANDOFF
- se topic presente aggiorna topic file
- fa solo scan chat pesanti (dry-run)
Con --apply-archive:
- oltre allo scan, archivia anche le chat sopra soglia
EOF
exit 0
;;
esac
done
bash scripts/ai/handoff_checkpoint.sh
if [[ -n "$TOPIC" ]]; then
bash scripts/ai/topic_checkpoint.sh "$TOPIC" "$NOTE"
fi
bash scripts/ai/archive_heavy_chats.sh --threshold="$THRESHOLD_MB"
if [[ "$APPLY_ARCHIVE" == "1" ]]; then
bash scripts/ai/archive_heavy_chats.sh --threshold="$THRESHOLD_MB" --apply
fi
echo "Routine completata."