Files
microdao-daarion/scripts/logging/session-end.sh
Apple 744c149300
Some checks failed
Build and Deploy Docs / build-and-deploy (push) Has been cancelled
Add automated session logging system
- Created logs/ structure (sessions, operations, incidents)
- Added session-start/log/end scripts
- Installed Git hooks for auto-logging commits/pushes
- Added shell integration for zsh
- Created CHANGELOG.md
- Documented today's session (2026-01-10)
2026-01-10 04:53:17 -08:00

98 lines
2.5 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# ============================================================
# session-end.sh — Завершення робочої сесії
# ============================================================
# Автоматично:
# - Додає підсумок сесії
# - Комітить зміни
# - Пушить на всі репозиторії
# ============================================================
set -e
PROJECT_DIR="/Users/apple/github-projects/microdao-daarion"
SESSIONS_DIR="$PROJECT_DIR/logs/sessions"
DATE=$(date +%Y-%m-%d)
TIME=$(date +%H:%M)
SESSION_FILE="${DAARION_SESSION_FILE:-$SESSIONS_DIR/${DATE}.md}"
# Кольори
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
echo -e "${GREEN}🏁 Завершення сесії${NC}"
echo "================================"
# Додати підсумок
if [ -f "$SESSION_FILE" ]; then
cat >> "$SESSION_FILE" << EOF
### $TIME — Сесію завершено
---
## 📊 Підсумок
- **Завершено:** $TIME
- **Git status:** $(cd "$PROJECT_DIR" && git status --short | wc -l | tr -d ' ') змінених файлів
EOF
echo -e "📄 Оновлено: ${CYAN}$SESSION_FILE${NC}"
fi
# Git операції
cd "$PROJECT_DIR"
echo ""
echo -e "${YELLOW}📦 Git операції...${NC}"
# Додати всі зміни
git add -A
# Перевірити чи є що комітити
if git diff --cached --quiet; then
echo " Немає змін для коміту"
else
# Коміт
COMMIT_MSG="📝 Session $DATE: auto-commit on session end"
git commit -m "$COMMIT_MSG"
echo -e "✅ Commit: ${CYAN}$COMMIT_MSG${NC}"
# Push на всі remote
echo ""
echo -e "${YELLOW}🚀 Push на всі репозиторії...${NC}"
# GitHub
if git push origin 2>/dev/null; then
echo " ✅ GitHub (origin)"
else
echo " ⚠️ GitHub — помилка або немає змін"
fi
# Gitea
if git push gitea 2>/dev/null; then
echo " ✅ Gitea"
else
echo " ⚠️ Gitea — помилка або недоступний"
fi
# GitLab (через tunnel)
if nc -z localhost 8929 2>/dev/null; then
if git push gitlab 2>/dev/null; then
echo " ✅ GitLab"
else
echo " ⚠️ GitLab — помилка"
fi
else
echo " ⚠️ GitLab — SSH tunnel не активний"
fi
fi
echo ""
echo -e "${GREEN}✅ Сесію завершено!${NC}"
echo "До зустрічі! 👋"