Add search command, history browser, install script, and systemd timers
- /search command to search across memory, history, and configuration - history-browser.py for browsing and analyzing session history - install.sh for first-time setup with directory creation and validation - daily-maintenance.sh for scheduled backup, cleanup, and validation - systemd timer units for automated daily maintenance at 6 AM - Updated shell completions with 11 aliases - Test suite now covers 19 tests - Bump version to 1.1.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
65
automation/daily-maintenance.sh
Executable file
65
automation/daily-maintenance.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
# Daily maintenance script for Claude Code configuration
|
||||
# Runs via systemd timer or manually
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CLAUDE_DIR="${HOME}/.claude"
|
||||
LOG_DIR="${CLAUDE_DIR}/logs"
|
||||
LOG_FILE="${LOG_DIR}/maintenance-$(date +%Y-%m-%d).log"
|
||||
|
||||
mkdir -p "${LOG_DIR}"
|
||||
|
||||
log() {
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "${LOG_FILE}"
|
||||
}
|
||||
|
||||
log "=== Daily Maintenance Started ==="
|
||||
|
||||
# 1. Validate configuration
|
||||
log "Running validation..."
|
||||
if "${CLAUDE_DIR}/automation/validate-setup.sh" >> "${LOG_FILE}" 2>&1; then
|
||||
log "✓ Validation passed"
|
||||
else
|
||||
log "⚠ Validation had warnings"
|
||||
fi
|
||||
|
||||
# 2. Clean old files
|
||||
log "Running cleanup..."
|
||||
"${CLAUDE_DIR}/automation/clean.sh" >> "${LOG_FILE}" 2>&1 || true
|
||||
log "✓ Cleanup complete"
|
||||
|
||||
# 3. Create daily backup
|
||||
log "Creating backup..."
|
||||
if "${CLAUDE_DIR}/automation/backup.sh" >> "${LOG_FILE}" 2>&1; then
|
||||
log "✓ Backup created"
|
||||
else
|
||||
log "⚠ Backup failed"
|
||||
fi
|
||||
|
||||
# 4. Check for unsummarized sessions
|
||||
log "Checking session history..."
|
||||
unsummarized=$(python3 -c "
|
||||
import json
|
||||
from pathlib import Path
|
||||
idx = Path.home() / '.claude/state/personal-assistant/history/index.json'
|
||||
if idx.exists():
|
||||
data = json.load(open(idx))
|
||||
count = sum(1 for s in data.get('sessions', []) if not s.get('summarized', False))
|
||||
print(count)
|
||||
else:
|
||||
print(0)
|
||||
" 2>/dev/null || echo "0")
|
||||
|
||||
if [[ "${unsummarized}" -gt 0 ]]; then
|
||||
log "⚠ ${unsummarized} unsummarized session(s) pending"
|
||||
else
|
||||
log "✓ All sessions summarized"
|
||||
fi
|
||||
|
||||
# 5. Rotate old maintenance logs
|
||||
log "Rotating old logs..."
|
||||
find "${LOG_DIR}" -name "maintenance-*.log" -mtime +30 -delete 2>/dev/null || true
|
||||
log "✓ Log rotation complete"
|
||||
|
||||
log "=== Daily Maintenance Complete ==="
|
||||
Reference in New Issue
Block a user