✨ Add automated session logging system
Some checks failed
Build and Deploy Docs / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy Docs / build-and-deploy (push) Has been cancelled
- 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)
This commit is contained in:
81
scripts/logging/shell-integration.sh
Executable file
81
scripts/logging/shell-integration.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
# ============================================================
|
||||
# shell-integration.sh — Інтеграція логування з shell
|
||||
# ============================================================
|
||||
# Додайте до ~/.zshrc або ~/.bashrc:
|
||||
# source /Users/apple/github-projects/microdao-daarion/scripts/logging/shell-integration.sh
|
||||
# ============================================================
|
||||
|
||||
# Шляхи
|
||||
export DAARION_PROJECT="/Users/apple/github-projects/microdao-daarion"
|
||||
export DAARION_LOGS="$DAARION_PROJECT/logs"
|
||||
|
||||
# Aliases для швидкого доступу
|
||||
alias daarion="cd $DAARION_PROJECT"
|
||||
alias session-start="$DAARION_PROJECT/scripts/logging/session-start.sh"
|
||||
alias session-log="$DAARION_PROJECT/scripts/logging/session-log.sh"
|
||||
alias session-end="$DAARION_PROJECT/scripts/logging/session-end.sh"
|
||||
alias git-sync="$DAARION_PROJECT/scripts/git-sync-all.sh"
|
||||
|
||||
# Функція для логування важливих команд
|
||||
daarion-log() {
|
||||
local cmd="$*"
|
||||
local date=$(date +%Y-%m-%d)
|
||||
local time=$(date +%H:%M:%S)
|
||||
local session_file="$DAARION_LOGS/sessions/${date}.md"
|
||||
|
||||
if [ -f "$session_file" ]; then
|
||||
echo "- **$time** — \`$cmd\`" >> "$session_file"
|
||||
fi
|
||||
|
||||
# Виконати команду
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
# Функція для швидкого запису нотатки
|
||||
daarion-note() {
|
||||
local note="$*"
|
||||
local date=$(date +%Y-%m-%d)
|
||||
local time=$(date +%H:%M)
|
||||
local session_file="$DAARION_LOGS/sessions/${date}.md"
|
||||
|
||||
if [ ! -f "$session_file" ]; then
|
||||
mkdir -p "$DAARION_LOGS/sessions"
|
||||
cat > "$session_file" << EOF
|
||||
# 📅 Session Log: $date
|
||||
|
||||
**Проєкт:** DAARION & MicroDAO
|
||||
|
||||
---
|
||||
|
||||
## 📋 Нотатки
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "- **$time** — 📝 $note" >> "$session_file"
|
||||
echo "✅ Нотатку додано"
|
||||
}
|
||||
|
||||
# Автоматичне логування при вході в директорію проєкту
|
||||
daarion-auto-session() {
|
||||
if [[ "$PWD" == "$DAARION_PROJECT"* ]]; then
|
||||
local date=$(date +%Y-%m-%d)
|
||||
local session_file="$DAARION_LOGS/sessions/${date}.md"
|
||||
|
||||
if [ ! -f "$session_file" ]; then
|
||||
echo "📝 Нова сесія для $date"
|
||||
session-start "Автоматична сесія"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Hook для zsh (опціонально)
|
||||
if [ -n "$ZSH_VERSION" ]; then
|
||||
# Додати до chpwd hook
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd daarion-auto-session
|
||||
fi
|
||||
|
||||
# Повідомлення при завантаженні
|
||||
echo "🔧 DAARION logging loaded. Commands: session-start, session-log, session-end, daarion-note"
|
||||
Reference in New Issue
Block a user